The document is collected from `#[utoipa::path]` annotations through `utoipa_axum::routes!`, which refuses a handler that has none, so an unannotated route fails the build rather than silently leaving the TypeScript client short an endpoint. Health probes the three upstreams DESIGN.md §9.5 calls "Broken", always answering 200 so a degraded service can still explain itself. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
89 lines
2.8 KiB
Makefile
89 lines
2.8 KiB
Makefile
# Dev entry points. `just` with no args lists them.
|
|
|
|
# The local development database. Committed offline query data (.sqlx) means
|
|
# neither CI nor a plain `cargo build` needs this to exist.
|
|
database_url := env_var_or_default("DATABASE_URL", "sqlite://dev.db")
|
|
|
|
# The full per-push gate, same as CI. Run this before pushing.
|
|
ci: fmt-check lint deps test web-check
|
|
|
|
# Formatting, checked not applied.
|
|
fmt-check:
|
|
cargo fmt --all -- --check
|
|
|
|
# Format every Rust source.
|
|
fmt:
|
|
cargo fmt --all
|
|
|
|
# Clippy, warnings denied.
|
|
lint:
|
|
cargo clippy --all-targets -- -D warnings
|
|
|
|
# Unused workspace dependencies. Stable toolchain, unlike cargo-udeps.
|
|
deps:
|
|
cargo machete
|
|
|
|
# Unit and integration tests, excluding the e2e crate.
|
|
test:
|
|
cargo nextest run --workspace --exclude arr-e2e
|
|
|
|
# End-to-end tests. Needs a Transmission container; not part of the push gate.
|
|
e2e:
|
|
cargo nextest run -p arr-e2e
|
|
|
|
# Frontend lint and typecheck. No-op until the SPA exists (issue #6). Probes
|
|
# for package.json, not the directory: `just gen-client` writes into web/ and
|
|
# must not turn the gate on before there is a project to check.
|
|
web-check:
|
|
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
if [ ! -f web/package.json ]; then echo "web/ not present yet, skipping"; exit 0; fi
|
|
biome ci web/
|
|
pnpm -C web install --frozen-lockfile
|
|
pnpm -C web exec tsc -b --noEmit
|
|
|
|
# Build the SPA and the binary that embeds it.
|
|
build:
|
|
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
if [ -f web/package.json ]; then
|
|
pnpm -C web install --frozen-lockfile
|
|
pnpm -C web build
|
|
fi
|
|
cargo build --release
|
|
|
|
# Regenerate the TypeScript client from the OpenAPI document (DESIGN.md §9.1).
|
|
# The document is dumped from the binary, so nothing has to be running. Both
|
|
# outputs are generated: never edit them, and never hand-write the spec.
|
|
gen-client:
|
|
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
mkdir -p web/src/api
|
|
cargo run --quiet -p arr-daemon --bin arr -- --openapi > web/src/api/openapi.json
|
|
pnpm dlx openapi-typescript@7 web/src/api/openapi.json -o web/src/api/schema.d.ts
|
|
|
|
# Recreate the development database from an empty file.
|
|
db-reset:
|
|
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
export DATABASE_URL="{{database_url}}"
|
|
sqlx database drop -y
|
|
sqlx database create
|
|
sqlx migrate run --source crates/arr-db/migrations
|
|
|
|
# Refresh the committed offline query data. Run after changing any query.
|
|
db-prepare: db-reset
|
|
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
export DATABASE_URL="{{database_url}}"
|
|
cargo sqlx prepare --workspace -- --all-targets
|
|
|
|
# Advisory and licence scan. Scheduled, not part of the push gate.
|
|
audit:
|
|
cargo deny check
|
|
|
|
# Install the tools the gate needs.
|
|
setup:
|
|
cargo install cargo-nextest cargo-machete --locked
|
|
cargo install sqlx-cli --no-default-features --features sqlite,rustls --locked
|