Files
arr/Justfile
T
Miguel Palhas db9ae271cb fix(arr): make CI compile the translation backends
Every translation backend sits behind a default-off cargo feature, and the
gate ran with the default set, so clippy and the test run never saw a line
of arr-subs' openai, deepl or google modules. #191 and #192 each reported
it after verifying their own work by hand. lint and test now pass
--all-features.

Also drops a duplicated wiremock suppression the #188 merge left behind and
puts the module list back in order.
2026-08-25 01:05:50 +01:00

105 lines
3.6 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. `--all-features` matters: every subtitle
# translation backend sits behind a default-off cargo feature, so without it
# the gate never compiles a line of them (#191, #192).
lint:
cargo clippy --all-targets --all-features -- -D warnings
# Unused workspace dependencies. Stable toolchain, unlike cargo-udeps.
deps:
cargo machete
# Unit and integration tests, excluding the e2e crate. `--all-features` for
# the same reason `lint` needs it: the translation backends are feature-gated
# and would otherwise never run.
test:
cargo nextest run --workspace --exclude arr-e2e --all-features
# End-to-end tests. Needs a Transmission container (`just e2e-up`); not part
# of the push gate. Never point this at the production Transmission LXC.
e2e:
cargo nextest run -p arr-e2e
# Throwaway local Transmission for `just e2e`, mirroring the CI service.
e2e-up:
docker run --rm -d --name arr-e2e-transmission \
-e PUID=1000 -e PGID=1000 -p 9091:9091 \
linuxserver/transmission:latest
# Stop and discard the local Transmission container.
e2e-down:
docker stop arr-e2e-transmission
# 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
pnpm -C web install --frozen-lockfile
pnpm -C web exec biome ci .
pnpm -C web exec tsc -b --noEmit
pnpm -C web run check-tokens
# 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