nomos-node/ci/Jenkinsfile.nightly.integra...

85 lines
1.9 KiB
Plaintext

pipeline {
agent {
dockerfile {
label 'linux'
dir 'ci'
}
}
parameters {
string(
name: 'ITERATIONS',
description: 'Number of repeated integration test runs',
defaultValue: params.ITERATIONS ?: '1000'
)
}
environment {
/* Avoid cache poisoning by other jobs. */
GOCACHE = "${env.WORKSPACE_TMP}/go-build"
GOPATH = "${env.WORKSPACE_TMP}/go"
RUST_BACKTRACE = 1
}
options {
disableConcurrentBuilds()
buildDiscarder(logRotator(
numToKeepStr: '20',
daysToKeepStr: '30',
))
}
stages {
stage('Build') {
steps {
/* Node binary is required for integration tests */
sh 'cargo build'
}
}
stage('Integration tests') {
steps {
script {
int iterations = params.ITERATIONS.toInteger()
for (int i = 0; i < iterations; i++) {
echo "Running iteration ${i + 1} of ${iterations}"
if (sh(script: 'cargo test ten_nodes_happy', returnStatus: true) != 0) {
error("Test failed on iteration ${i + 1}")
break
}
if (sh(script: 'cargo test two_nodes_happy', returnStatus: true) != 0) {
error("Test failed on iteration ${i + 1}")
break
}
if (sh(script: 'cargo test ten_nodes_one_down', returnStatus: true) != 0) {
error("Test failed on iteration ${i + 1}")
break
}
}
}
}
}
}
post {
failure {
script {
def discord = load "${WORKSPACE}/ci/discord.groovy"
discord.sendMessage(header: 'Nightly Integration Tests Failed')
}
}
success {
script {
def discord = load "${WORKSPACE}/ci/discord.groovy"
discord.sendMessage(header: 'Nightly Integration Tests Passed')
}
}
cleanup { cleanWs() }
}
}