ci: add Jenkins pipeline
This commit is contained in:
parent
06758869d5
commit
d6a61c7645
|
|
@ -0,0 +1,149 @@
|
|||
pipeline {
|
||||
agent any
|
||||
|
||||
environment {
|
||||
CARGO_TERM_COLOR = 'never'
|
||||
RUST_BACKTRACE = '1'
|
||||
RUSTUP_TOOLCHAIN = 'stable'
|
||||
}
|
||||
|
||||
options {
|
||||
skipDefaultCheckout(true)
|
||||
timestamps()
|
||||
timeout(time: 30, unit: 'MINUTES')
|
||||
}
|
||||
|
||||
stages {
|
||||
stage('Checkout') {
|
||||
steps {
|
||||
checkout scm
|
||||
}
|
||||
}
|
||||
|
||||
stage('Toolchain') {
|
||||
steps {
|
||||
sh '''
|
||||
set -eu
|
||||
|
||||
for tool in git cargo rustc; do
|
||||
if ! command -v "${tool}" >/dev/null 2>&1; then
|
||||
echo "ERROR: ${tool} is required on the Jenkins worker." >&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
git --version
|
||||
rustc --version
|
||||
cargo --version
|
||||
cargo clippy --version
|
||||
cargo metadata --locked --no-deps --format-version 1 >/dev/null
|
||||
'''
|
||||
}
|
||||
}
|
||||
|
||||
stage('Tests') {
|
||||
steps {
|
||||
sh '''
|
||||
set -eu
|
||||
|
||||
cargo test --release --all-targets --locked
|
||||
'''
|
||||
}
|
||||
}
|
||||
|
||||
stage('Clippy') {
|
||||
steps {
|
||||
sh '''
|
||||
set -eu
|
||||
|
||||
cargo clippy --all-targets --locked -- -D warnings
|
||||
'''
|
||||
}
|
||||
}
|
||||
|
||||
stage('Engine verifier') {
|
||||
steps {
|
||||
sh '''
|
||||
set -eu
|
||||
|
||||
cargo run --release --locked --example verify -- 100000
|
||||
'''
|
||||
}
|
||||
}
|
||||
|
||||
stage('Build') {
|
||||
steps {
|
||||
sh '''
|
||||
set -eu
|
||||
|
||||
rm -f target/release/balatro-seed-search
|
||||
cargo build --release --locked --bin balatro-seed-search
|
||||
test -f target/release/balatro-seed-search
|
||||
test -s target/release/balatro-seed-search
|
||||
'''
|
||||
}
|
||||
}
|
||||
|
||||
stage('Archive') {
|
||||
steps {
|
||||
archiveArtifacts(
|
||||
artifacts: 'target/release/balatro-seed-search',
|
||||
fingerprint: true
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
post {
|
||||
success {
|
||||
script {
|
||||
try {
|
||||
publishChecks(
|
||||
conclusion: 'SUCCESS',
|
||||
name: 'Rust CI',
|
||||
summary: 'balatro-seed-search passed CI.',
|
||||
text: 'Release tests, Clippy, the engine verifier, and the release build passed; the native binary was archived.',
|
||||
title: 'Build Successful'
|
||||
)
|
||||
} catch (err) {
|
||||
echo "Could not publish the successful Rust CI check: ${err}"
|
||||
}
|
||||
}
|
||||
echo 'balatro-seed-search passed CI.'
|
||||
}
|
||||
|
||||
failure {
|
||||
script {
|
||||
try {
|
||||
publishChecks(
|
||||
conclusion: 'FAILURE',
|
||||
name: 'Rust CI',
|
||||
summary: 'balatro-seed-search failed CI.',
|
||||
text: 'A toolchain, test, Clippy, verifier, build, or archive stage failed. Check the Jenkins log.',
|
||||
title: 'Build Failed'
|
||||
)
|
||||
} catch (err) {
|
||||
echo "Could not publish the failed Rust CI check: ${err}"
|
||||
}
|
||||
}
|
||||
echo 'balatro-seed-search CI failed.'
|
||||
}
|
||||
|
||||
unstable {
|
||||
script {
|
||||
try {
|
||||
publishChecks(
|
||||
conclusion: 'ACTION_REQUIRED',
|
||||
name: 'Rust CI',
|
||||
summary: 'balatro-seed-search CI is unstable.',
|
||||
text: 'The Jenkins build completed with an unstable status. Check the Jenkins log.',
|
||||
title: 'Build Unstable'
|
||||
)
|
||||
} catch (err) {
|
||||
echo "Could not publish the unstable Rust CI check: ${err}"
|
||||
}
|
||||
}
|
||||
echo 'balatro-seed-search CI is unstable.'
|
||||
}
|
||||
}
|
||||
}
|
||||
15
TASK.md
15
TASK.md
|
|
@ -423,3 +423,18 @@ regression evidence rather than copying the table blindly.
|
|||
inspection tests; full tests; strict Clippy; release build; `git diff
|
||||
--check`.
|
||||
- Commit: `fix: complete Soul regression coverage`.
|
||||
|
||||
- [x] **31. Add a Jenkins CI pipeline.**
|
||||
- Add a declarative pipeline with explicit checkout and worker-tool
|
||||
validation, using no unconfirmed installation-specific labels or paths.
|
||||
- Run the documented release tests, strict Clippy gate, engine verifier, and
|
||||
release build before archiving the validated native binary with a
|
||||
fingerprint.
|
||||
- Report Gitea checks without allowing a notification error to conceal the
|
||||
original build result; do not publish releases or use credentials.
|
||||
- Document worker requirements, local equivalents, the archived artifact,
|
||||
non-publication policy, and generic Gitea webhook setup.
|
||||
- Checks: all Jenkins shell commands locally; missing-tool and missing-output
|
||||
failures; Jenkins declarative syntax when a linter is available; archive
|
||||
scope and secret scan; `git diff --check`.
|
||||
- Commit: `ci: add Jenkins pipeline`.
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ stable Rust toolchain.
|
|||
## Quality checks
|
||||
|
||||
```bash
|
||||
export RUSTUP_TOOLCHAIN=stable
|
||||
cargo test --release --all-targets --locked
|
||||
cargo clippy --all-targets --locked -- -D warnings
|
||||
cargo run --release --example verify -- 100000
|
||||
|
|
@ -56,3 +57,41 @@ cargo binstall --git \
|
|||
|
||||
The target images and environment passthrough are defined in
|
||||
[`Cross.toml`](../Cross.toml).
|
||||
|
||||
## Jenkins CI
|
||||
|
||||
[`Jenkinsfile`](../Jenkinsfile) runs the documented release tests, strict
|
||||
Clippy checks, the 100,000-seed engine verifier, and the native release build.
|
||||
Every successful branch build archives and fingerprints this file:
|
||||
|
||||
```text
|
||||
target/release/balatro-seed-search
|
||||
```
|
||||
|
||||
The pipeline uses `agent any` because this repository has no confirmed
|
||||
installation-specific worker label. The selected worker must provide a POSIX
|
||||
shell, Git, and a current stable Rust toolchain with Cargo and Clippy. It must
|
||||
also be able to obtain the locked Cargo dependencies when they are not already
|
||||
cached. The toolchain stage fails with a direct error when a required command
|
||||
is missing; it does not install or update worker tools.
|
||||
|
||||
Run the Jenkins gates locally with:
|
||||
|
||||
```bash
|
||||
export RUSTUP_TOOLCHAIN=stable
|
||||
cargo test --release --all-targets --locked
|
||||
cargo clippy --all-targets --locked -- -D warnings
|
||||
cargo run --release --locked --example verify -- 100000
|
||||
cargo build --release --locked --bin balatro-seed-search
|
||||
test -s target/release/balatro-seed-search
|
||||
```
|
||||
|
||||
This job does not publish releases or copy files to a shared destination on
|
||||
any branch. It requires no Jenkins credentials. Releases remain the explicit
|
||||
`rust_realease` workflow documented above.
|
||||
|
||||
For automatic Gitea builds, configure the canonical repository's webhook to
|
||||
the Jenkins installation's `gitea-webhook/post` endpoint and create a
|
||||
multibranch Pipeline job that reads `Jenkinsfile`. The installation must expose
|
||||
the `publishChecks` step for Gitea status reporting. Check-reporting errors are
|
||||
logged without replacing the original build result.
|
||||
|
|
|
|||
Loading…
Reference in New Issue