Files
cs420/Jenkinsfile
Jeehoon Kang 6edb4665c0 Update IR
2020-04-09 13:04:23 +09:00

48 lines
1.3 KiB
Groovy

def setupRust() {
sh "rustup component add rustfmt clippy"
sh "rustup install nightly"
sh "cargo update"
sh "cargo"
}
pipeline {
agent {
docker {
image 'rust:latest'
}
}
stages {
stage('Rustfmt') {
steps {
setupRust()
sh "cargo fmt --all -- --check"
}
}
stage('Clippy') {
steps {
setupRust()
sh "cargo clippy --all"
}
}
stage('Build') {
steps {
setupRust()
sh "cargo build"
sh "cargo build --release"
}
}
stage('Test') {
steps {
setupRust()
// When `cargo test` runs, the function `it_works()` is called in a new thread.
// The stack size of a new thread is `2 MiB` on Linux, and this small stack size
// can cause `stack-overflow` error when testing stack-intensive code.
// For this reason, we need to increase the default size of stack to `4 MiB`.
sh "RUST_MIN_STACK=4194304 cargo test"
sh "RUST_MIN_STACK=4194304 cargo test --release"
}
}
}
}