ci: cleanup e2e tests and builds from jenkins combined job

This commit is contained in:
Anton Iakimov 2023-08-07 11:29:55 +02:00
parent 11c798817e
commit 2976830497
No known key found for this signature in database
GPG Key ID: DEA1FE58DD8BF7FA
3 changed files with 19 additions and 148 deletions

View File

@ -9,8 +9,6 @@ pipeline {
disableConcurrentBuilds() disableConcurrentBuilds()
/* Prevent Jenkins jobs from running forever */ /* Prevent Jenkins jobs from running forever */
timeout(time: 40, unit: 'MINUTES') timeout(time: 40, unit: 'MINUTES')
/* Allow copying of artifacts from this job. */
copyArtifactPermission('/status-mobile/e2e/*')
/* Limit builds retained */ /* Limit builds retained */
buildDiscarder(logRotator( buildDiscarder(logRotator(
numToKeepStr: '10', numToKeepStr: '10',
@ -49,9 +47,6 @@ pipeline {
stage('Android') { steps { script { stage('Android') { steps { script {
apk = jenkins.Build('status-mobile/platforms/android') apk = jenkins.Build('status-mobile/platforms/android')
} } } } } }
stage('Android e2e') { steps { script {
apke2e = jenkins.Build('status-mobile/platforms/android-e2e')
} } }
stage('Tests') { steps { script { stage('Tests') { steps { script {
jenkins.Build('status-mobile/platforms/tests') jenkins.Build('status-mobile/platforms/tests')
} } } } } }
@ -61,9 +56,7 @@ pipeline {
steps { script { steps { script {
sh('rm -f pkg/*') sh('rm -f pkg/*')
jenkins.copyArts(ios) jenkins.copyArts(ios)
//jenkins.copyArts(iose2e)
jenkins.copyArts(apk) jenkins.copyArts(apk)
jenkins.copyArts(apke2e)
sha = "pkg/${utils.pkgFilename(ext: 'sha256')}" sha = "pkg/${utils.pkgFilename(ext: 'sha256')}"
dir('pkg') { dir('pkg') {
/* generate sha256 checksums for upload */ /* generate sha256 checksums for upload */
@ -77,8 +70,8 @@ pipeline {
/* object for easier URLs handling */ /* object for easier URLs handling */
urls = [ urls = [
/* mobile */ /* mobile */
Apk: utils.pkgUrl(apk), Apke2e: utils.pkgUrl(apke2e), Apk: utils.pkgUrl(apk),
iOS: utils.pkgUrl(ios), /*iOSe2e: utils.pkgUrl(iose2e),*/ iOS: utils.pkgUrl(ios),
Diawi: utils.getEnv(ios, 'DIAWI_URL'), Diawi: utils.getEnv(ios, 'DIAWI_URL'),
/* upload the sha256 checksums file too */ /* upload the sha256 checksums file too */
SHA: s3.uploadArtifact(sha), SHA: s3.uploadArtifact(sha),
@ -102,17 +95,6 @@ pipeline {
} }
} } } }
} }
stage('Run e2e') {
when { expression { btype == 'nightly' && params.PUBLISH } }
steps { script {
e2eApk = utils.getEnv(apke2e, 'SAUCE_URL')
build(
job: 'status-mobile/e2e/status-app-nightly',
parameters: [string(name: 'APK_URL', value: e2eApk)],
wait: false
)
} }
}
} }
} }

View File

@ -7,14 +7,24 @@ pipeline {
parameters { parameters {
string( string(
name: 'APK_URL', name: 'APK_BUILD_NUMBER',
description: 'URL of APK uploaded to SauceLabs.', description: 'platform/e2e build number for apk artifact',
) )
string( string(
name: 'KEYWORD_EXPRESSION', name: 'KEYWORD_EXPRESSION',
description: 'This will run tests which contain names that match the given string expression (Optional)', description: 'This will run tests which contain names that match the given string expression (Optional)',
defaultValue: '', defaultValue: '',
) )
string(
name: 'BRANCH',
description: 'Name of the branch to checkout and build.',
defaultValue: 'develop',
)
string(
name: 'TR_CASE_IDS',
description: 'IDs of the TestRail case, separated by a comma (Optional)',
defaultValue: '',
)
} }
options { options {
@ -23,15 +33,14 @@ pipeline {
stages { stages {
stage('Fetch') { stage('Fetch') {
when { expression { !params.APK_URL } }
steps { script { steps { script {
copyArtifacts( copyArtifacts(
projectName: "status-mobile/nightly", projectName: "status-mobile/platforms/android-e2e",
filter: '*-x86.apk', filter: 'result/*-x86.apk',
/* WARNING: This copies the latest available artifact. */ selector: specific(env.APK_BUILD_NUMBER),
selector: lastWithArtifacts(),
) )
apk_path = "${env.WORKSPACE}/${utils.findFile('*-x86.apk')}" apk_path = "${env.WORKSPACE}/${utils.findFile('result/*-x86.apk')}"
} } } }
} }

View File

@ -1,120 +0,0 @@
#!/usr/bin/env groovy
library 'status-jenkins-lib@v1.7.12'
pipeline {
agent { label 'linux' }
parameters {
string(
name: 'APK_BUILD_NUMBER',
description: 'platform/e2e build number for apk artifact',
)
string(
name: 'KEYWORD_EXPRESSION',
description: 'This will run tests which contain names that match the given string expression (Optional)',
defaultValue: '',
)
string(
name: 'BRANCH',
description: 'Name of the branch to checkout and build.',
defaultValue: 'develop',
)
string(
name: 'TR_CASE_IDS',
description: 'IDs of the TestRail case, separated by a comma (Optional)',
defaultValue: '',
)
}
options {
disableConcurrentBuilds()
}
stages {
stage('Fetch') {
steps { script {
copyArtifacts(
projectName: "status-mobile/platforms/android-e2e",
filter: 'result/*-x86.apk',
selector: specific(env.APK_BUILD_NUMBER),
)
apk_path = "${env.WORKSPACE}/${utils.findFile('result/*-x86.apk')}"
} }
}
stage('Setup') {
steps { script {
dir('test/appium') {
sh 'pip3 install --user -r requirements.txt'
}
} }
}
stage('Test') {
steps {
withCredentials([
usernamePassword(
credentialsId: 'test-rail-api',
usernameVariable: 'TESTRAIL_USER',
passwordVariable: 'TESTRAIL_PASS'
),
usernamePassword(
credentialsId: 'sauce-labs-api',
usernameVariable: 'SAUCE_USERNAME',
passwordVariable: 'SAUCE_ACCESS_KEY'
),
string(
credentialsId: 'etherscan-api-key',
variable: 'ETHERSCAN_API_KEY'
),
string(
credentialsId: 'infura-e2e-token',
variable: 'WEB3_INFURA_PROJECT_ID'
),
file(
credentialsId: "mobile-tests-eth-accounts",
variable: 'TEST_ETH_ACCOUNTS_FILE'
),
]) {
dir('test/appium/tests') {
/* Provide Eth test accounts secrets. */
sh 'cp -f $TEST_ETH_ACCOUNTS_FILE users.py'
sh """
python3 -m pytest \
--numprocesses 6 \
--rerun_count=2 \
--testrail_report=True \
-m testrail_id \
-m \"new_ui_critical or new_ui_medium\" \
-k \"${params.KEYWORD_EXPRESSION}\" \
--apk=${params.APK_URL ?: apk_path}
"""
}
}
}
}
}
post {
always {
script {
sauce('sauce-labs-cred') {
saucePublisher()
}
}
}
success {
script {
junit(
testDataPublishers: [[$class: 'SauceOnDemandReportPublisher', jobVisibility: 'public']],
testResults: 'test/appium/tests/*.xml'
)
}
}
cleanup {
sh 'make purge'
}
}
}