From 4e22a69423177cb939a020d0b6ecb899b14f5c03 Mon Sep 17 00:00:00 2001 From: Vladimir Druzhinin <128374224+StateOf-Vlado@users.noreply.github.com> Date: Tue, 10 Oct 2023 10:30:56 +0200 Subject: [PATCH] Ci/144 jenkins file (#158) * Jenkins file for nightly regression added * Downloading build by URL added #144 --- test/e2e/ci/Jenkinsfile | 36 ++++++++------- test/e2e/ci/Jenkinsfile_nightly | 78 +++++++++++++++++++++++++++++++++ 2 files changed, 97 insertions(+), 17 deletions(-) create mode 100644 test/e2e/ci/Jenkinsfile_nightly diff --git a/test/e2e/ci/Jenkinsfile b/test/e2e/ci/Jenkinsfile index f8f4fad6af..d9fce6db96 100644 --- a/test/e2e/ci/Jenkinsfile +++ b/test/e2e/ci/Jenkinsfile @@ -15,8 +15,10 @@ pipeline { 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_CREDS = credentials('test-rail-api-devops') TESTRAIL_URL = "https://ethstatus.testrail.net" + + CI_CREDS = credentials('status-im-auto') } parameters { @@ -35,8 +37,8 @@ pipeline { ) string( name: 'BUILD', - description: 'Paste a number of PR that you want to test.', - defaultValue: 'PR-' + description: 'Link to tar.gz file.', + defaultValue: '' ) string( name: 'TEST_NAME', @@ -68,19 +70,19 @@ pipeline { } 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')}" - } } + steps { + script { + sh "mkdir '${env.WORKSPACE}/tmp/'" + } + fileOperations([ + fileDownloadOperation(url:"${params.BUILD}", userName:"${CI_CREDS_USR}", password:"${CI_CREDS_PSW}", targetLocation:"./tmp", targetFileName:"StatusIm-Desktop.tar.gz", proxyHost:"", proxyPort:"") + ]) + script { + sh "tar -zxvf '${env.WORKSPACE}/tmp/StatusIm-Desktop.tar.gz' -C '${env.WORKSPACE}/tmp'" + env.APP_DIR = "${env.WORKSPACE}/${utils.findFile('tmp/*.AppImage')}" + } + } } stage('Setup') { @@ -98,8 +100,8 @@ pipeline { additionalOptions: '-dpi 1' ]) { script { sh "fluxbox &" - env.TESTRAIL_USR = "${CREDS_USR}" - env.TESTRAIL_PWD = "${CREDS_PSW}" + env.TESTRAIL_USR = "${TESTRAIL_CREDS_USR}" + env.TESTRAIL_PWD = "${TESTRAIL_CREDS_PSW}" def cmd = '' if (params.TEST_NAME != "") { cmd = cmd + " -k ${params.TEST_NAME}" diff --git a/test/e2e/ci/Jenkinsfile_nightly b/test/e2e/ci/Jenkinsfile_nightly new file mode 100644 index 0000000000..aeb71d8e33 --- /dev/null +++ b/test/e2e/ci/Jenkinsfile_nightly @@ -0,0 +1,78 @@ +#!/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() } + } +}