Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
149 changes: 149 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
# CI: fmt, clippy, tests, MSRV, docs, cargo-deny and codegen drift.
#
# The private gate: every job has `if: ${{ !github.event.repository.private }}`.
# While the repo is private (where Actions minutes cost money) each job is
# skipped, and a skipped job uses no minutes. The day the repo is made public
# the condition turns true and the jobs run, with no further commit.

name: CI

on:
push:
branches: [main]
pull_request:
workflow_dispatch:

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

env:
CARGO_TERM_COLOR: always
# The toolchain the crate is developed against (ccwire's).
RUST_TOOLCHAIN: "1.98.1"

jobs:
fmt:
name: rustfmt
if: ${{ !github.event.repository.private }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
# dtolnay/rust-toolchain master @ 2026-10-16; installs env.RUST_TOOLCHAIN (1.98.1)
- uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}
components: rustfmt
- run: cargo fmt --all --check

clippy:
name: clippy
if: ${{ !github.event.repository.private }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
# dtolnay/rust-toolchain master @ 2026-10-16; installs env.RUST_TOOLCHAIN (1.98.1)
- uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}
components: clippy
- uses: Swatinem/rust-cache@v2
- run: cargo clippy --all-targets -- -D warnings

test:
name: test
if: ${{ !github.event.repository.private }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
# dtolnay/rust-toolchain master @ 2026-10-16; installs env.RUST_TOOLCHAIN (1.98.1)
- uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}
- uses: Swatinem/rust-cache@v2
# Includes tests/corpus.rs (recorded app-server output) and
# tests/spawn.rs (the fake codex, tests/fake_codex: python3, which the
# runner has).
- run: cargo test --all-targets --locked
# The README's example, compiled (lib.rs includes the README).
- run: cargo test --doc --locked

check-codegen:
name: codegen drift
if: ${{ !github.event.repository.private }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
# dtolnay/rust-toolchain master @ 2026-10-16; installs env.RUST_TOOLCHAIN (1.98.1)
- uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}
components: rustfmt
# Offline: regenerates src/protocol.rs from schema/ (python3 and
# rustfmt) and fails if it differs from the committed one.
- run: scripts/check-codegen

msrv:
name: MSRV
if: ${{ !github.event.repository.private }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Read rust-version from Cargo.toml
id: msrv
run: |
if grep -Eq '^rust-version\.workspace|^rust-version *= *\{' Cargo.toml; then
echo "::error::Cargo.toml inherits rust-version from a workspace; this repo needs an explicit rust-version = \"x.y\""
exit 1
fi
msrv=$(sed -n 's/^rust-version *= *"\(.*\)"/\1/p' Cargo.toml)
if [ -z "$msrv" ]; then
echo "::error::no rust-version = \"...\" in Cargo.toml"
exit 1
fi
echo "MSRV: $msrv"
echo "version=$msrv" >> "$GITHUB_OUTPUT"
# Re-resolve Cargo.lock with a current cargo, whose rust-version-aware
# resolver (resolver 3, edition 2024) picks dependency versions that
# still build on the MSRV.
# dtolnay/rust-toolchain master @ 2026-10-16; installs env.RUST_TOOLCHAIN (1.98.1)
- uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}
- run: cargo generate-lockfile
# dtolnay/rust-toolchain master @ 2026-10-16; installs the MSRV (rust-version)
- uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8
with:
toolchain: ${{ steps.msrv.outputs.version }}
- uses: Swatinem/rust-cache@v2
- run: cargo +${{ steps.msrv.outputs.version }} build --locked

doc:
name: docs
if: ${{ !github.event.repository.private }}
runs-on: ubuntu-latest
env:
RUSTDOCFLAGS: -D warnings
steps:
- uses: actions/checkout@v7
# dtolnay/rust-toolchain master @ 2026-10-16; installs env.RUST_TOOLCHAIN (1.98.1)
- uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}
- uses: Swatinem/rust-cache@v2
- run: cargo doc --no-deps

deny:
name: cargo-deny
if: ${{ !github.event.repository.private }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
# Licenses (permissive only), advisories, bans and sources: see
# deny.toml.
- uses: EmbarkStudios/cargo-deny-action@v2
with:
command: check
Loading