Jenkinsfiles were merged (#164)

#163
This commit is contained in:
Vladimir Druzhinin 2023-10-13 13:22:50 +02:00 committed by GitHub
parent 6fce607b61
commit 243f8f5e20
4 changed files with 58 additions and 115 deletions

View File

@ -2,9 +2,6 @@
library 'status-jenkins-lib@v1.7.13' library 'status-jenkins-lib@v1.7.13'
pipeline { pipeline {
agent {
label 'linux && x86_64 && qt-5.15.2'
}
environment { environment {
QT_QPA_PLATFORMTHEME = "qt5ct" QT_QPA_PLATFORMTHEME = "qt5ct"
@ -15,14 +12,10 @@ pipeline {
PYTHONPATH = "${SQUISH_DIR}/lib:${SQUISH_DIR}/lib/python:${PYTHONPATH}" PYTHONPATH = "${SQUISH_DIR}/lib:${SQUISH_DIR}/lib/python:${PYTHONPATH}"
LD_LIBRARY_PATH = "${SQUISH_DIR}/lib:${SQUISH_DIR}/python3/lib:${LD_LIBRARY_PATH}" LD_LIBRARY_PATH = "${SQUISH_DIR}/lib:${SQUISH_DIR}/python3/lib:${LD_LIBRARY_PATH}"
TESTRAIL_CREDS = credentials('test-rail-api-devops')
TESTRAIL_URL = "https://ethstatus.testrail.net" TESTRAIL_URL = "https://ethstatus.testrail.net"
CI_CREDS = credentials('status-im-auto')
} }
parameters { parameters {
gitParameter( gitParameter(
branch: '', branch: '',
branchFilter: 'origin/(.*)', branchFilter: 'origin/(.*)',
@ -35,8 +28,20 @@ pipeline {
tagFilter: '*', tagFilter: '*',
type: 'PT_BRANCH' type: 'PT_BRANCH'
) )
choice(
name: 'AGENT',
choices: [
'linux',
'linux-01',
'linux-02',
'linux-03',
'linux-04',
'linux-05',
],
description: 'Agent name to run tests on it. '
)
string( string(
name: 'BUILD', name: 'BUILD_URL',
description: 'Link to tar.gz file.', description: 'Link to tar.gz file.',
defaultValue: '' defaultValue: ''
) )
@ -57,6 +62,10 @@ pipeline {
) )
} }
agent {
label "${params.AGENT} && x86_64 && qt-5.15.2"
}
options { options {
timestamps() timestamps()
/* Prevent Jenkins jobs from running forever */ /* Prevent Jenkins jobs from running forever */
@ -73,13 +82,27 @@ pipeline {
stage('Download') { stage('Download') {
steps { steps {
script { script {
sh "mkdir '${env.WORKSPACE}/tmp/'" sh "mkdir -p './tmp/pkg/'"
} if (params.BUILD_URL != "") {
fileOperations([ fileOperations([
fileDownloadOperation(url:"${params.BUILD}", userName:"${CI_CREDS_USR}", password:"${CI_CREDS_PSW}", targetLocation:"./tmp", targetFileName:"StatusIm-Desktop.tar.gz", proxyHost:"", proxyPort:"") fileDownloadOperation(
url: params.BUILD_URL,
userName: "",
password: "",
targetLocation: "./tmp/pkg/",
targetFileName: "StatusIm-Desktop.tar.gz",
)
]) ])
script { } else {
sh "tar -zxvf '${env.WORKSPACE}/tmp/StatusIm-Desktop.tar.gz' -C '${env.WORKSPACE}/tmp'" copyArtifacts(
projectName: "status-desktop/systems/linux/x86_64/package/",
filter: 'pkg/*-x86_64.tar.gz',
selector: lastWithArtifacts(),
target: "./tmp"
)
}
def pkg_path = "${env.WORKSPACE}/${utils.findFile('tmp/pkg/*tar.gz')}"
sh "tar -zxvf '${pkg_path}' -C '${env.WORKSPACE}/tmp'"
env.APP_DIR = "${env.WORKSPACE}/${utils.findFile('tmp/*.AppImage')}" env.APP_DIR = "${env.WORKSPACE}/${utils.findFile('tmp/*.AppImage')}"
} }
} }
@ -92,16 +115,10 @@ pipeline {
} }
stage('Test') { stage('Test') {
steps { wrap([ steps {
$class: 'Xvfb', wrap([$class: 'Xvfb', autoDisplayName: true, parallelBuild: true, screen: '1920x1080x24', additionalOptions: '-dpi 1']) {
autoDisplayName: true, script {
parallelBuild: true,
screen: '1920x1080x24',
additionalOptions: '-dpi 1'
]) { script {
sh "fluxbox &" sh "fluxbox &"
env.TESTRAIL_USR = "${TESTRAIL_CREDS_USR}"
env.TESTRAIL_PWD = "${TESTRAIL_CREDS_PSW}"
def cmd = '' def cmd = ''
if (params.TEST_NAME != "") { if (params.TEST_NAME != "") {
cmd = cmd + " -k ${params.TEST_NAME}" cmd = cmd + " -k ${params.TEST_NAME}"
@ -110,8 +127,12 @@ pipeline {
cmd = cmd + " -m ${params.TEST_SCOPE}" cmd = cmd + " -m ${params.TEST_SCOPE}"
} }
sh "cp -f '${env.WORKSPACE}'/configs/_local.py.ci '${env.WORKSPACE}'/configs/_local.py" sh "cp -f '${env.WORKSPACE}'/configs/_local.py.ci '${env.WORKSPACE}'/configs/_local.py"
withCredentials([usernamePassword(credentialsId: 'test-rail-api-devops', usernameVariable: 'TESTRAIL_USR', passwordVariable: 'TESTRAIL_PSW')]) {
sh "python3 -m pytest ${cmd} --disable-warnings --alluredir=${env.WORKSPACE}/allure-results" sh "python3 -m pytest ${cmd} --disable-warnings --alluredir=${env.WORKSPACE}/allure-results"
}}} }
}
}
}
} }
} }
post { post {

View File

@ -1,78 +0,0 @@
#!/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}"
}
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/systems/linux/x86_64/package/",
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',
additionalOptions: '-dpi 1'
]) { script {
sh "fluxbox &"
sh "cp -f '${env.WORKSPACE}'/configs/_local.py.ci '${env.WORKSPACE}'/configs/_local.py"
sh "python3 -m pytest --disable-warnings --alluredir=${env.WORKSPACE}/allure-results"
}}}
}
}
post {
always { script {
allure([
jdk: '',
properties: [],
results: [[path: 'allure-results']],
reportBuildPolicy: 'ALWAYS',
])
}}
cleanup { cleanWs() }
}
}

View File

@ -3,4 +3,4 @@ import os
TESTRAIL_RUN_ID = os.getenv('TESTRAIL_RUN_ID', '').strip() TESTRAIL_RUN_ID = os.getenv('TESTRAIL_RUN_ID', '').strip()
TESTRAIL_URL = os.getenv('TESTRAIL_URL', None) TESTRAIL_URL = os.getenv('TESTRAIL_URL', None)
TESTRAIL_USR = os.getenv('TESTRAIL_USR', None) TESTRAIL_USR = os.getenv('TESTRAIL_USR', None)
TESTRAIL_PWD = os.getenv('TESTRAIL_PWD', None) TESTRAIL_PSW = os.getenv('TESTRAIL_PSW', None)

View File

@ -23,7 +23,7 @@ def init_testrail_api(request):
testrail_api = TestRailAPI( testrail_api = TestRailAPI(
configs.testrail.TESTRAIL_URL, configs.testrail.TESTRAIL_URL,
configs.testrail.TESTRAIL_USR, configs.testrail.TESTRAIL_USR,
configs.testrail.TESTRAIL_PWD configs.testrail.TESTRAIL_PSW
) )
test_case_ids = get_test_ids_in_session(request) test_case_ids = get_test_ids_in_session(request)
for test_case_id in test_case_ids: for test_case_id in test_case_ids: