ci: add RACE parameter to fix conditional (#648)

We are checking if `JOB_NAME` contains a token `race` to set the default
value for `RACE` parameter which decides which tests run.

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2023-08-16 14:04:57 +02:00 committed by GitHub
parent 9e6c09e680
commit d860d825c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 2 deletions

View File

@ -18,6 +18,16 @@ pipeline {
))
}
/* WARNING: Defining parameters here with the ?: trick causes them to remember last value. */
parameters {
booleanParam(
name: 'RACE',
description: 'Run tests with check for race condition.',
defaultValue: getRaceDefault()
)
}
environment {
TARGET = 'tests'
REPO = "${env.WORKSPACE}/src/github.com/waku-org/go-waku"
@ -40,7 +50,7 @@ pipeline {
stage('Test') {
steps { script { dir(env.REPO) {
if (env.JOB_BASE_NAME == "race") {
if (params.RACE) {
nix.develop('make test-with-race', pure: false)
}else {
nix.develop('make test-ci', pure: false)
@ -64,7 +74,7 @@ pipeline {
GANACHE_NETWORK_RPC_URL = "ws://localhost:${env.GANACHE_RPC_PORT}"
}
steps { script { dir(env.REPO) {
if (env.JOB_BASE_NAME == "race") {
if (params.RACE) {
nix.develop('make test-onchain-with-race', pure: false)
}else {
nix.develop('make test-onchain', pure: false)
@ -86,3 +96,7 @@ pipeline {
} }
}
}
def Boolean getRaceDefault() {
return env.JOB_NAME.split('/').contains('race')
}