Files
tmail-flutter/JenkinsfileMobile
T

67 lines
2.2 KiB
Plaintext

pipeline {
agent {
label 'mobile'
}
options {
timeout(time: 180, unit: 'MINUTES')
disableConcurrentBuilds(abortPrevious: true)
buildDiscarder(logRotator(daysToKeepStr: '5', artifactDaysToKeepStr: '5'))
}
environment {
FLUTTER_VERSION = '3.47.9'
FLUTTER_ROOT = "/opt/flutter-${FLUTTER_VERSION}"
PATH = "${FLUTTER_ROOT}/bin:${env.PATH}"
FIREBASE_PROJECT_ID = 'twake-195010'
RESULTS_BUCKET="flutter-test-results"
PREBUILD_SKIP_WEB = '1'
}
stages {
stage('Check Flutter version') {
steps {
sh './scripts/ci-assert-flutter-version.sh'
}
}
stage('Prebuild') {
steps {
sh './scripts/prebuild.sh'
}
}
stage('Run Patrol Mobile Integration Tests') {
steps {
withCredentials([file(credentialsId: 'firebase-testlab-sa', variable: 'GOOGLE_APPLICATION_CREDENTIALS')]) {
// One Patrol job per agent: the backend container and its ports are host-wide.
sh 'flock -o /tmp/tmail-patrol-backend.lock ./scripts/patrol-integration-test-with-docker.sh'
}
}
}
}
post {
always {
script {
echo 'Running post-build cleanup...'
echo 'Archiving Firebase Test Lab results...'
archiveArtifacts artifacts: 'ftl-results/**, ci-logs/**', allowEmptyArchive: true, fingerprint: true
junit testResults: 'ftl-results/**/test_result_*.xml', allowEmptyResults: true
// Tear down the backend Docker stack if it is still running and belongs to this workspace.
sh '''
[ -f scripts/ci-backend-teardown.sh ] || exit 0
flock -n -o /tmp/tmail-patrol-backend.lock bash scripts/ci-backend-teardown.sh \
|| echo "agent backend lock held by another job; skip teardown."
'''
}
deleteDir() /* clean up our workspace */
}
failure {
echo 'Pipeline failed. Review the console log for details.'
}
}
}