status-react/ci/tests/Jenkinsfile.e2e-prs

107 lines
2.9 KiB
Plaintext
Raw Normal View History

pipeline {
agent { label 'linux' }
parameters {
string(
name: 'BRANCH_NAME',
description: 'Name of the branch to checkout and build.',
defaultValue: 'develop',
)
string(
name: 'TEST_MARKERS',
description: 'Marker expression for matching tests to run.',
2022-01-10 14:19:26 +00:00
defaultValue: 'critical or high',
)
string(
name: 'APK_NAME',
description: 'Filename of APK uploaded to SauceLabs, path, or URL.',
)
string(
name: 'PR_ID',
description: 'ID of the Pull Request triggering this build.',
)
2021-12-29 16:10:22 +00:00
string(
name: 'KEYWORD_EXPRESSION',
description: 'This will run tests which contain names that match the given string expression (Optional)',
defaultValue: '',
)
string(
name: 'TR_CASE_IDS',
2021-12-29 16:10:22 +00:00
description: 'IDs of the TestRail case, separated by a comma (Optional)',
defaultValue: '',
)
}
options {
disableConcurrentBuilds()
}
stages {
stage('Checks') {
steps { script {
if (params.APK_NAME == null) { error("APK_NAME parameter not set!") }
if (params.PR_ID == null) { error("PR_ID parameter not set!") }
} }
}
stage('Setup') {
steps { script {
dir('test/appium') {
sh 'pip3 install --user -r requirements.txt'
}
} }
}
stage('Test') {
steps { script {
currentBuild.displayName = "PR-${params.PR_ID}"
/* for managing optional arguments */
def extraPytestOpts = ''
if (params.TR_CASE_IDS != '') {
extraPytestOpts = "--run_testrail_ids='${params.TR_CASE_IDS}'"
}
withCredentials([
usernamePassword(
credentialsId: 'status-im-auto',
usernameVariable: 'GIT_HUB_USER', /* ignored */
passwordVariable: 'GIT_HUB_TOKEN'
),
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'
),
]) {
dir('test/appium/tests') {
sh """
python3 -m pytest \
--numprocesses 15 \
--rerun_count=2 \
--testrail_report=True \
2021-12-29 16:10:22 +00:00
-m \"${params.TEST_MARKERS}\" \
-k \"${params.KEYWORD_EXPRESSION}\" \
--apk=${params.APK_NAME} \
--build=PR-${params.PR_ID} \
--pr_number=${params.PR_ID} \
${extraPytestOpts}
"""
}
}
} }
}
}
}