2023-05-14 21:32:45 +00:00
|
|
|
/* beacon_chain
|
2024-03-28 20:37:21 +00:00
|
|
|
* Copyright (c) 2019-2024 Status Research & Development GmbH
|
2023-05-14 21:32:45 +00:00
|
|
|
* Licensed and distributed under either of
|
|
|
|
* * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
|
|
|
* * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
|
|
|
* at your option. This file may not be copied, modified, or distributed except according to those terms.
|
|
|
|
*/
|
|
|
|
|
2022-07-21 22:34:31 +00:00
|
|
|
pipeline {
|
|
|
|
/* This way we run the same Jenkinsfile on different platforms. */
|
|
|
|
agent { label params.AGENT_LABEL }
|
|
|
|
|
|
|
|
parameters {
|
|
|
|
string(
|
|
|
|
name: 'AGENT_LABEL',
|
|
|
|
description: 'Label for targetted CI slave host: linux/macos',
|
|
|
|
defaultValue: params.AGENT_LABEL ?: getAgentLabel(),
|
|
|
|
)
|
2023-02-27 16:00:27 +00:00
|
|
|
choice(
|
|
|
|
name: 'VERBOSITY',
|
|
|
|
description: 'Value for the V make flag to increase log verbosity',
|
|
|
|
choices: [0, 1, 2]
|
|
|
|
)
|
2024-04-03 10:47:32 +00:00
|
|
|
string(
|
|
|
|
name: 'NIM_COMMIT',
|
|
|
|
description: 'Value for the NIM_COMMIT make flag to choose Nim commit',
|
|
|
|
defaultValue: nimCommitForJob(),
|
|
|
|
)
|
2022-07-21 22:34:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
options {
|
|
|
|
timestamps()
|
2022-07-23 14:28:10 +00:00
|
|
|
ansiColor('xterm')
|
2022-07-21 22:34:31 +00:00
|
|
|
/* This also includes wait time in the queue. */
|
|
|
|
timeout(time: 24, unit: 'HOURS')
|
|
|
|
/* Limit builds retained. */
|
|
|
|
buildDiscarder(logRotator(
|
|
|
|
numToKeepStr: '5',
|
|
|
|
daysToKeepStr: '30',
|
|
|
|
artifactNumToKeepStr: '3',
|
|
|
|
))
|
|
|
|
/* Throttle number of concurrent builds. */
|
|
|
|
throttleJobProperty(
|
|
|
|
throttleEnabled: true,
|
2022-07-25 14:24:02 +00:00
|
|
|
throttleOption: 'category',
|
|
|
|
categories: ['nimbus-eth2'],
|
|
|
|
maxConcurrentPerNode: 1,
|
2023-07-07 09:50:40 +00:00
|
|
|
maxConcurrentTotal: 9
|
2022-07-21 22:34:31 +00:00
|
|
|
)
|
|
|
|
/* Abort old builds for non-main branches. */
|
|
|
|
disableConcurrentBuilds(
|
|
|
|
abortPrevious: !isMainBranch()
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
environment {
|
|
|
|
NPROC = Runtime.getRuntime().availableProcessors()
|
2024-04-03 10:47:32 +00:00
|
|
|
MAKEFLAGS = "V=${params.VERBOSITY} NIM_COMMIT=${params.NIM_COMMIT} -j${env.NPROC}"
|
2022-07-21 22:34:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
stages {
|
|
|
|
stage('Deps') {
|
|
|
|
steps { timeout(20) {
|
|
|
|
/* To allow the following parallel stages. */
|
|
|
|
sh 'make QUICK_AND_DIRTY_COMPILER=1 update'
|
|
|
|
/* Allow the following parallel stages. */
|
|
|
|
sh 'make deps'
|
|
|
|
/* Download test vectors. */
|
|
|
|
sh './scripts/setup_scenarios.sh'
|
|
|
|
} }
|
|
|
|
}
|
|
|
|
|
|
|
|
stage('Build') {
|
2023-08-07 19:42:28 +00:00
|
|
|
steps { timeout(50) {
|
2022-07-21 22:34:31 +00:00
|
|
|
sh 'make LOG_LEVEL=TRACE'
|
|
|
|
} }
|
|
|
|
}
|
|
|
|
|
2024-03-28 09:01:15 +00:00
|
|
|
stage('Check Docs') {
|
|
|
|
steps {
|
|
|
|
sh './scripts/check_docs_help_msg.sh'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-07-21 22:34:31 +00:00
|
|
|
stage('Tests') {
|
|
|
|
parallel {
|
|
|
|
stage('General') {
|
|
|
|
steps { timeout(60) {
|
|
|
|
sh 'make DISABLE_TEST_FIXTURES_SCRIPT=1 test'
|
2024-04-03 10:47:32 +00:00
|
|
|
sh 'git diff --exit-code --ignore-submodules=all' /* Check no uncommitted changes. */
|
2022-07-21 22:34:31 +00:00
|
|
|
} }
|
|
|
|
}
|
|
|
|
|
|
|
|
stage('REST') {
|
|
|
|
steps { timeout(5) {
|
|
|
|
sh 'make restapi-test'
|
|
|
|
} }
|
2023-01-27 10:00:36 +00:00
|
|
|
post { always {
|
|
|
|
sh 'tar cjf restapi-test.tar.gz resttest0_data/*.txt'
|
|
|
|
} }
|
2022-07-21 22:34:31 +00:00
|
|
|
}
|
|
|
|
}
|
2023-01-27 10:00:36 +00:00
|
|
|
post { always { timeout(5) {
|
|
|
|
archiveArtifacts(artifacts: '*.tar.gz', allowEmptyArchive: true)
|
|
|
|
} } }
|
2022-07-21 22:34:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
stage('Finalizations') {
|
2022-07-23 14:28:10 +00:00
|
|
|
stages { /* parallel builds of minimal / mainnet not yet supported */
|
2022-07-21 22:34:31 +00:00
|
|
|
stage('minimal') {
|
2022-11-18 16:08:56 +00:00
|
|
|
steps { timeout(26) {
|
|
|
|
sh 'make local-testnet-minimal'
|
|
|
|
} }
|
|
|
|
post { always {
|
2023-05-25 15:05:38 +00:00
|
|
|
sh 'tar cjf local-testnet-minimal.tar.gz local-testnet-minimal/logs/*'
|
2022-11-18 16:08:56 +00:00
|
|
|
} }
|
2022-07-21 22:34:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
stage('mainnet') {
|
2022-11-18 16:08:56 +00:00
|
|
|
steps { timeout(62) {
|
|
|
|
sh 'make local-testnet-mainnet'
|
|
|
|
} }
|
|
|
|
post { always {
|
2023-05-25 15:05:38 +00:00
|
|
|
sh 'tar cjf local-testnet-mainnet.tar.gz local-testnet-mainnet/logs/*'
|
2022-11-18 16:08:56 +00:00
|
|
|
} }
|
2022-07-21 22:34:31 +00:00
|
|
|
}
|
|
|
|
}
|
2022-11-18 16:08:56 +00:00
|
|
|
post { always { timeout(5) {
|
2023-05-14 21:32:45 +00:00
|
|
|
archiveArtifacts(
|
|
|
|
artifacts: '*.tar.gz',
|
|
|
|
excludes: '**/geth-*.tar.gz', /* `scripts/geth_binaries.sh` */
|
|
|
|
allowEmptyArchive: true
|
|
|
|
)
|
2022-11-18 16:08:56 +00:00
|
|
|
} } }
|
2022-07-21 22:34:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
post {
|
|
|
|
always {
|
|
|
|
cleanWs(
|
|
|
|
disableDeferredWipeout: true,
|
|
|
|
deleteDirs: true
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
def isMainBranch() {
|
|
|
|
return ['stable', 'testing', 'unstable'].contains(env.BRANCH_NAME)
|
|
|
|
}
|
|
|
|
|
|
|
|
/* This allows us to use one Jenkinsfile and run
|
|
|
|
* jobs on different platforms based on job name. */
|
|
|
|
def getAgentLabel() {
|
|
|
|
if (params.AGENT_LABEL) { return params.AGENT_LABEL }
|
|
|
|
/* We extract the name of the job from currentThread because
|
|
|
|
* before an agent is picket env is not available. */
|
|
|
|
def tokens = Thread.currentThread().getName().split('/')
|
|
|
|
def labels = []
|
|
|
|
/* Check if the job path contains any of the valid labels. */
|
|
|
|
['linux', 'macos', 'x86_64', 'aarch64', 'arm64'].each {
|
|
|
|
if (tokens.contains(it)) { labels.add(it) }
|
|
|
|
}
|
|
|
|
return labels.join(' && ')
|
|
|
|
}
|
2024-04-03 10:47:32 +00:00
|
|
|
|
|
|
|
def nimCommitForJob() {
|
2024-04-18 15:08:44 +00:00
|
|
|
return JOB_NAME.contains('nimv2') ? 'upstream/version-2-0' : ''
|
2024-04-03 10:47:32 +00:00
|
|
|
}
|