diff --git a/Jenkinsfile b/Jenkinsfile index 4fefea0..675adcb 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -4,9 +4,20 @@ pipeline { agent { label 'rust_nodocker' } + options { + disableConcurrentBuilds() + skipDefaultCheckout(true) + timeout(time: 45, unit: 'MINUTES') + timestamps() + } + environment { + // Jenkins logs are easier to read without Cargo ANSI escape sequences. CARGO_TERM_COLOR = 'never' RUST_BACKTRACE = '1' + + // Keep CI artifacts separate from local build output. + CARGO_TARGET_DIR = "${WORKSPACE}/target-ci" } stages { @@ -29,7 +40,7 @@ pipeline { set -eu if ! command -v rustup >/dev/null 2>&1; then - echo "ERROR: rustup is not installed on this worker." >&2 + echo 'ERROR: rustup is required on the Jenkins worker.' >&2 exit 1 fi @@ -37,11 +48,12 @@ pipeline { --profile minimal \ --component rustfmt \ --component clippy - rustup default stable rustc --version cargo --version + rustfmt --version + cargo clippy --version ''' } } @@ -73,11 +85,27 @@ pipeline { } } + stage('Documentation') { + steps { + sh ''' + set -eu + cargo test --workspace --doc --all-features + RUSTDOCFLAGS='-D warnings' \ + cargo doc --workspace --no-deps --all-features + ''' + } + } + stage('Clippy') { steps { sh ''' set -eu - cargo clippy --workspace --all-targets --all-features + cargo clippy \ + --workspace \ + --all-targets \ + --all-features \ + -- \ + -D warnings ''' } } @@ -87,6 +115,16 @@ pipeline { sh ''' set -eu cargo build --workspace --release --all-features + + BINARY="${CARGO_TARGET_DIR}/release/fader_master" + if [ ! -x "${BINARY}" ]; then + echo "ERROR: expected release binary is missing or not executable: ${BINARY}" >&2 + exit 1 + fi + + ls -lh "${BINARY}" + file "${BINARY}" || true + ldd "${BINARY}" || true ''' } } @@ -96,31 +134,41 @@ pipeline { success { publishChecks( conclusion: 'SUCCESS', - name: 'fader_master CI', + name: 'Rust CI', summary: 'fader_master passed CI.', - text: 'Workspace formatting, checks, tests, Clippy and release build completed successfully.', + text: 'Formatting, workspace checks, tests, documentation, warning-strict Clippy and the release build completed successfully.', title: 'Build Successful' ) + + echo 'fader_master passed CI.' } failure { publishChecks( conclusion: 'FAILURE', - name: 'fader_master CI', + name: 'Rust CI', summary: 'fader_master failed CI.', - text: 'One or more Rust workspace checks failed. See the Jenkins log.', + text: 'Formatting, workspace checks, tests, documentation, Clippy, or the release build failed. See the Jenkins log.', title: 'Build Failed' ) + + echo 'fader_master CI failed.' } unstable { publishChecks( conclusion: 'ACTION_REQUIRED', - name: 'fader_master CI', + name: 'Rust CI', summary: 'fader_master CI is unstable.', - text: 'The Jenkins build completed with an unstable status.', + text: 'The Jenkins build completed with an unstable status. See the Jenkins log.', title: 'Build Unstable' ) + + echo 'fader_master CI is unstable.' + } + + cleanup { + deleteDir() } } -} \ No newline at end of file +}