2023-09-28 12:44:13 +00:00
|
|
|
#!/usr/bin/env groovy
|
2023-10-20 12:26:52 +00:00
|
|
|
library 'status-jenkins-lib@v1.8.0'
|
2023-09-28 12:44:13 +00:00
|
|
|
|
|
|
|
pipeline {
|
|
|
|
|
2023-10-19 16:49:52 +00:00
|
|
|
agent {
|
|
|
|
label "${params.AGENT} && x86_64 && qt-5.15.2"
|
2023-09-28 12:44:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
parameters {
|
2023-10-09 09:38:48 +00:00
|
|
|
gitParameter(
|
2023-10-19 18:12:14 +00:00
|
|
|
name: 'GIT_REF',
|
|
|
|
description: 'Git branch to checkout.',
|
2023-10-09 09:38:48 +00:00
|
|
|
branchFilter: 'origin/(.*)',
|
2023-10-19 18:12:14 +00:00
|
|
|
branch: '',
|
2023-10-09 09:38:48 +00:00
|
|
|
defaultValue: 'master',
|
|
|
|
quickFilterEnabled: false,
|
|
|
|
selectedValue: 'DEFAULT',
|
|
|
|
sortMode: 'ASCENDING_SMART',
|
|
|
|
tagFilter: '*',
|
|
|
|
type: 'PT_BRANCH'
|
|
|
|
)
|
2023-09-28 12:44:13 +00:00
|
|
|
string(
|
2023-10-19 18:12:14 +00:00
|
|
|
name: 'BUILD_SOURCE',
|
|
|
|
description: 'URL to tar.gz file OR path to Jenkins build.',
|
2023-10-10 08:30:56 +00:00
|
|
|
defaultValue: ''
|
2023-09-28 12:44:13 +00:00
|
|
|
)
|
|
|
|
string(
|
|
|
|
name: 'TEST_NAME',
|
2023-10-09 09:38:48 +00:00
|
|
|
description: 'Paste test name/part of test name to run specific test.',
|
2023-09-28 12:44:13 +00:00
|
|
|
defaultValue: ''
|
|
|
|
)
|
|
|
|
string(
|
|
|
|
name: 'TEST_SCOPE',
|
2023-10-09 09:38:48 +00:00
|
|
|
description: 'Paste tag to run specific scope of tests.',
|
2023-09-28 12:44:13 +00:00
|
|
|
defaultValue: ''
|
|
|
|
)
|
|
|
|
string(
|
|
|
|
name: 'TESTRAIL_RUN_ID',
|
2023-10-09 09:38:48 +00:00
|
|
|
description: 'Test run ID in Test Rail.',
|
2023-09-28 12:44:13 +00:00
|
|
|
defaultValue: ''
|
|
|
|
)
|
2023-10-19 16:49:52 +00:00
|
|
|
/* FIXME: This is temporary and should be removed. */
|
|
|
|
choice(
|
|
|
|
name: 'AGENT',
|
|
|
|
description: 'Agent name to run tests on it.',
|
|
|
|
choices: ['linux', 'linux-01', 'linux-02', 'linux-03', 'linux-04', 'linux-05']
|
|
|
|
)
|
2023-10-13 11:22:50 +00:00
|
|
|
}
|
|
|
|
|
2023-09-28 12:44:13 +00:00
|
|
|
options {
|
|
|
|
timestamps()
|
|
|
|
/* Prevent Jenkins jobs from running forever */
|
|
|
|
timeout(time: 120, unit: 'MINUTES')
|
|
|
|
/* manage how many builds we keep */
|
|
|
|
buildDiscarder(logRotator(
|
2023-10-24 16:09:32 +00:00
|
|
|
daysToKeepStr: '60',
|
|
|
|
numToKeepStr: '50',
|
|
|
|
artifactNumToKeepStr: '50',
|
2023-09-28 12:44:13 +00:00
|
|
|
))
|
|
|
|
}
|
|
|
|
|
2023-10-19 16:49:52 +00:00
|
|
|
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'
|
|
|
|
}
|
|
|
|
|
2023-09-28 12:44:13 +00:00
|
|
|
stages {
|
2023-10-24 12:45:32 +00:00
|
|
|
stage('Prep') {
|
2023-10-19 18:12:14 +00:00
|
|
|
steps { script {
|
2023-10-20 12:26:52 +00:00
|
|
|
currentBuild.displayName = getNewBuildName()
|
2023-10-24 12:45:32 +00:00
|
|
|
updateGitHubStatus()
|
|
|
|
} }
|
|
|
|
}
|
|
|
|
|
|
|
|
stage('Deps') {
|
|
|
|
steps { script {
|
2023-10-19 18:12:14 +00:00
|
|
|
sh 'pip3 install --user -r requirements.txt'
|
|
|
|
} }
|
|
|
|
}
|
|
|
|
|
2023-10-13 14:37:06 +00:00
|
|
|
stage('Download') {
|
2023-10-19 18:12:14 +00:00
|
|
|
when { expression { params.BUILD_SOURCE.startsWith('http') } }
|
2023-10-24 16:08:35 +00:00
|
|
|
steps { timeout(5) { script {
|
2023-10-19 18:12:14 +00:00
|
|
|
sh 'mkdir -p ./tmp/pkg/'
|
|
|
|
fileOperations([
|
|
|
|
fileDownloadOperation(
|
|
|
|
url: params.BUILD_SOURCE,
|
|
|
|
targetFileName: 'StatusIm-Desktop.tar.gz',
|
|
|
|
targetLocation: './tmp/pkg/',
|
|
|
|
userName: '',
|
|
|
|
password: '',
|
|
|
|
)
|
|
|
|
])
|
2023-10-24 16:08:35 +00:00
|
|
|
} } }
|
2023-09-28 12:44:13 +00:00
|
|
|
}
|
|
|
|
|
2023-10-19 18:12:14 +00:00
|
|
|
stage('Copy') {
|
|
|
|
when { expression { ! params.BUILD_SOURCE.startsWith('http') } }
|
2023-10-24 16:08:35 +00:00
|
|
|
steps { timeout(5) { script {
|
2023-10-19 18:12:14 +00:00
|
|
|
copyArtifacts(
|
|
|
|
projectName: params.BUILD_SOURCE,
|
|
|
|
filter: 'pkg/*-x86_64.tar.gz',
|
|
|
|
selector: lastWithArtifacts(),
|
|
|
|
target: './tmp'
|
|
|
|
)
|
2023-10-24 16:08:35 +00:00
|
|
|
} } }
|
2023-10-19 18:12:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
stage('Unpack') {
|
2023-10-24 16:50:59 +00:00
|
|
|
steps { timeout(5) { script {
|
2023-10-19 18:12:14 +00:00
|
|
|
sh "tar -zxvf '${utils.findFile('tmp/pkg/*tar.gz')}' -C './tmp'"
|
|
|
|
env.APP_DIR = utils.findFile('tmp/*.AppImage')
|
2023-10-24 16:08:35 +00:00
|
|
|
} } }
|
2023-09-28 12:44:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
stage('Test') {
|
2023-10-24 16:08:35 +00:00
|
|
|
steps { timeout(90) { script {
|
2023-10-19 16:49:52 +00:00
|
|
|
def flags = []
|
|
|
|
if (params.TEST_NAME) { flags.add("-k=${params.TEST_NAME}") }
|
|
|
|
if (params.TEST_SCOPE) { flags.add("-m=${params.TEST_SCOPE}") }
|
|
|
|
dir ('configs') { sh 'ln -s _local.ci.py _local.py' }
|
2023-10-13 14:37:06 +00:00
|
|
|
wrap([
|
|
|
|
$class: 'Xvfb',
|
|
|
|
autoDisplayName: true,
|
|
|
|
parallelBuild: true,
|
|
|
|
screen: '1920x1080x24',
|
|
|
|
additionalOptions: '-dpi 1'
|
2023-10-19 18:12:14 +00:00
|
|
|
]) {
|
2023-10-19 16:49:52 +00:00
|
|
|
sh 'fluxbox &'
|
|
|
|
withCredentials([
|
|
|
|
usernamePassword(
|
|
|
|
credentialsId: 'test-rail-api-devops',
|
|
|
|
usernameVariable: 'TESTRAIL_USR',
|
|
|
|
passwordVariable: 'TESTRAIL_PSW'
|
|
|
|
)
|
|
|
|
]) {
|
|
|
|
sh """
|
|
|
|
python3 -m pytest ${flags.join(" ")} \
|
|
|
|
--disable-warnings \
|
|
|
|
--alluredir=./allure-results
|
|
|
|
"""
|
2023-10-13 11:22:50 +00:00
|
|
|
}
|
2023-09-28 12:44:13 +00:00
|
|
|
}
|
2023-10-24 16:08:35 +00:00
|
|
|
} } }
|
2023-09-28 12:44:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
post {
|
|
|
|
always { script {
|
|
|
|
allure([
|
|
|
|
results: [[path: 'allure-results']],
|
|
|
|
reportBuildPolicy: 'ALWAYS',
|
2023-10-19 18:12:14 +00:00
|
|
|
properties: [],
|
|
|
|
jdk: '',
|
2023-09-28 12:44:13 +00:00
|
|
|
])
|
2023-10-24 12:45:32 +00:00
|
|
|
updateGitHubStatus()
|
2023-10-19 18:12:14 +00:00
|
|
|
} }
|
2023-09-28 12:44:13 +00:00
|
|
|
cleanup { cleanWs() }
|
|
|
|
}
|
|
|
|
}
|
2023-10-20 12:26:52 +00:00
|
|
|
|
|
|
|
def getNewBuildName() {
|
|
|
|
/* For URLs we need to parse the filename to get attributes. */
|
|
|
|
if (params.BUILD_SOURCE.startsWith('http')) {
|
|
|
|
def tokens = utils.parseFilename(utils.baseName(params.BUILD_SOURCE))
|
|
|
|
return [
|
|
|
|
(tokens.tstamp ?: tokens.version), tokens.commit, tokens.build
|
|
|
|
].grep().join('-')
|
|
|
|
} else {
|
|
|
|
return utils.baseName(params.BUILD_SOURCE)
|
|
|
|
}
|
|
|
|
}
|
2023-10-24 12:45:32 +00:00
|
|
|
|
|
|
|
def updateGitHubStatus() {
|
|
|
|
/* For PR builds update check status. */
|
|
|
|
if (params.BUILD_SOURCE ==~ /.*\/PR-[0-9]+\/?$/) {
|
|
|
|
github.statusUpdate(
|
|
|
|
context: 'jenkins/prs/tests/e2e-new',
|
|
|
|
commit: jenkins.getJobCommitByPath(params.BUILD_SOURCE),
|
|
|
|
repo_url: 'https://github.com/status-im/status-desktop'
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|