117 lines
2.9 KiB
Groovy
117 lines
2.9 KiB
Groovy
// Add this webhook in Gitea:
|
|
// https://192.168.1.37:8080/gitea-webhook/post
|
|
|
|
pipeline {
|
|
agent { label 'rust_nodocker' }
|
|
|
|
environment {
|
|
CARGO_TERM_COLOR = 'never'
|
|
RUST_BACKTRACE = '1'
|
|
}
|
|
|
|
stages {
|
|
stage('Checkout') {
|
|
steps {
|
|
checkout scm
|
|
|
|
sh '''
|
|
set -eu
|
|
|
|
git submodule sync --recursive
|
|
git submodule update --init --recursive
|
|
'''
|
|
}
|
|
}
|
|
|
|
stage('Setup Rust') {
|
|
steps {
|
|
sh '''
|
|
set -eu
|
|
|
|
if ! command -v rustup >/dev/null 2>&1; then
|
|
echo "ERROR: rustup is not installed on this worker." >&2
|
|
exit 1
|
|
fi
|
|
|
|
rustup toolchain install stable \
|
|
--profile minimal \
|
|
--component rustfmt \
|
|
--component clippy
|
|
|
|
rustup default stable
|
|
|
|
rustc --version
|
|
cargo --version
|
|
'''
|
|
}
|
|
}
|
|
|
|
stage('Format') {
|
|
steps {
|
|
sh '''
|
|
set -eu
|
|
cargo fmt --all -- --check
|
|
'''
|
|
}
|
|
}
|
|
|
|
stage('Tests') {
|
|
steps {
|
|
sh '''
|
|
set -eu
|
|
cargo test --all-targets --all-features
|
|
'''
|
|
}
|
|
}
|
|
|
|
stage('Clippy') {
|
|
steps {
|
|
sh '''
|
|
set -eu
|
|
cargo clippy --all-targets --all-features
|
|
'''
|
|
}
|
|
}
|
|
|
|
stage('Build Release') {
|
|
steps {
|
|
sh '''
|
|
set -eu
|
|
cargo build --release --all-features
|
|
'''
|
|
}
|
|
}
|
|
}
|
|
|
|
post {
|
|
success {
|
|
publishChecks(
|
|
conclusion: 'SUCCESS',
|
|
name: 'Rust CI',
|
|
summary: 'rust_autobadges passed CI.',
|
|
text: 'Formatting, tests, Clippy and release build completed successfully.',
|
|
title: 'Build Successful'
|
|
)
|
|
}
|
|
|
|
failure {
|
|
publishChecks(
|
|
conclusion: 'FAILURE',
|
|
name: 'Rust CI',
|
|
summary: 'rust_autobadges failed CI.',
|
|
text: 'One or more Rust checks failed. See the Jenkins log.',
|
|
title: 'Build Failed'
|
|
)
|
|
}
|
|
|
|
unstable {
|
|
publishChecks(
|
|
conclusion: 'ACTION_REQUIRED',
|
|
name: 'Rust CI',
|
|
summary: 'rust_autobadges CI is unstable.',
|
|
text: 'The Jenkins build completed with an unstable status.',
|
|
title: 'Build Unstable'
|
|
)
|
|
}
|
|
}
|
|
} |