hyperhive/.forgejo/workflows/ci.yml
atlas 54daf9ac60 ci: gate documentation pointers so a dead one fails the build
Pointing at a doc instead of duplicating its prose next to the code is what
the comment-block lint pushes people toward, and nothing checked that the
pointers still resolve. The reorg that prompted the preceding commit broke
41 references and every one of them merged green.

Two arms: repo-root-relative `docs/` paths, and relative markdown links
resolved against the linking file. Scope is every tracked file rather than a
type list — the dead references were in css, html and an ignore file as well
as in markdown and nix.

Three controls, because a link checker whose extractor quietly matches
nothing passes forever while checking nothing: each arm must have found
candidates, and at least one pointer must have resolved. Any of those failing
exits non-zero and says the script is broken rather than the tree.

Escape hatch is the `lint:allow` marker the tracker-tag lint already uses.
Its only current users are in reference-docs.nix, where a path naming a file
the derivation synthesizes into $out is correct precisely because the repo
does not have it.

Also runs in the pre-push hook alongside the other two.
2026-09-02 10:23:24 +02:00

69 lines
2.4 KiB
YAML

name: CI
on:
pull_request:
branches: ["**"]
# Lets `hive-forge ci-rerun` re-trigger CI via the workflow-dispatch API
# without an empty commit. No effect on the PR-triggered runs above.
workflow_dispatch:
jobs:
check:
name: nix flake check
runs-on: [hive-ci]
# Bound the job so a wedged build fails in minutes instead of
# hanging until the runner's 3h cap (or, when the runner itself
# deadlocks, never). 30 min is well above a cold-cache rebuild
# (~15 min observed) and well under the 3h hard cap — tune if a
# legit cold build ever trips it.
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- name: check
# Runs all flake checks: formatting (treefmt+rustfmt), cargo test,
# cargo clippy, and module evaluation. No --no-build: the checks
# derivations are the canonical source of truth.
run: nix flake check
tracker-tags:
name: tracker-tag lint
runs-on: [hive-ci]
# Pure git+grep — seconds normally; a few minutes is already a hang.
timeout-minutes: 5
steps:
- uses: actions/checkout@v3
- name: lint
# Flags hash-number tracker tags in source (hive convention is
# prose, not tags — /knowledge/hive-rules.md). Its own job, and
# IS a required check on the forge (branch protection) — a hit
# blocks merge. See scripts/check-issue-refs.sh.
run: sh scripts/check-issue-refs.sh
comment-blocks:
name: comment-block lint
runs-on: [hive-ci]
# Pure git+awk — seconds.
timeout-minutes: 5
steps:
- uses: actions/checkout@v3
- name: lint
# Flags contiguous comment blocks over 30 lines (a giant prose
# block belongs in docs/ as implementation notes, not in source).
# Own job, and IS a required check on the forge (branch
# protection) — a hit blocks merge. See
# scripts/check-comment-blocks.sh.
run: sh scripts/check-comment-blocks.sh
doc-refs:
name: doc-pointer lint
runs-on: [hive-ci]
# Pure git+grep — seconds.
timeout-minutes: 5
steps:
- uses: actions/checkout@v3
- name: lint
# Flags `docs/…md` paths and relative markdown links that no
# longer resolve. Pointing at a doc is what the comment-block
# lint above pushes people toward, so the pointers need a gate of
# their own. See scripts/check-doc-refs.sh.
run: sh scripts/check-doc-refs.sh