Add Jenkinsfile
rping CI rping failed CI.
Archive/rping/pipeline/head There was a failure building this commit Details

This commit is contained in:
Dandaedre 2026-09-14 19:40:26 +02:00
parent 2e0cab46f7
commit 0437954ba7
1 changed files with 145 additions and 0 deletions

145
Jenkinsfile vendored Normal file
View File

@ -0,0 +1,145 @@
// Jenkins CI for Archive/rping
//
// Add this webhook in Gitea:
// http://192.168.1.37:8080/gitea-webhook/post
//
// rping is a Rust ICMP ping CLI. CI validates compilation and tests only;
// it deliberately does not execute a live ping because raw ICMP sockets may
// require elevated privileges/capabilities on the Jenkins worker.
pipeline {
agent { label 'rust_nodocker' }
options {
timestamps()
disableConcurrentBuilds()
}
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
if [ -f rust-toolchain.toml ] || [ -f rust-toolchain ]; then
echo "Using repository-pinned Rust toolchain."
rustup show active-toolchain
TOOLCHAIN="$(rustup show active-toolchain | awk '{print $1}')"
rustup component add rustfmt clippy --toolchain "$TOOLCHAIN"
else
rustup toolchain install stable \
--profile minimal \
--component rustfmt \
--component clippy
rustup default stable
fi
rustc --version
cargo --version
'''
}
}
stage('Format') {
steps {
sh '''
set -eu
cargo fmt --all -- --check
'''
}
}
stage('Check') {
steps {
sh '''
set -eu
cargo check --all-targets --all-features
'''
}
}
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
test -x target/release/rping
'''
}
}
}
post {
success {
publishChecks(
conclusion: 'SUCCESS',
name: 'rping CI',
summary: 'rping passed CI.',
text: 'Formatting, compilation, tests, Clippy, and the release build completed successfully.',
title: 'Build Successful'
)
}
failure {
publishChecks(
conclusion: 'FAILURE',
name: 'rping CI',
summary: 'rping failed CI.',
text: 'One or more Rust checks failed. See the Jenkins log.',
title: 'Build Failed'
)
}
unstable {
publishChecks(
conclusion: 'ACTION_REQUIRED',
name: 'rping CI',
summary: 'rping CI is unstable.',
text: 'The Jenkins build completed with an unstable status.',
title: 'Build Unstable'
)
}
}
}