status-desktop/test/e2e/ci/Jenkinsfile

161 lines
4.1 KiB
Plaintext
Raw Normal View History

#!/usr/bin/env groovy
library 'status-jenkins-lib@v1.7.13'
pipeline {
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}"
TESTRAIL_URL = "https://ethstatus.testrail.net"
}
parameters {
gitParameter(
branch: '',
branchFilter: 'origin/(.*)',
defaultValue: 'master',
description: 'Git branch to checkout.',
name: 'GIT_REF',
quickFilterEnabled: false,
selectedValue: 'DEFAULT',
sortMode: 'ASCENDING_SMART',
tagFilter: '*',
type: 'PT_BRANCH'
)
2023-10-13 11:22:50 +00:00
choice(
name: 'AGENT',
choices: [
'linux',
'linux-01',
'linux-02',
'linux-03',
'linux-04',
'linux-05',
],
2023-10-13 14:37:06 +00:00
description: 'Agent name to run tests on it.'
2023-10-13 11:22:50 +00:00
)
string(
2023-10-13 11:22:50 +00:00
name: 'BUILD_URL',
description: 'Link to tar.gz file.',
defaultValue: ''
)
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: ''
)
}
2023-10-13 11:22:50 +00:00
agent {
label "${params.AGENT} && x86_64 && qt-5.15.2"
}
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 {
2023-10-13 14:37:06 +00:00
stage('Download') {
steps {
script {
2023-10-13 11:22:50 +00:00
sh "mkdir -p './tmp/pkg/'"
if (params.BUILD_URL != "") {
fileOperations([
fileDownloadOperation(
url: params.BUILD_URL,
userName: "",
password: "",
targetLocation: "./tmp/pkg/",
targetFileName: "StatusIm-Desktop.tar.gz",
)
])
} else {
copyArtifacts(
projectName: "status-desktop/systems/linux/x86_64/package/",
filter: 'pkg/*-x86_64.tar.gz',
selector: lastWithArtifacts(),
target: "./tmp"
)
}
2023-10-13 14:37:06 +00:00
def pkg_path = "./${utils.findFile('tmp/pkg/*tar.gz')}"
sh "tar -zxvf '${pkg_path}' -C './tmp'"
env.APP_DIR = "./${utils.findFile('tmp/*.AppImage')}"
}
}
}
stage('Setup') {
steps { script {
sh 'pip3 install --user -r requirements.txt'
} }
}
stage('Test') {
2023-10-13 11:22:50 +00:00
steps {
2023-10-13 14:37:06 +00:00
wrap([
$class: 'Xvfb',
autoDisplayName: true,
parallelBuild: true,
screen: '1920x1080x24',
additionalOptions: '-dpi 1'
]){
2023-10-13 11:22:50 +00:00
script {
sh "fluxbox &"
def cmd = ''
if (params.TEST_NAME != "") {
cmd = cmd + " -k ${params.TEST_NAME}"
}
if (params.TEST_SCOPE != "") {
cmd = cmd + " -m ${params.TEST_SCOPE}"
}
dir ('configs') { sh 'ln -s _local.ci.py _local.py' }
2023-10-13 14:37:06 +00:00
withCredentials([
usernamePassword(
credentialsId: 'test-rail-api-devops',
usernameVariable: 'TESTRAIL_USR',
passwordVariable: 'TESTRAIL_PSW')
]) {
sh "python3 -m pytest ${cmd} --disable-warnings --alluredir=./allure-results"
2023-10-13 11:22:50 +00:00
}
}
}
2023-10-13 11:22:50 +00:00
}
}
}
post {
always { script {
allure([
jdk: '',
properties: [],
results: [[path: 'allure-results']],
reportBuildPolicy: 'ALWAYS',
])
}}
cleanup { cleanWs() }
}
}