diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..4fefea0 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,126 @@ +// Add this webhook in Gitea: +// http://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('Check') { + steps { + sh ''' + set -eu + cargo check --workspace --all-targets --all-features + ''' + } + } + + stage('Tests') { + steps { + sh ''' + set -eu + cargo test --workspace --all-targets --all-features + ''' + } + } + + stage('Clippy') { + steps { + sh ''' + set -eu + cargo clippy --workspace --all-targets --all-features + ''' + } + } + + stage('Build Release') { + steps { + sh ''' + set -eu + cargo build --workspace --release --all-features + ''' + } + } + } + + post { + success { + publishChecks( + conclusion: 'SUCCESS', + name: 'fader_master CI', + summary: 'fader_master passed CI.', + text: 'Workspace formatting, checks, tests, Clippy and release build completed successfully.', + title: 'Build Successful' + ) + } + + failure { + publishChecks( + conclusion: 'FAILURE', + name: 'fader_master CI', + summary: 'fader_master failed CI.', + text: 'One or more Rust workspace checks failed. See the Jenkins log.', + title: 'Build Failed' + ) + } + + unstable { + publishChecks( + conclusion: 'ACTION_REQUIRED', + name: 'fader_master CI', + summary: 'fader_master CI is unstable.', + text: 'The Jenkins build completed with an unstable status.', + title: 'Build Unstable' + ) + } + } +} \ No newline at end of file