Menu
AkurAI-Build
publicLatest change c473d59271bebbbbbfd9250d2bc9ed003ba1d51a - ci: run verify on all branches, keep package/deploy main-only by Ólafur Búi Ólafsson
version: 1
# AkurAI-Build runs as one hardened systemd service on Titan that also owns
# pipeline execution (AKURAI_WORKERS=1). A push to hosted Git queues a run
# automatically when the repository carries this file. The protected
# deploy-production job cannot mutate the service it runs inside of
# (ReadOnlyPaths on the service binary, NoNewPrivileges), so deploy/service-deploy.sh stages
# the packaged binary for the root-owned akurai-deploy.path host agent
# (deploy/host/), which checksum-verifies, installs, restarts, health-gates,
# and rolls back automatically on failure. deploy-production runs unattended
# once verify+package pass - no approval or manual promotion step.
#
# Never hardcode a worker username or data root: the runner injects
# AKURAI_BUILD_ROOT, AKURAI_BUILD_HOSTED, AKURAI_BUILD_WORKSPACE, and
# AKURAI_BUILD_HOME into every job. See README "Pipeline build context".
#
# This repository is the one pipeline that must also run on the PREVIOUS build,
# because it is what produces the runner that injects those variables. Hence
# the `$(getent passwd ...)` fallback below: it resolves the invoking user's
# real home with no username baked in, and is simply unused once the injected
# AKURAI_BUILD_HOME is present.
jobs:
# No `branches` filter here: an empty/absent list is the runner's documented
# "unrestricted" value (see src/runner.rs execute_job, which only skips a
# job when `branches` is non-empty and excludes the ref), so verify runs on
# every ref including feature/PR branches, not just main. package and
# deploy-production below keep `branches: [main]` and their existing
# `needs` chain, so a PR branch can never reach package or production
# deploy even though it exercises verify.
- name: verify
executor: native
cache: [target]
run:
- H=${AKURAI_BUILD_HOME:-$(getent passwd "$(id -u)" | cut -d':' -f6)}; RUSTUP_HOME=$H/.rustup CARGO_HOME=$H/.cargo PATH=$H/.cargo/bin:/usr/bin:/bin cargo fmt --all -- --check
- H=${AKURAI_BUILD_HOME:-$(getent passwd "$(id -u)" | cut -d':' -f6)}; RUSTUP_HOME=$H/.rustup CARGO_HOME=$H/.cargo PATH=$H/.cargo/bin:/usr/bin:/bin cargo clippy --all-targets --all-features -- -D warnings
- H=${AKURAI_BUILD_HOME:-$(getent passwd "$(id -u)" | cut -d':' -f6)}; RUSTUP_HOME=$H/.rustup CARGO_HOME=$H/.cargo PATH=$H/.cargo/bin:/usr/bin:/bin cargo test
- name: package
needs: [verify]
executor: native
branches: [main]
cache: [target]
run: H=${AKURAI_BUILD_HOME:-$(getent passwd "$(id -u)" | cut -d':' -f6)}; RUSTUP_HOME=$H/.rustup CARGO_HOME=$H/.cargo PATH=$H/.cargo/bin:/usr/bin:/bin cargo build --release
artifacts:
- target/release/akurai
- name: deploy-production
needs: [package]
executor: native
branches: [main]
environment: production
run: H=${AKURAI_BUILD_HOME:-$(getent passwd "$(id -u)" | cut -d':' -f6)}; AKURAI_HOST_BIN=$H/.local/bin sh deploy/service-deploy.sh