Add ci build steps for libp2p node version (#290)
* Add ci build steps for libp2p node version * Update ci/Jenkinsfile.nightly.integration Co-authored-by: Youngjoon Lee <taxihighway@gmail.com> * Fix typos * Use features in cargo check * Feature and testcase matrix for integration tests * Use jenkins matrix to seperate steps for different features --------- Co-authored-by: Youngjoon Lee <taxihighway@gmail.com>
This commit is contained in:
parent
4a3d677ea9
commit
ef72c7a110
|
@ -30,34 +30,23 @@ pipeline {
|
|||
}
|
||||
|
||||
stages {
|
||||
stage('Build') {
|
||||
steps {
|
||||
/* Node binary is required for integration tests */
|
||||
sh 'cargo build'
|
||||
}
|
||||
}
|
||||
stage('Integration Tests') {
|
||||
matrix {
|
||||
axes {
|
||||
axis {
|
||||
name 'FEATURE'
|
||||
values 'waku', 'libp2p'
|
||||
}
|
||||
}
|
||||
stages {
|
||||
stage('BuildAndTest') {
|
||||
steps {
|
||||
script {
|
||||
/* To prevent rebuilding node for each test, tests are defined here */
|
||||
def tests = ['ten_nodes_happy', 'two_nodes_happy', 'ten_nodes_one_down']
|
||||
|
||||
stage('Integration tests') {
|
||||
steps {
|
||||
script {
|
||||
int iterations = params.ITERATIONS.toInteger()
|
||||
|
||||
for (int i = 0; i < iterations; i++) {
|
||||
echo "Running iteration ${i + 1} of ${iterations}"
|
||||
|
||||
if (sh(script: 'cargo test ten_nodes_happy', returnStatus: true) != 0) {
|
||||
error("Test failed on iteration ${i + 1}")
|
||||
break
|
||||
}
|
||||
|
||||
if (sh(script: 'cargo test two_nodes_happy', returnStatus: true) != 0) {
|
||||
error("Test failed on iteration ${i + 1}")
|
||||
break
|
||||
}
|
||||
|
||||
if (sh(script: 'cargo test ten_nodes_one_down', returnStatus: true) != 0) {
|
||||
error("Test failed on iteration ${i + 1}")
|
||||
break
|
||||
runBuildAndTestsForFeature(FEATURE, tests)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -82,3 +71,30 @@ pipeline {
|
|||
}
|
||||
}
|
||||
|
||||
def runBuildAndTestsForFeature(feature, tests) {
|
||||
echo "Building node for feature: ${feature}"
|
||||
def build_cmd = "cargo build -p nomos-node --features ${feature}"
|
||||
|
||||
if (sh(script: build_cmd, returnStatus: true) != 0) {
|
||||
error("Build '${feature}' node failed")
|
||||
return
|
||||
}
|
||||
|
||||
int iterations = params.ITERATIONS.toInteger()
|
||||
runTestCases(tests, iterations)
|
||||
}
|
||||
|
||||
def runTestCases(test_cases, iterations) {
|
||||
for (int i = 0; i < iterations; i++) {
|
||||
echo "Running iteration ${i + 1} of ${iterations}"
|
||||
|
||||
for (test_case in test_cases) {
|
||||
def test_cmd = "cargo test -p tests --features ${feature} ${test_case}"
|
||||
if (sh(script: test_cmd, returnStatus: true) != 0) {
|
||||
error("Test '${test_case}' failed on iteration ${i + 1}")
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,24 +21,36 @@ pipeline {
|
|||
}
|
||||
|
||||
stages {
|
||||
stage('Check') {
|
||||
steps {
|
||||
sh 'cargo check --all --all-features'
|
||||
sh 'cargo fmt -- --check'
|
||||
sh 'cargo clippy --all --all-features -- --deny warnings'
|
||||
}
|
||||
}
|
||||
stage('BuildAndTest') {
|
||||
matrix {
|
||||
axes {
|
||||
axis {
|
||||
name 'FEATURES'
|
||||
values 'waku', 'libp2p'
|
||||
}
|
||||
}
|
||||
stages {
|
||||
stage('Check') {
|
||||
steps {
|
||||
sh "cargo check --all --features ${FEATURES}"
|
||||
sh "cargo fmt -- --check"
|
||||
sh "cargo clippy --all --features ${FEATURES} -- --deny warnings"
|
||||
}
|
||||
}
|
||||
|
||||
stage('Build') {
|
||||
steps {
|
||||
sh 'cargo build'
|
||||
sh 'cargo build --all --all-features'
|
||||
}
|
||||
}
|
||||
stage('Build') {
|
||||
steps {
|
||||
sh "cargo build"
|
||||
sh "cargo build --all --features ${FEATURES}"
|
||||
}
|
||||
}
|
||||
|
||||
stage('Test') {
|
||||
steps {
|
||||
sh 'cargo test --all --all-features'
|
||||
stage('Test') {
|
||||
steps {
|
||||
sh "cargo test --all --features ${FEATURES}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,25 +20,37 @@ pipeline {
|
|||
}
|
||||
|
||||
stages {
|
||||
stage('Check') {
|
||||
steps { script {
|
||||
nix.shell('cargo check --all --all-features')
|
||||
nix.shell('cargo fmt -- --check')
|
||||
nix.shell('cargo clippy --all --all-features -- --deny warnings')
|
||||
} }
|
||||
}
|
||||
stage('BuildAndTest') {
|
||||
matrix {
|
||||
axes {
|
||||
axis {
|
||||
name 'FEATURES'
|
||||
values 'waku', 'libp2p'
|
||||
}
|
||||
}
|
||||
stages {
|
||||
stage('Check') {
|
||||
steps { script {
|
||||
nix.shell("cargo check --all --features ${FEATURES}")
|
||||
nix.shell("cargo fmt -- --check")
|
||||
nix.shell("cargo clippy --all --features ${FEATURES} -- --deny warnings")
|
||||
} }
|
||||
}
|
||||
|
||||
stage('Build') {
|
||||
steps { script {
|
||||
nix.shell('cargo build')
|
||||
nix.shell('cargo build --all --all-features')
|
||||
} }
|
||||
}
|
||||
stage('Build') {
|
||||
steps { script {
|
||||
nix.shell("cargo build")
|
||||
nix.shell("cargo build --all --features ${FEATURES}")
|
||||
} }
|
||||
}
|
||||
|
||||
stage('Test') {
|
||||
steps { script {
|
||||
nix.shell('cargo test --all --all-features')
|
||||
} }
|
||||
stage('Test') {
|
||||
steps { script {
|
||||
nix.shell("cargo test --all --features ${FEATURES}")
|
||||
} }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
|
|
Loading…
Reference in New Issue