status-desktop/test/e2e/ci/Jenkinsfile

113 lines
2.9 KiB
Plaintext
Raw Normal View History

#!/usr/bin/env groovy
library 'status-jenkins-lib@v1.7.13'
pipeline {
agent {
label 'linux && x86_64 && qt-5.15.2'
}
environment {
QT_QPA_PLATFORMTHEME = "qt5ct"
QT_LOGGING_DEBUG = 1
QT_DEBUG_PLUGINS = 1
SQUISH_DIR = "/opt/squish-runner-7.1-20230222-1555"
PYTHONPATH = "${SQUISH_DIR}/lib:${SQUISH_DIR}/lib/python:${PYTHONPATH}"
LD_LIBRARY_PATH = "${SQUISH_DIR}/lib:${SQUISH_DIR}/python3/lib:${LD_LIBRARY_PATH}"
CREDS = credentials('test-rail-api-devops')
TESTRAIL_URL = "https://ethstatus.testrail.net"
}
parameters {
string(
name: 'BUILD',
description: 'Paste a number of PR that you want to test.',
defaultValue: 'PR-'
)
string(
name: 'TEST_NAME',
description: 'Paste test name/part of test name to run specific test',
defaultValue: ''
)
string(
name: 'TEST_SCOPE',
description: 'Paste tag to run specific scope of tests',
defaultValue: ''
)
string(
name: 'TESTRAIL_RUN_ID',
description: 'Test run ID in Test Rail',
defaultValue: ''
)
}
options {
timestamps()
/* Prevent Jenkins jobs from running forever */
timeout(time: 120, unit: 'MINUTES')
/* manage how many builds we keep */
buildDiscarder(logRotator(
numToKeepStr: '10',
daysToKeepStr: '30',
artifactNumToKeepStr: '3',
))
}
stages {
stage('Download') {
steps { script {
copyArtifacts(
projectName: "status-desktop/branches/linux/x86_64/package/${params.BUILD}/",
filter: 'pkg/*-x86_64.tar.gz',
selector: lastWithArtifacts(),
target: "${env.WORKSPACE}/tmp"
)
def pkg_path = "${env.WORKSPACE}/${utils.findFile('tmp/pkg/*-x86_64.tar.gz')}"
sh "tar -zxvf '${pkg_path}' -C '${env.WORKSPACE}/tmp'"
env.APP_DIR = "${env.WORKSPACE}/${utils.findFile('tmp/*.AppImage')}"
} }
}
stage('Setup') {
steps { script {
sh 'pip3 install --user -r requirements.txt'
} }
}
stage('Test') {
steps { wrap([
$class: 'Xvfb',
autoDisplayName: true,
parallelBuild: true,
screen: '1920x1080x24',
]) { script {
sh "fluxbox &"
env.TESTRAIL_USR = "${CREDS_USR}"
env.TESTRAIL_PWD = "${CREDS_PSW}"
def cmd = ''
if (params.TEST_NAME != "") {
cmd = cmd + " -k ${params.TEST_NAME}"
}
if (params.TEST_SCOPE != "") {
cmd = cmd + " -m ${params.TEST_SCOPE}"
}
sh "cp -f '${env.WORKSPACE}'/configs/_local.py.ci '${env.WORKSPACE}'/configs/_local.py"
sh "python3 -m pytest ${cmd} --disable-warnings --alluredir=${env.WORKSPACE}/allure-results"
}}}
}
}
post {
always { script {
allure([
jdk: '',
properties: [],
results: [[path: 'allure-results']],
reportBuildPolicy: 'ALWAYS',
])
}}
cleanup { cleanWs() }
}
}