2023-04-03 15:28:16 +00:00
|
|
|
library 'status-jenkins-lib@v1.7.0'
|
|
|
|
|
2022-06-19 21:50:37 +00:00
|
|
|
pipeline {
|
|
|
|
agent {
|
2023-04-03 15:28:16 +00:00
|
|
|
label 'linux && nix-2.11 && x86_64'
|
2022-06-19 21:50:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
options {
|
|
|
|
timestamps()
|
|
|
|
disableConcurrentBuilds()
|
2023-04-14 13:45:01 +00:00
|
|
|
/* Prevent Jenkins jobs from running forever */
|
|
|
|
timeout(time: 30, unit: 'MINUTES')
|
|
|
|
/* Go requires a certain directory structure */
|
|
|
|
checkoutToSubdirectory('src/github.com/waku-org/go-waku')
|
2022-06-19 21:50:37 +00:00
|
|
|
buildDiscarder(logRotator(
|
|
|
|
numToKeepStr: '10',
|
|
|
|
daysToKeepStr: '30',
|
|
|
|
))
|
|
|
|
}
|
|
|
|
|
|
|
|
environment {
|
2023-04-14 13:45:01 +00:00
|
|
|
TARGET = 'tests'
|
|
|
|
REPO = "${env.WORKSPACE}/src/github.com/waku-org/go-waku"
|
|
|
|
GOCACHE = "${env.WORKSPACE_TMP}/go-build"
|
|
|
|
GOPATH = "${env.WORKSPACE}/go"
|
|
|
|
PATH = "${env.PATH}:${env.GOPATH}/bin"
|
|
|
|
/* Necesary to avoid cache poisoning by other builds. */
|
|
|
|
GOLANGCI_LINT_CACHE = "${env.WORKSPACE_TMP}/golangci-lint"
|
2023-08-08 04:46:54 +00:00
|
|
|
/* Ganache config */
|
2023-04-26 16:13:13 +00:00
|
|
|
GANACHE_RPC_PORT = "${8989 + env.EXECUTOR_NUMBER.toInteger()}"
|
|
|
|
GANACHE_MNEMONIC = 'swim relax risk shy chimney please usual search industry board music segment'
|
2022-06-19 21:50:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
stages {
|
|
|
|
stage('Lint') {
|
2023-04-14 13:45:01 +00:00
|
|
|
steps { script { dir(env.REPO) {
|
2023-04-03 15:28:16 +00:00
|
|
|
nix.develop('make lint', pure: false)
|
2023-04-14 13:45:01 +00:00
|
|
|
} } }
|
2022-06-19 21:50:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
stage('Test') {
|
2023-04-14 13:45:01 +00:00
|
|
|
steps { script { dir(env.REPO) {
|
2023-08-09 04:51:20 +00:00
|
|
|
if (env.JOB_BASE_NAME == "race") {
|
|
|
|
nix.develop('make test-with-race', pure: false)
|
|
|
|
}else {
|
|
|
|
nix.develop('make test-ci', pure: false)
|
|
|
|
}
|
2023-04-14 13:45:01 +00:00
|
|
|
} } }
|
2022-06-19 21:50:37 +00:00
|
|
|
}
|
2023-04-26 16:13:13 +00:00
|
|
|
|
2023-05-05 15:28:29 +00:00
|
|
|
stage('Ganache') {
|
|
|
|
steps { script {
|
|
|
|
ganache = docker.image(
|
|
|
|
'trufflesuite/ganache:v7.4.1'
|
|
|
|
).run(
|
|
|
|
"-p 127.0.0.1:${env.GANACHE_RPC_PORT}:8545",
|
|
|
|
"-m='${GANACHE_MNEMONIC}'"
|
|
|
|
)
|
|
|
|
} }
|
|
|
|
}
|
2023-04-26 16:13:13 +00:00
|
|
|
|
|
|
|
stage('On-chain tests') {
|
|
|
|
environment {
|
|
|
|
GANACHE_NETWORK_RPC_URL = "ws://localhost:${env.GANACHE_RPC_PORT}"
|
|
|
|
}
|
|
|
|
steps { script { dir(env.REPO) {
|
2023-08-09 04:51:20 +00:00
|
|
|
if (env.JOB_BASE_NAME == "race") {
|
|
|
|
nix.develop('make test-onchain-with-race', pure: false)
|
|
|
|
}else {
|
|
|
|
nix.develop('make test-onchain', pure: false)
|
|
|
|
}
|
2023-04-26 16:13:13 +00:00
|
|
|
} } }
|
|
|
|
}
|
2022-06-19 21:50:37 +00:00
|
|
|
}
|
|
|
|
post {
|
2023-04-03 15:28:16 +00:00
|
|
|
always { script { /* No artifact but a PKG_URL is necessary. */
|
|
|
|
env.PKG_URL = "${currentBuild.absoluteUrl}consoleText"
|
|
|
|
} }
|
|
|
|
success { script { github.notifyPR(true) } }
|
|
|
|
failure { script { github.notifyPR(false) } }
|
2023-05-05 15:28:29 +00:00
|
|
|
cleanup { script {
|
|
|
|
cleanWs()
|
|
|
|
catchError {
|
|
|
|
ganache.stop()
|
|
|
|
}
|
|
|
|
} }
|
2022-06-19 21:50:37 +00:00
|
|
|
}
|
|
|
|
}
|