2020-08-07 21:51:37 +00:00
|
|
|
// https://stackoverflow.com/questions/40760716/jenkins-abort-running-build-if-new-one-is-started
|
2021-01-11 18:51:38 +00:00
|
|
|
// We should only abort older jobs in PR branches, so we have a nice CI history in "stable",
|
|
|
|
// "testing", and "unstable".
|
|
|
|
if (env.BRANCH_NAME != "stable" && env.BRANCH_NAME != "testing" && env.BRANCH_NAME != "unstable") {
|
2020-09-25 10:26:59 +00:00
|
|
|
def buildNumber = env.BUILD_NUMBER as int
|
|
|
|
if (buildNumber > 1) {
|
|
|
|
milestone(buildNumber - 1)
|
|
|
|
}
|
|
|
|
milestone(buildNumber)
|
2020-08-07 21:51:37 +00:00
|
|
|
}
|
|
|
|
|
2019-11-11 21:43:40 +00:00
|
|
|
def runStages() {
|
2019-12-03 14:02:38 +00:00
|
|
|
try {
|
|
|
|
stage("Clone") {
|
2020-08-07 21:51:37 +00:00
|
|
|
/* source code checkout */
|
2019-12-03 14:02:38 +00:00
|
|
|
checkout scm
|
2020-04-20 14:34:36 +00:00
|
|
|
/* we need to update the submodules before caching kicks in */
|
|
|
|
sh "git submodule update --init --recursive"
|
2019-12-03 14:02:38 +00:00
|
|
|
}
|
|
|
|
|
2019-12-03 17:57:05 +00:00
|
|
|
cache(maxCacheSize: 250, caches: [
|
|
|
|
[$class: "ArbitraryFileCache", excludes: "", includes: "**/*", path: "${WORKSPACE}/vendor/nimbus-build-system/vendor/Nim/bin"],
|
|
|
|
[$class: "ArbitraryFileCache", excludes: "", includes: "**/*", path: "${WORKSPACE}/jsonTestsCache"]
|
|
|
|
]) {
|
2019-12-03 14:02:38 +00:00
|
|
|
stage("Build") {
|
2020-05-20 22:02:05 +00:00
|
|
|
sh """#!/bin/bash
|
|
|
|
set -e
|
2021-02-11 19:03:29 +00:00
|
|
|
# to allow the following parallel stages
|
|
|
|
make -j${env.NPROC} QUICK_AND_DIRTY_COMPILER=1 deps
|
2021-10-12 11:36:52 +00:00
|
|
|
./scripts/setup_scenarios.sh jsonTestsCache
|
2020-05-20 22:02:05 +00:00
|
|
|
"""
|
2019-11-11 21:43:40 +00:00
|
|
|
}
|
2019-12-03 17:57:05 +00:00
|
|
|
}
|
2019-12-03 14:02:38 +00:00
|
|
|
|
2021-04-29 01:28:11 +00:00
|
|
|
stage("Tools") {
|
|
|
|
sh """#!/bin/bash
|
|
|
|
set -e
|
|
|
|
make -j${env.NPROC}
|
2021-11-02 17:06:36 +00:00
|
|
|
make -j${env.NPROC} LOG_LEVEL=TRACE
|
2021-04-29 01:28:11 +00:00
|
|
|
"""
|
|
|
|
}
|
|
|
|
|
|
|
|
stage("Test suite") {
|
|
|
|
sh "make -j${env.NPROC} DISABLE_TEST_FIXTURES_SCRIPT=1 test"
|
|
|
|
}
|
|
|
|
|
2021-07-26 19:55:24 +00:00
|
|
|
stage("REST test suite") {
|
2021-07-29 16:34:01 +00:00
|
|
|
sh """#!/bin/bash
|
|
|
|
set -e
|
|
|
|
./tests/simulation/restapi.sh --data-dir resttest0_data --base-port \$(( 9100 + EXECUTOR_NUMBER * 100 )) \
|
|
|
|
--base-rest-port \$(( 7100 + EXECUTOR_NUMBER * 100 )) --base-metrics-port \
|
|
|
|
\$(( 8108 + EXECUTOR_NUMBER * 100 )) --sleep-timeout 30 --kill-old-processes
|
|
|
|
"""
|
2021-07-26 19:55:24 +00:00
|
|
|
}
|
|
|
|
|
2021-04-29 01:28:11 +00:00
|
|
|
stage("Testnet finalization") {
|
|
|
|
// EXECUTOR_NUMBER will be 0 or 1, since we have 2 executors per Jenkins node
|
|
|
|
sh """#!/bin/bash
|
|
|
|
set -e
|
2021-08-13 14:12:40 +00:00
|
|
|
./scripts/launch_local_testnet.sh --preset minimal --nodes 4 --stop-at-epoch 5 --disable-htop --enable-logtrace \
|
2021-07-27 19:45:36 +00:00
|
|
|
--data-dir local_testnet0_data --base-port \$(( 9000 + EXECUTOR_NUMBER * 100 )) --base-rpc-port \
|
|
|
|
\$(( 7000 + EXECUTOR_NUMBER * 100 )) --base-metrics-port \$(( 8008 + EXECUTOR_NUMBER * 100 )) --timeout 600 \
|
|
|
|
--kill-old-processes \
|
|
|
|
-- --verify-finalization --discv5:no
|
2021-08-13 14:12:40 +00:00
|
|
|
./scripts/launch_local_testnet.sh --nodes 4 --stop-at-epoch 5 --disable-htop --enable-logtrace \
|
2021-07-27 19:45:36 +00:00
|
|
|
--data-dir local_testnet1_data --base-port \$(( 9000 + EXECUTOR_NUMBER * 100 )) --base-rpc-port \
|
|
|
|
\$(( 7000 + EXECUTOR_NUMBER * 100 )) --base-metrics-port \$(( 8008 + EXECUTOR_NUMBER * 100 )) --timeout 2400 \
|
|
|
|
--kill-old-processes \
|
|
|
|
-- --verify-finalization --discv5:no
|
2021-04-29 01:28:11 +00:00
|
|
|
"""
|
2019-12-03 14:02:38 +00:00
|
|
|
}
|
|
|
|
} catch(e) {
|
2019-12-03 17:57:05 +00:00
|
|
|
// we need to rethrow the exception here
|
2019-12-03 14:02:38 +00:00
|
|
|
throw e
|
|
|
|
} finally {
|
2020-06-10 22:13:25 +00:00
|
|
|
// archive testnet logs
|
2020-07-29 12:08:27 +00:00
|
|
|
sh """#!/bin/bash
|
2021-07-06 08:40:18 +00:00
|
|
|
for D in local_testnet0_data local_testnet1_data resttest0_data; do
|
2020-07-29 12:08:27 +00:00
|
|
|
[[ -d "\$D" ]] && tar cjf "\${D}-\${NODE_NAME}.tar.bz2" "\${D}"/*.txt || true
|
|
|
|
done
|
|
|
|
"""
|
2020-08-07 21:51:37 +00:00
|
|
|
try {
|
|
|
|
archiveArtifacts("*.tar.bz2")
|
|
|
|
} catch(e) {
|
|
|
|
println("Couldn't archive artefacts.")
|
|
|
|
println(e.toString());
|
|
|
|
// we don't need to re-raise it here; it might be a PR build being cancelled by a newer one
|
|
|
|
}
|
2020-06-10 22:13:25 +00:00
|
|
|
// clean the workspace
|
2020-04-19 11:17:02 +00:00
|
|
|
cleanWs(disableDeferredWipeout: true, deleteDirs: true)
|
2019-11-11 21:16:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-11 21:43:40 +00:00
|
|
|
parallel(
|
|
|
|
"Linux": {
|
2021-11-25 21:22:08 +00:00
|
|
|
throttle(['nimbus-eth2']) {
|
2022-01-13 02:05:38 +00:00
|
|
|
timeout(time: 4, unit: 'HOURS') {
|
2022-01-10 12:07:08 +00:00
|
|
|
node("linux") {
|
|
|
|
withEnv(["NPROC=${sh(returnStdout: true, script: 'nproc').trim()}"]) {
|
|
|
|
runStages()
|
|
|
|
}
|
2021-11-25 21:22:08 +00:00
|
|
|
}
|
2019-11-11 21:43:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"macOS": {
|
2021-11-25 21:22:08 +00:00
|
|
|
throttle(['nimbus-eth2']) {
|
2022-01-13 02:05:38 +00:00
|
|
|
timeout(time: 4, unit: 'HOURS') {
|
2022-01-10 12:07:08 +00:00
|
|
|
node("macos && x86_64") {
|
|
|
|
withEnv(["NPROC=${sh(returnStdout: true, script: 'sysctl -n hw.logicalcpu').trim()}"]) {
|
|
|
|
runStages()
|
|
|
|
}
|
2021-11-25 21:22:08 +00:00
|
|
|
}
|
2019-11-11 21:43:40 +00:00
|
|
|
}
|
|
|
|
}
|
2020-08-26 15:31:46 +00:00
|
|
|
},
|
2019-11-11 21:43:40 +00:00
|
|
|
)
|