Files
modbus-parser/Jenkinsfile
2025-12-23 22:55:22 +08:00

26 lines
1.0 KiB
Groovy

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
}
}
}