Files
harineandClaude Sonnet 5 2fee57bd44 Auto-deploy website on push to master
Adds a Jenkinsfile stage that copies website/index.html to the live
nginx docroot whenever a change touches website/, so teammates can
edit the site (via Gitea web UI or a normal PR) without needing VM
access -- merge to master and it's live within one poll cycle (~5 min).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-18 00:33:44 +08:00

67 lines
2.0 KiB
Groovy

// CI pipeline for BowlEye (PinPoint). Builds the Debug APK and runs unit
// tests on every push. Runs on the team19 VM's Jenkins install, using the
// Android SDK at /opt/android-sdk (see docs/ for the VM setup this depends on).
pipeline {
agent any
options {
timeout(time: 45, unit: 'MINUTES')
disableConcurrentBuilds()
buildDiscarder(logRotator(numToKeepStr: '20'))
}
environment {
ANDROID_HOME = '/opt/android-sdk'
ANDROID_SDK_ROOT = '/opt/android-sdk'
}
stages {
stage('Checkout') {
steps {
checkout scm
}
}
stage('Prepare SDK pointer') {
steps {
// AGP will also pick up ANDROID_HOME from the environment, but
// writing local.properties explicitly keeps this working even
// if the job ever runs on a different agent/environment setup.
sh 'echo "sdk.dir=/opt/android-sdk" > local.properties'
}
}
stage('Build Debug APK') {
steps {
sh 'chmod +x ./gradlew'
sh './gradlew assembleDebug --no-daemon --stacktrace'
}
}
stage('Unit Tests') {
steps {
sh './gradlew testDebugUnitTest --no-daemon --stacktrace'
}
}
stage('Deploy website') {
// Only runs when a push actually touches website/, so unrelated
// app commits don't trigger a redeploy. Just a plain file copy --
// nginx serves the file straight off disk, no reload needed.
when {
changeset 'website/**'
}
steps {
sh 'cp website/index.html /var/www/pinpoint-site/index.html'
}
}
}
post {
always {
junit allowEmptyResults: true, testResults: '**/build/test-results/**/*.xml'
archiveArtifacts artifacts: 'app/build/outputs/apk/**/*.apk', allowEmptyArchive: true
}
}
}