77 lines
2.2 KiB
Makefile
77 lines
2.2 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 web/ exists (issue #6).
|
|
web-check:
|
|
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
if [ ! -d web ]; 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 [ -d web ]; then
|
|
pnpm -C web install --frozen-lockfile
|
|
pnpm -C web build
|
|
fi
|
|
cargo build --release
|
|
|
|
# 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
|