forked from manbo/modbus-parser
Add CI pipeline script
This commit is contained in:
25
Jenkinsfile
vendored
Normal file
25
Jenkinsfile
vendored
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
pipeline {
|
||||||
|
agent {
|
||||||
|
docker {
|
||||||
|
image 'rust:trixie'
|
||||||
|
args '-v /var/run/docker.sock:/var/run/docker.sock -v /home/opt/jenkins/cargo_registry:/usr/local/cargo/registry -v /home/opt/jenkins/cargo_git:/usr/local/cargo/git -v /home/opt/jenkins/cargo_target:/workspace/target'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
environment {
|
||||||
|
CARGO_HOME = '/usr/local/cargo'
|
||||||
|
CARGO_TARGET_DIR = '/workspace/target'
|
||||||
|
}
|
||||||
|
stages {
|
||||||
|
stage('Checkout') { steps { checkout scm } }
|
||||||
|
stage('Fmt') { steps { sh 'rustup component add rustfmt || true; cargo fmt --all -- --check' } }
|
||||||
|
stage('Clippy') { steps { sh 'rustup component add clippy || true; cargo clippy --all-targets --all-features -- -D warnings' } }
|
||||||
|
stage('Build') { steps { sh 'cargo build --locked --workspace' } }
|
||||||
|
stage('Test') { steps { sh 'cargo test --locked --workspace --color=always' } }
|
||||||
|
stage('Release') { steps { sh 'cargo build --release --locked' } }
|
||||||
|
}
|
||||||
|
post {
|
||||||
|
always {
|
||||||
|
archiveArtifacts artifacts: 'target/release/**', allowEmptyArchive: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user