status-desktop/ci/Jenkinsfile.e2e

182 lines
5.1 KiB
Plaintext

library 'status-jenkins-lib@v1.6.1'
/* Options section can't access functions in objects. */
def isPRBuild = utils.isPRBuild()
pipeline {
agent { label 'linux' }
parameters {
booleanParam(
name: 'RELEASE',
description: 'Decides whether binaries are built with debug symbols.',
defaultValue: params.RELEASE ?: false
)
choice(
name: 'VERBOSE',
description: 'Level of verbosity based on nimbus-build-system setup.',
choices: ['0', '1', '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',
))
/* Throttle number of concurrent builds. */
throttleJobProperty(
throttleEnabled: true,
throttleOption: 'category',
maxConcurrentPerNode: 1,
maxConcurrentTotal: 1
)
/* Abort old PR builds. */
disableConcurrentBuilds(
abortPrevious: isPRBuild
)
}
environment {
TARGET = 'e2e'
/* Improve make performance */
MAKEFLAGS = "-j4 V=${params.VERBOSE}"
/* Disable colors in Nim compiler logs */
NIMFLAGS = '--colors:off'
/* Makefile assumes the compiler folder is included */
QTDIR = '/opt/qt/5.14.2/gcc_64'
/* Include library in order to compile the project */
LD_LIBRARY_PATH = "$QTDIR/lib:$WORKSPACE/vendor/status-go/build/bin:$WORKSPACE/vendor/status-keycard-go/build/libkeycard/"
/* Container ports */
RPC_PORT = "${8545 + env.EXECUTOR_NUMBER.toInteger()}"
P2P_PORT = "${6010 + env.EXECUTOR_NUMBER.toInteger()}"
/* Ganache config */
GANACHE_RPC_PORT = "${9545 + env.EXECUTOR_NUMBER.toInteger()}"
GANACHE_MNEMONIC = 'pelican chief sudden oval media rare swamp elephant lawsuit wheat knife initial'
}
stages {
stage('Deps') {
steps {
sh 'make update'
sh 'make deps'
}
}
stage('status-go') {
steps {
sh 'make status-go'
}
}
stage('build') {
environment {
GANACHE_NETWORK_RPC_URL = "http://localhost:${env.GANACHE_RPC_PORT}"
}
steps {
sh 'make'
}
}
stage('Containers') {
parallel {
stage('Ganache') { steps { script {
ganache = docker.image(
'trufflesuite/ganache:v7.4.1'
).run(
["-p 127.0.0.1:${env.GANACHE_RPC_PORT}:8545",
"-v ${env.WORKSPACE}/test/ui-test/fixtures/ganache-dbs/goerli:/goerli-db"].join(' '),
["-m='${GANACHE_MNEMONIC}'", "-e=10",
'--chain.chainId=5',
'--database.dbPath=/goerli-db'].join(' ')
)
} } }
stage('Nim-Waku') { steps { script {
nimwaku = docker.image(
'statusteam/nim-waku:v0.13.0'
).run(
["-p 127.0.0.1:${env.RPC_PORT}:8545",
"-p 127.0.0.1:${env.P2P_PORT}:30303/tcp",
"-p 127.0.0.1:${env.P2P_PORT}:30303/udp",
"-v ${env.WORKSPACE}/ci/mailserver/config.json:/config.json"].join(' '),
['--store=true',
'--keep-alive=true',
'--rpc-address=0.0.0.0',
'--nat=none'].join(' ')
)
env.TEST_PEER_ENR = getPeerAddress()
} } }
}
}
stage('Tests') {
options {
throttle(categories: ['status-desktop-e2e-tests'])
}
steps { script {
wrap([
$class: 'Xvfb',
autoDisplayName: true,
parallelBuild: true,
screen: '2560x1440x24',
]) { script {
def result = squish([
extraOptions: [
'--retry', '2',
'--tags', '~mayfail',
'--tags', '~merge',
'--tags', '~relyon-mailserver',
'--config', 'addAUT', 'nim_status_client',
"${WORKSPACE}/bin",
].join('\n'),
squishPackageName: 'squish-6.7.2-qt514x-linux64',
testSuite: "${WORKSPACE}/test/ui-test/testSuites/*",
])
print("Squish run result: ${result}")
if (!['SUCCESS', 'UNSTABLE'].contains(result)) {
throw new Exception('Squish run failed!')
}
} }
} }
post {
failure { script {
sh("docker logs ${nimwaku.id}")
sh("docker logs ${ganache.id}")
} }
}
}
}
post {
success { script {
github.notifyPR(true)
} }
failure { script {
github.notifyPR(false)
} }
always { script { /* No artifact but a PKG_URL is necessary. */
env.PKG_URL = "${currentBuild.absoluteUrl}/consoleText"
} }
cleanup { script {
sh './scripts/clean-git.sh'
if (binding.hasVariable('ganache')) { ganache.stop() }
if (binding.hasVariable('nimwaku')) { nimwaku.stop() }
} }
}
}
def getPeerAddress() {
def rpcResp = sh(
script: "${env.WORKSPACE}/scripts/rpc.sh get_waku_v2_debug_v1_info",
returnStdout: true
).trim()
assert rpcResp : 'Could not get node address from RPC API!'
return readJSON(text: rpcResp)['result']['listenAddresses'][0]
}