Files
netris-nestri/.github/workflows/ci.yml
Wanjohi c89680ba47 ci(nesdoctor): build and smoke-test the release binaries on tag
release-nesdoctor.yml
  Four targets on tag `nesdoctor-v*`: x86_64 linux-musl, x86_64 windows-msvc,
  aarch64 and x86_64 macOS. musl rather than glibc so one Linux binary runs on
  every distro regardless of glibc version. SHA256SUMS beside the binaries,
  because "download this and run it" is only a reasonable request if the file
  can be verified. `fail-fast: false` -- a Windows failure should still leave
  the Linux binary available to look at.

  Built here and nowhere else: a binary somebody produced on their laptop and
  uploaded is not auditable however honest they are.

  The step that justifies the workflow is the smoke test, which runs the
  binary it just built, network included. `ring` under rustls resolves root
  certificates through the host trust store, so a static musl build can compile
  cleanly and then fail TLS on the machine it ships to -- breaking the network
  test, the one feature anybody runs this for, silently and only for other
  people. The step fails the build if the summary line comes back
  `net=unmeasured`.

  A manual dispatch builds and smoke-tests without publishing, which is what
  you want while iterating.

ci.yml
  A `nesdoctor` job: fmt, clippy -D warnings, test, and one real run. Scoped to
  the one member deliberately -- the rest of the Rust half has never been under
  CI, so `--workspace` would turn every PR red for unrelated reasons. Widen it
  one member at a time as each is made to pass.

Two bugs the new gates found immediately, both of which shipped in the previous
commit:
  - `--quiet` printed the whole questionnaire before its summary line, which
    breaks the one thing `--quiet` promises. Prompts are now skipped when
    stdout is quiet or stdin is not a terminal -- and a pipe is explicitly not
    treated as consent to read somebody's Steam library, unlike `--yes`.
  - clippy: an `if` with identical branches in the KVM check, two map
    iterations taking keys they discarded, a manual `split_once`, and a
    `sort_by` that wanted `sort_by_key`. `needless_return` is allowed in
    `sys.rs` with the reason stated: every probe there is a stack of
    cfg-gated returns and the trailing `return` in each arm is load-bearing.
2026-09-02 00:15:22 +03:00

65 lines
2.0 KiB
YAML

name: CI
on:
push:
branches: [main]
pull_request:
jobs:
web:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:18-alpine
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: nestri
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U postgres"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3.11
- name: Install
run: bun install --frozen-lockfile
- name: Push migrations
run: bun run db:push
env:
DATABASE_URL: postgres://postgres:postgres@localhost:5432/nestri
- name: Test
run: bun test
env:
TEST_DATABASE_URL: postgres://postgres:postgres@localhost:5432/nestri
# Scoped to `nesdoctor` deliberately. The rest of the Rust half has never
# been under CI, so widening this to `--workspace` would turn every PR red
# for reasons unrelated to the PR. Widen it one member at a time, as each is
# made to pass.
nesdoctor:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Rust toolchain
run: rustup toolchain install stable --profile minimal --component clippy,rustfmt --no-self-update
- uses: Swatinem/rust-cache@v2
with:
workspaces: ". -> target"
- name: Format
run: cargo fmt -p nesdoctor -- --check
- name: Clippy
run: cargo clippy -p nesdoctor --all-targets -- -D warnings
- name: Test
run: cargo test -p nesdoctor
# Runs without touching the network, so this stays fast and cannot fail
# on a runner's egress rules. The network path is exercised by the
# release workflow's smoke test, where it belongs.
- name: Runs at all
run: cargo run -p nesdoctor -- --quiet --no-net --no-steam --json "$RUNNER_TEMP/nd.json" < /dev/null