From d51dcb1ac33e7562c1dc9125d1f885102f34be5a Mon Sep 17 00:00:00 2001 From: Moritz Date: Tue, 2 Jun 2026 23:35:39 +0200 Subject: [PATCH] chore(ci): make test workflow faster with test --stale --- Justfile | 26 ++++++++++++++++++++------ config/test.exs | 4 ++++ 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/Justfile b/Justfile index 54c395f..d08cef8 100644 --- a/Justfile +++ b/Justfile @@ -29,7 +29,12 @@ seed-database: start-database: docker compose up -d -ci-dev: lint audit test-fast +# Full check suite: lint + audit + the fast tests (slow/ui excluded). No Dialyzer. +ci-dev: install-dependencies lint audit test-fast + +# Fast pre-commit check: lint + sobelow + only the affected tests (mix test --stale) +# with reduced property runs. Run the full `ci-dev` before pushing. +check: install-dependencies lint sobelow test-stale # Build the Dialyzer PLT. Idempotent — no-op once the PLT is up to date. # First build takes 5–15 min; subsequent runs are seconds. PLT files live in @@ -58,19 +63,28 @@ lint: @bash -c 'for file in priv/gettext/de/LC_MESSAGES/*.po; do awk "/^msgid \"\"$/{header=1; next} /^msgid /{header=0} /^msgstr \"\"$/ && !header{print FILENAME\":\"NR\": \" \$0; exit 1}" "$file" || exit 1; done' mix gettext.extract --check-up-to-date -audit: +# Static security scan (Sobelow). +sobelow: mix sobelow --config + +# Full security audit: Sobelow + dependency advisory scans. +audit: sobelow mix deps.audit --ignore-file .deps_audit_ignore mix hex.audit -# Run all tests -test *args: install-dependencies +# Run all tests. No install-dependencies prerequisite so single-file runs stay +# fast; run `just install-dependencies` once on a fresh checkout. +test *args: mix test {{args}} -# Run only fast tests (excludes slow/performance and UI tests) -test-fast *args: install-dependencies +# Fast tests only (excludes slow/performance and UI tests). +test-fast *args: mix test --exclude slow --exclude ui {{args}} +# Affected fast tests only (mix test --stale) with reduced property runs. +test-stale *args: + PROPERTY_RUNS=25 mix test --stale --exclude slow --exclude ui {{args}} + # Run only UI tests ui *args: install-dependencies mix test --only ui {{args}} diff --git a/config/test.exs b/config/test.exs index ef54982..7343a6a 100644 --- a/config/test.exs +++ b/config/test.exs @@ -62,3 +62,7 @@ config :mv, :join_rate_limit, scale_ms: 60_000, limit: 2 # Ash: silence "after_transaction hooks in surrounding transaction" warning when using # Ecto sandbox (tests run in a transaction; create_member after_transaction is expected). config :ash, warn_on_transaction_hooks?: false + +# StreamData property tests: generated cases per property, overridable via PROPERTY_RUNS +# (the `just check` recipe sets it low for speed; default 100 otherwise). +config :stream_data, max_runs: String.to_integer(System.get_env("PROPERTY_RUNS") || "100")