name: CI # Build, lint, and test the prov workspace on every push and pull request. # # There is deliberately almost nothing here. The jobs are the `job` list in # .config/ship.figl, and ship is what reads it: the plan job asks `ship ci # --matrix` for them, and each runner runs one as `ship ci `. Changing CI — # adding a job, renaming one, changing what a job runs — is an edit to that file # alone, and `ship ci` runs the same jobs locally, in the same order, with the # same shell. # # What the runner still owns is the toolchain, because only it knows how to # install one: stable Rust, the components a job's `runner` table asks for, and # — for every job but the one that says `builds = false` — the cargo cache. on: push: { branches: [main] } pull_request: null workflow_dispatch: null # Cancel superseded runs on the same ref — a new push makes the old one moot. concurrency: group: ci-${{ github.ref }} cancel-in-progress: true env: CARGO_TERM_COLOR: always jobs: # Ask ship what CI consists of. Needs no cache: it compiles ship # and nothing of prov's. plan: name: Plan runs-on: ubuntu-latest outputs: jobs: ${{ steps.plan.outputs.jobs }} steps: - uses: actions/checkout@v7 - uses: dtolnay/rust-toolchain@stable - run: cargo install --locked --git https://github.com/diaryx-org/ship ship - id: plan run: echo "jobs=$(ship ci --matrix)" >> "$GITHUB_OUTPUT" # One runner per job in that table. `name` is the job's own, so these appear as # `CI / Format`, `CI / Clippy`, … — rename a job in ship.figl and the required # status check is renamed with it. run: name: ${{ matrix.job.name }} needs: plan runs-on: ubuntu-latest strategy: # One red job should not hide the state of the others. fail-fast: false matrix: job: ${{ fromJSON(needs.plan.outputs.jobs) }} steps: - uses: actions/checkout@v7 - uses: dtolnay/rust-toolchain@stable with: { components: "${{ matrix.job.components }}" } # A field a job's runner table leaves out is null here: no components, and # the cache set up unless the job says `builds = false`. - uses: Swatinem/rust-cache@v2 # A missing `builds` is null, and GitHub compares loosely, so `null != false` # is false: the test is for null itself. if: matrix.job.builds == null || matrix.job.builds - run: cargo install --locked --git https://github.com/diaryx-org/ship ship - run: ship ci ${{ matrix.job.id }}