Update Jenkinsfile
Rust CI Epoch Forge passed all CI checks.
Gitea/epoch_forge/pipeline/head This commit looks good Details

This commit is contained in:
Dandaedre 2026-09-13 13:12:01 +02:00
parent f34548f331
commit 13eb69cd2b
1 changed files with 139 additions and 39 deletions

178
Jenkinsfile vendored
View File

@ -1,68 +1,168 @@
// Don't forget to add http://192.168.1.37:8080/gitea-webhook/post as a gitea webhook
// Add this webhook in Gitea:
// http://192.168.1.37:8080/gitea-webhook/post
pipeline {
agent { label 'rust_no_docker' }
/* ===============
BEGIN USER CONFIG
================== */
environment {
DEPLOY_DIR = "/mnt/books/rust_doc/efo/" // Important, all books are in /mnt/book
MDBOOK_BUILD_DIR = "target/doc/"
CARGO_TERM_COLOR = 'always'
RUST_BACKTRACE = '1'
}
stages {
stage('Checkout') {
steps {
checkout scm // Checkout intead of full clone
checkout scm
sh '''
set -eu
git submodule sync --recursive
git submodule update --init --recursive
'''
}
}
stage('Update') {
stage('Setup Rust') {
steps {
sh "rustup update"
// sh "rustup show"
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
echo "Installing/updating repository toolchain..."
rustup show
# The repository's .rust-toolchain.toml selects the
# appropriate Rust version automatically.
rustup toolchain install 1.92.0 \
--profile minimal \
--component rustfmt \
--component clippy
echo
echo "Using:"
rustc --version
cargo --version
rustfmt --version
cargo clippy --version
'''
}
}
/* ===============
END USER CONFIG
================== */
stage('Build Book') {
stage('Format') {
steps {
script {
if (env.BRANCH_NAME == 'origin/review' || env.BRANCH_NAME == 'review' || env.BRANCH_NAME == 'origin/dev-ci' || env.BRANCH_NAME == 'dev-ci') {
sh 'cargo test'
sh 'cargo doc'
sh 'echo "Deploying to ${DEPLOY_DIR}"'
sh 'mkdir -p ${DEPLOY_DIR}'
sh 'rsync -a --delete ${MDBOOK_BUILD_DIR}/ ${DEPLOY_DIR}'
} else if (env.BRANCH_NAME == 'origin/master' || env.BRANCH_NAME == 'master') {
sh 'cargo test'
sh 'cargo doc'
sh 'echo "Deploying to ${DEPLOY_DIR}"'
sh 'mkdir -p ${DEPLOY_DIR}'
sh 'rsync -a --delete ${MDBOOK_BUILD_DIR}/ ${DEPLOY_DIR}'
} else {
echo "Unknown branch: ${env.BRANCH_NAME} - skipping build."
}
}
sh '''
set -eu
echo "Checking Rust formatting..."
cargo fmt --all -- --check
'''
}
}
stage('Check') {
steps {
sh '''
set -eu
echo "Checking all workspace targets..."
cargo check \
--workspace \
--all-targets \
--all-features \
--locked
'''
}
}
stage('Test') {
steps {
sh '''
set -eu
echo "Running workspace tests..."
cargo test \
--workspace \
--all-targets \
--all-features \
--locked
'''
}
}
stage('Clippy') {
steps {
sh '''
set -eu
echo "Running Clippy..."
cargo clippy \
--workspace \
--all-targets \
--all-features \
--locked
'''
}
}
stage('Build Release') {
steps {
sh '''
set -eu
echo "Building release binaries..."
cargo build \
--workspace \
--release \
--all-features \
--locked
echo
echo "Release build completed."
'''
}
}
}
post {
success {
publishChecks conclusion: 'SUCCESS', name: 'Build Successful', summary: 'The build was successful', text: 'The build was sucessful', title: 'Build Successful'
echo '✅ Build Deployed!'
publishChecks(
conclusion: 'SUCCESS',
name: 'Rust CI',
summary: 'Epoch Forge passed all CI checks.',
text: 'Formatting, workspace checks, tests, Clippy, and the release build completed successfully.',
title: 'Build Successful'
)
echo '✅ Epoch Forge passed all CI checks.'
}
failure {
publishChecks conclusion: 'FAILURE', name: 'Build Failed', summary: 'The build failed', text: 'The build was a failure', title: 'Build failed'
echo '❌Build Failed to Deploy'
publishChecks(
conclusion: 'FAILURE',
name: 'Rust CI',
summary: 'Epoch Forge failed CI.',
text: 'Formatting, compilation, tests, Clippy, or the release build failed. Check the Jenkins log.',
title: 'Build Failed'
)
echo '❌ Epoch Forge CI failed.'
}
unstable{
publishChecks conclusion: 'ACTION_REQUIRED', name: 'Build Unstable', summary: 'Unstable build', text: 'Unstable build', title: 'Build Unstable'
unstable {
publishChecks(
conclusion: 'ACTION_REQUIRED',
name: 'Rust CI',
summary: 'Epoch Forge CI is unstable.',
text: 'The Jenkins build completed with an unstable status.',
title: 'Build Unstable'
)
echo '⚠️ Epoch Forge CI is unstable.'
}
}
}
}