diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..d4375e0 --- /dev/null +++ b/Jenkinsfile @@ -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 + } + } +}