Jenkins: macOS ARM64 CI job (#3128)

This commit is contained in:
Ștefan Talpalaru 2022-02-04 14:43:40 +01:00 committed by GitHub
parent 6f10e651ff
commit 70579f2fb1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 86 additions and 72 deletions

158
Jenkinsfile vendored
View File

@ -9,86 +9,89 @@ if (env.BRANCH_NAME != "stable" && env.BRANCH_NAME != "testing" && env.BRANCH_NA
milestone(buildNumber) milestone(buildNumber)
} }
def runStages() { def runStages(nodeDir) {
try { sh "mkdir -p ${nodeDir}"
stage("Clone") { dir(nodeDir) {
/* source code checkout */ try {
checkout scm stage("Clone") {
/* we need to update the submodules before caching kicks in */ /* source code checkout */
sh "git submodule update --init --recursive" checkout scm
} /* we need to update the submodules before caching kicks in */
sh "git submodule update --init --recursive"
}
cache(maxCacheSize: 250, caches: [ cache(maxCacheSize: 250, caches: [
[$class: "ArbitraryFileCache", excludes: "", includes: "**/*", path: "${WORKSPACE}/vendor/nimbus-build-system/vendor/Nim/bin"], [$class: "ArbitraryFileCache", excludes: "", includes: "**/*", path: "${WORKSPACE}/${nodeDir}/vendor/nimbus-build-system/vendor/Nim/bin"],
[$class: "ArbitraryFileCache", excludes: "", includes: "**/*", path: "${WORKSPACE}/jsonTestsCache"] [$class: "ArbitraryFileCache", excludes: "", includes: "**/*", path: "${WORKSPACE}/${nodeDir}/jsonTestsCache"]
]) { ]) {
stage("Build") { stage("Build") {
sh """#!/bin/bash
set -e
# to allow the following parallel stages
make -j${env.NPROC} QUICK_AND_DIRTY_COMPILER=1 deps
./scripts/setup_scenarios.sh jsonTestsCache
"""
}
}
stage("Tools") {
sh """#!/bin/bash sh """#!/bin/bash
set -e set -e
# to allow the following parallel stages make -j${env.NPROC}
make -j${env.NPROC} QUICK_AND_DIRTY_COMPILER=1 deps make -j${env.NPROC} LOG_LEVEL=TRACE
./scripts/setup_scenarios.sh jsonTestsCache
""" """
} }
}
stage("Tools") { stage("Test suite") {
sh """#!/bin/bash sh "make -j${env.NPROC} DISABLE_TEST_FIXTURES_SCRIPT=1 test"
set -e }
make -j${env.NPROC}
make -j${env.NPROC} LOG_LEVEL=TRACE
"""
}
stage("Test suite") { stage("REST test suite") {
sh "make -j${env.NPROC} DISABLE_TEST_FIXTURES_SCRIPT=1 test" sh """#!/bin/bash
} set -e
./tests/simulation/restapi.sh --data-dir resttest0_data --base-port \$(( 9100 + EXECUTOR_NUMBER * 100 )) \
stage("REST test suite") { --base-rest-port \$(( 7100 + EXECUTOR_NUMBER * 100 )) --base-metrics-port \
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 )) --resttest-delay 30 --kill-old-processes \$(( 8108 + EXECUTOR_NUMBER * 100 )) --resttest-delay 30 --kill-old-processes
""" """
} }
stage("Testnet finalization") { stage("Testnet finalization") {
// EXECUTOR_NUMBER will be 0 or 1, since we have 2 executors per Jenkins node // EXECUTOR_NUMBER will be 0 or 1, since we have 2 executors per Jenkins node
sh """#!/bin/bash sh """#!/bin/bash
set -e set -e
./scripts/launch_local_testnet.sh --preset minimal --nodes 4 --stop-at-epoch 5 --disable-htop --enable-logtrace \ ./scripts/launch_local_testnet.sh --preset minimal --nodes 4 --stop-at-epoch 5 --disable-htop --enable-logtrace \
--data-dir local_testnet0_data --base-port \$(( 9000 + EXECUTOR_NUMBER * 100 )) --base-rpc-port \ --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 \ \$(( 7000 + EXECUTOR_NUMBER * 100 )) --base-metrics-port \$(( 8008 + EXECUTOR_NUMBER * 100 )) --timeout 600 \
--kill-old-processes \ --kill-old-processes \
-- --verify-finalization --discv5:no -- --verify-finalization --discv5:no
./scripts/launch_local_testnet.sh --nodes 4 --stop-at-epoch 5 --disable-htop --enable-logtrace \ ./scripts/launch_local_testnet.sh --nodes 4 --stop-at-epoch 5 --disable-htop --enable-logtrace \
--data-dir local_testnet1_data --base-port \$(( 9000 + EXECUTOR_NUMBER * 100 )) --base-rpc-port \ --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 \ \$(( 7000 + EXECUTOR_NUMBER * 100 )) --base-metrics-port \$(( 8008 + EXECUTOR_NUMBER * 100 )) --timeout 2400 \
--kill-old-processes \ --kill-old-processes \
-- --verify-finalization --discv5:no -- --verify-finalization --discv5:no
""" """
} }
} catch(e) {
// we need to rethrow the exception here
throw e
} finally {
// archive testnet logs
sh """#!/bin/bash
for D in local_testnet0_data local_testnet1_data resttest0_data; do
[[ -d "\$D" ]] && tar cjf "\${D}-\${NODE_NAME}.tar.bz2" "\${D}"/*.txt || true
done
"""
try {
archiveArtifacts("*.tar.bz2")
} catch(e) { } catch(e) {
println("Couldn't archive artefacts.") // we need to rethrow the exception here
println(e.toString()); throw e
// we don't need to re-raise it here; it might be a PR build being cancelled by a newer one } finally {
// archive testnet logs
sh """#!/bin/bash
for D in local_testnet0_data local_testnet1_data resttest0_data; do
[[ -d "\$D" ]] && tar cjf "\${D}-\${NODE_NAME}.tar.bz2" "\${D}"/*.txt || true
done
"""
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
}
// clean the workspace
cleanWs(disableDeferredWipeout: true, deleteDirs: true)
} }
// clean the workspace } // dir(...)
cleanWs(disableDeferredWipeout: true, deleteDirs: true)
}
} }
parallel( parallel(
@ -97,18 +100,29 @@ parallel(
timeout(time: 4, unit: 'HOURS') { timeout(time: 4, unit: 'HOURS') {
node("linux") { node("linux") {
withEnv(["NPROC=${sh(returnStdout: true, script: 'nproc').trim()}"]) { withEnv(["NPROC=${sh(returnStdout: true, script: 'nproc').trim()}"]) {
runStages() runStages("linux")
} }
} }
} }
} }
}, },
"macOS": { "macOS (AMD64)": {
throttle(['nimbus-eth2']) { throttle(['nimbus-eth2']) {
timeout(time: 4, unit: 'HOURS') { timeout(time: 4, unit: 'HOURS') {
node("macos && x86_64") { node("macos && x86_64") {
withEnv(["NPROC=${sh(returnStdout: true, script: 'sysctl -n hw.logicalcpu').trim()}"]) { withEnv(["NPROC=${sh(returnStdout: true, script: 'sysctl -n hw.logicalcpu').trim()}"]) {
runStages() runStages("macos_amd64")
}
}
}
}
},
"macOS (ARM64)": {
throttle(['nimbus-eth2']) {
timeout(time: 4, unit: 'HOURS') {
node("macos && arm64") {
withEnv(["NPROC=${sh(returnStdout: true, script: 'sysctl -n hw.logicalcpu').trim()}"]) {
runStages("macos_arm64")
} }
} }
} }