Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
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
20 changes: 20 additions & 0 deletions .cargo/mutants.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# The oracle, the analytic properties and the lightning overlay all live behind
# `png`, and they are the tests that actually assert on rendered output. Without
# this a mutant only has to survive the unit tests, which is the coverage theatre
# `.claude/rules/determinism.md` warns about.
additional_cargo_test_args = ["--features", "png"]

# Same runner as `just test` and CI, so a survivor here is reproducible there.
test_tool = "nextest"

# A golden render is ~0.5s and the suite is ~0.6s, so the default 20s floor would
# let a mutant that merely makes the renderer slow read as a timeout rather than a
# caught mutant. 60s is well clear of a real run and still catches an infinite loop.
minimum_test_timeout = 60

exclude_globs = [
# Location-gated easter egg. Nothing can reach it without pinning the clock to
# a 42-minute window over one Hong Kong district, so every mutant in it would
# survive and bury the signal from code that is genuinely under test.
"src/pigs.rs",
]
6 changes: 6 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# tests/oracle.rs hashes scenes/*.toml byte for byte, and Windows checks text files
# out as CRLF by default, so a Windows clone changes those bytes and fails
# scene_sha256 while rendering pixel-identical output. Pinning the working tree to LF
# everywhere keeps one hash true on every platform. The goldens under tests/goldens/
# are detected as binary by text=auto and are left alone.
* text=auto eol=lf
82 changes: 82 additions & 0 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
{
$schema: "https://docs.renovatebot.com/renovate-schema.json",

extends: ["config:recommended"],

timezone: "Europe/Berlin",
schedule: ["before 7am on monday"],
labels: ["dependencies"],
prConcurrentLimit: 3,
// A crates.io release cannot be unpublished, but it can be yanked. Waiting three
// days means a bad release is usually already yanked before a PR opens for it.
minimumReleaseAge: "3 days",
separateMinorPatch: true,

// Installs the toolchain Renovate runs `cargo update` with, and is the baseline for
// constraintsFiltering. "1.88" is a range in rust-release-channel versioning, so the
// tool resolver picks the newest 1.88.x rather than failing to parse a single version.
constraints: {
rust: "1.88",
},
constraintsFiltering: "strict",

packageRules: [
{
// The MSRV gate, in the only shape that works. Release filtering compares under
// cargo versioning, where a bare "1.88" means ^1.88, and a crate spelling its MSRV
// with three components ("1.90.0", which is what ratatui and image do) is then a
// valid semver version that satisfies ^1.88, so it slips through. "~1.88" is
// >=1.88.0 <1.89.0, which makes subset() the deciding check: [1.88, 1.89) sits
// inside ^1.85 so a crate needing 1.85 stays eligible, and does not sit inside
// ^1.90 so that one is dropped.
//
// The config validator warns that "~1.88" is not a valid rust-release-channel
// version. That is expected: it validates every constraints.rust against the
// toolchain versioning even when the rule is scoped to the crate datasource. The
// warning is the price of the filter working on three-component MSRVs. Reverting
// to "1.88" silences it and reopens the hole.
//
// Crates that declare no rust-version at all are never filtered, so the msrv job
// in ci.yml stays the hard gate; this only keeps doomed PRs from being opened.
matchDatasources: ["crate"],
constraints: {
rust: "~1.88",
},
},
{
// Both of these are the 1.88 floor itself, not dependencies to keep current.
// Renovate reads its own config with the renovate-config manager and offered to
// move constraints.rust to 1.98; the msrv job's toolchain is the same trap from
// the other side. The floor moves by hand, together with rust-version in
// Cargo.toml, or not at all.
matchManagers: ["renovate-config", "github-actions"],
matchPackageNames: ["rust", "dtolnay/rust-toolchain"],
enabled: false,
},
{
// Cargo.toml carries loose ranges, so patch updates land in Cargo.lock alone and
// there is nothing to review one crate at a time.
matchManagers: ["cargo"],
matchUpdateTypes: ["patch"],
groupName: "cargo patch updates",
},
{
matchManagers: ["github-actions"],
groupName: "github actions",
},
{
// ratatui and crossterm are 0.x, so a minor bump is a breaking one, and it moves
// the pinned floor in Cargo.toml rather than only the lockfile.
matchManagers: ["cargo"],
matchUpdateTypes: ["minor", "major"],
groupName: null,
labels: ["dependencies", "needs-review"],
},
],

// Refreshes transitive dependencies that no direct requirement pulls forward.
lockFileMaintenance: {
enabled: true,
schedule: ["before 7am on the first day of the month"],
},
}
78 changes: 70 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,27 @@ name: CI

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

permissions:
contents: read

concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
name: fmt + clippy + test
runs-on: ubuntu-latest
timeout-minutes: 30

steps:
- uses: actions/checkout@v7
with:
persist-credentials: false

- uses: dtolnay/rust-toolchain@stable
with:
Expand All @@ -26,32 +34,77 @@ jobs:
run: cargo fmt --check

- name: clippy (default features)
run: cargo clippy --all-targets -- -D warnings
run: cargo clippy --locked --all-targets -- -D warnings

- name: clippy (png feature)
run: cargo clippy --all-targets --features png -- -D warnings
run: cargo clippy --locked --all-targets --features png -- -D warnings

- name: clippy (celsius-lab)
run: cargo clippy -p celsius-lab --all-targets -- -D warnings
run: cargo clippy --locked -p celsius-lab --all-targets -- -D warnings

- name: doc
run: cargo doc --locked --no-deps --features png

- uses: taiki-e/install-action@v2
with:
tool: nextest

- name: test
run: cargo nextest run --features png
- name: test (default features)
run: cargo nextest run --locked

- name: test (png feature)
run: cargo nextest run --locked --features png

- name: test (celsius-lab)
run: cargo nextest run -p celsius-lab
run: cargo nextest run --locked -p celsius-lab

- name: bench (compile + smoke)
run: cargo bench --bench render -- --test
run: cargo bench --locked --bench render -- --test

cross:
name: test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-latest]

steps:
- uses: actions/checkout@v7
with:
persist-credentials: false

- uses: dtolnay/rust-toolchain@stable
with:
components: clippy

- uses: Swatinem/rust-cache@v2

- name: clippy (png feature)
run: cargo clippy --locked --all-targets --features png -- -D warnings

- uses: taiki-e/install-action@v2
with:
tool: nextest

- name: test (default features)
run: cargo nextest run --locked

- name: test (png feature)
run: cargo nextest run --locked --features png

- name: test (celsius-lab)
run: cargo nextest run --locked -p celsius-lab

msrv:
name: msrv (1.88.0)
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- uses: dtolnay/rust-toolchain@1.88.0
- uses: Swatinem/rust-cache@v2
- run: cargo check --locked
Expand All @@ -60,8 +113,11 @@ jobs:
deny:
name: cargo deny (advisories + licences + sources + bans)
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- uses: taiki-e/install-action@v2
with:
tool: cargo-deny
Expand All @@ -70,8 +126,14 @@ jobs:
zizmor:
name: zizmor (Actions security)
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v7
- run: pipx run zizmor==1.28.0 --min-severity high .github/workflows/
with:
persist-credentials: false
- uses: taiki-e/install-action@v2
with:
tool: zizmor@1.28.0
- run: zizmor --min-severity high .github/workflows/
env:
GH_TOKEN: ${{ github.token }}
2 changes: 2 additions & 0 deletions .github/workflows/codspeed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false

- uses: dtolnay/rust-toolchain@stable

Expand Down
59 changes: 59 additions & 0 deletions .github/workflows/mutants.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: mutants

on:
pull_request:
branches: [main]
paths:
- "src/**"
- "tests/**"
- "Cargo.toml"
- "Cargo.lock"
- ".cargo/mutants.toml"
- ".github/workflows/mutants.yml"
workflow_dispatch:

permissions:
contents: read

concurrency:
group: mutants-${{ github.ref }}
cancel-in-progress: true

jobs:
in-diff:
name: surviving mutants in the diff
runs-on: ubuntu-latest
timeout-minutes: 45
continue-on-error: true
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
persist-credentials: false

- uses: dtolnay/rust-toolchain@stable

- uses: Swatinem/rust-cache@v2

- uses: taiki-e/install-action@v2
with:
tool: cargo-mutants,nextest

- name: diff against the merge base
env:
BASE_REF: ${{ github.base_ref }}
run: |
set -euo pipefail
git fetch --no-tags origin "$BASE_REF"
git diff "$(git merge-base HEAD "origin/$BASE_REF")" HEAD -- src tests > mutants.diff
wc -l < mutants.diff

- name: mutants
run: cargo mutants --no-shuffle --in-place -vV --in-diff mutants.diff

- uses: actions/upload-artifact@v7
if: always()
with:
name: mutants-in-diff
path: mutants.out
if-no-files-found: ignore
42 changes: 31 additions & 11 deletions .github/workflows/release-plz.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,53 @@ on:
branches: [main]

permissions:
contents: write
pull-requests: write
contents: read

jobs:
release-plz:
name: release-plz
release-plz-release:
name: release-plz release
runs-on: ubuntu-latest
concurrency:
group: release-plz-${{ github.ref }}
cancel-in-progress: false
timeout-minutes: 30
permissions:
contents: write
pull-requests: read
id-token: write
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
persist-credentials: false

- uses: dtolnay/rust-toolchain@stable

- uses: release-plz/action@v0.5
with:
command: release-pr
command: release
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_PLZ_TOKEN }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

release-plz-pr:
name: release-plz PR
runs-on: ubuntu-latest
timeout-minutes: 30
needs: release-plz-release
if: ${{ !cancelled() }}
permissions:
contents: write
pull-requests: write
concurrency:
group: release-plz-${{ github.ref }}
cancel-in-progress: false
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
persist-credentials: false

- uses: dtolnay/rust-toolchain@stable

- uses: release-plz/action@v0.5
with:
command: release
command: release-pr
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_PLZ_TOKEN }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
Loading
Loading