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-04-26 16:13:13 +00:00
|
|
|
/* Ganache config */
|
|
|
|
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-04-03 15:28:16 +00:00
|
|
|
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
|
|
|
|
|
|
|
stage('Ganache') { steps { script {
|
|
|
|
ganache = docker.image(
|
|
|
|
'trufflesuite/ganache:v7.4.1'
|
|
|
|
).run(
|
|
|
|
["-p 127.0.0.1:${env.GANACHE_RPC_PORT}:8545"].join(' '),
|
|
|
|
["-m='${GANACHE_MNEMONIC}'"].join(' ')
|
|
|
|
)
|
|
|
|
} } }
|
|
|
|
|
|
|
|
stage('On-chain tests') {
|
|
|
|
environment {
|
|
|
|
GANACHE_NETWORK_RPC_URL = "ws://localhost:${env.GANACHE_RPC_PORT}"
|
|
|
|
}
|
|
|
|
steps { script { dir(env.REPO) {
|
|
|
|
nix.develop('make test-onchain', pure: false)
|
|
|
|
} } }
|
|
|
|
}
|
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) } }
|
|
|
|
cleanup { cleanWs() }
|
2022-06-19 21:50:37 +00:00
|
|
|
}
|
|
|
|
}
|