From dfd9deeb4a1a5c23ce71f601a6f2e1e11b869daa Mon Sep 17 00:00:00 2001 From: Reinier Maas Date: Thu, 30 Jul 2026 18:44:39 +0200 Subject: [PATCH 1/3] Add: cargo-semver-checks This should prevent us from making semver incompatible changes without a required version bump. --- default.nix | 3 ++- justfile | 24 ++++++++++++++++-------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/default.nix b/default.nix index ef1e7ae..69555da 100644 --- a/default.nix +++ b/default.nix @@ -47,9 +47,10 @@ let # Rust build tools pkgs.cargo-audit pkgs.cargo-edit - pkgs.cargo-insta pkgs.cargo-hakari + pkgs.cargo-insta pkgs.cargo-nextest + pkgs.cargo-semver-checks pkgs.maturin # Resolve native sqlite from Nix for libsqlite3-sys diff --git a/justfile b/justfile index 9b9dd67..5a225cf 100644 --- a/justfile +++ b/justfile @@ -87,16 +87,15 @@ lint-light *ARGS: # Run the slow linters/static analysers that need to look at everything [group('lint')] [parallel] -lint-heavy: clippy-fix lint-cargo mypy +lint-heavy: semver clippy-fix lint-cargo mypy -# Serial execution on the main `CARGO_TARGET_DIR` -[group('lint')] -lint-cargo: clippy hakari - -# Verify the workspace-hack crate is up to date +# Verify the semver bounds are respected since the last tagged build [group('lint')] -hakari: - cargo hakari verify +semver: + #!/usr/bin/env bash + set -euo pipefail + export DATABASE_URL="sqlite://{{justfile_directory()}}/opsqueue/opsqueue_example_database_schema.db" + cargo semver-checks --workspace --target x86_64-unknown-linux-gnu --baseline-rev "$(git tag -l --sort=-version:refname | head -1)" # Rust static analysis [group('lint')] @@ -106,6 +105,15 @@ clippy-fix: CARGO_TARGET_DIR=target/clippy-fix cargo clippy --no-deps --all-targets --no-default-features --fix --allow-dirty --allow-staged -- -Dwarnings CARGO_TARGET_DIR=target/clippy-fix cargo clippy --no-deps --all-targets --all-features --fix --allow-dirty --allow-staged -- -Dwarnings +# Serial execution on the main `CARGO_TARGET_DIR` +[group('lint')] +lint-cargo: clippy hakari + +# Verify the workspace-hack crate is up to date +[group('lint')] +hakari: + cargo hakari verify + # Rust static analysis [group('lint')] clippy: From d1cd78968eb29b05aaf17918ddaf81c2878a10cf Mon Sep 17 00:00:00 2001 From: Reinier Maas Date: Fri, 31 Jul 2026 10:53:26 +0200 Subject: [PATCH 2/3] CI: Use `just lint` --- .github/workflows/ci.yml | 3 +-- .semaphore/semaphore.yml | 3 +-- justfile | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ef0db1a..8bc0354 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,5 +22,4 @@ jobs: - uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98 - uses: ./.github/actions/setup-nix-direnv-rust - run: | - just lint-light --show-diff-on-failure --all - just lint-heavy + just lint diff --git a/.semaphore/semaphore.yml b/.semaphore/semaphore.yml index 435cd52..4571374 100644 --- a/.semaphore/semaphore.yml +++ b/.semaphore/semaphore.yml @@ -86,5 +86,4 @@ blocks: jobs: - name: "Type- and format-check" commands: - - "just lint-light --show-diff-on-failure --all" - - "just lint-heavy" + - "just lint" diff --git a/justfile b/justfile index 5a225cf..a3b312d 100644 --- a/justfile +++ b/justfile @@ -77,7 +77,7 @@ nix-test-integration *TEST_ARGS: nix-build # Run all linters, fast and slow [group('lint')] -lint: (lint-light "--all-files") lint-heavy +lint: (lint-light "--show-diff-on-failure" "--all-files") lint-heavy # Run only the fast per-file linters; these might opt to only look at the changed files. Args are passed to pre-commit [group('lint')] From 46a5312c2755fa73fada3f1ee1ecc8c0c300ede3 Mon Sep 17 00:00:00 2001 From: Reinier Maas Date: Fri, 31 Jul 2026 13:37:05 +0200 Subject: [PATCH 3/3] CI: Bump actions to support `fetch-tags` --- .github/actions/setup-nix-direnv-rust/action.yml | 8 ++++---- .github/workflows/ci.yml | 10 ++++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/actions/setup-nix-direnv-rust/action.yml b/.github/actions/setup-nix-direnv-rust/action.yml index e251361..8911641 100644 --- a/.github/actions/setup-nix-direnv-rust/action.yml +++ b/.github/actions/setup-nix-direnv-rust/action.yml @@ -3,14 +3,14 @@ description: Checks out the git repo and sets up Nix, Direnv and Rust, with appr runs: using: "composite" steps: - - uses: nixbuild/nix-quick-install-action@8505cd40ae3d4791ca658f2697c5767212e5ce71 # v30 - - uses: nix-community/cache-nix-action@135667ec418502fa5a3598af6fb9eb733888ce6a # v6 + - uses: nixbuild/nix-quick-install-action@9f63be77f412a248c9d9a65a4c82cf066cdf8f0c # Latest as of 2026-07-31 + - uses: nix-community/cache-nix-action@7df957e333c1e5da7721f60227dbba6d06080569 # Latest as of 2026-07-31 with: # restore and save a cache using this key primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix', 'nix/sources.json', 'rust-toolchain.toml') }} # if there's no cache hit, restore a cache by this prefix restore-prefixes-first-match: nix-${{ runner.os }}- - - uses: HatsuneMiku3939/direnv-action@89ed6f6786c25aa7a69cd12f9fd0fdcb46c7c489 # Latest as of 2025-05-16 - - uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # v2.7.8 + - uses: HatsuneMiku3939/direnv-action@c81e6f10d47895cdd46432d8801bff0fabc73a6b # Latest as of 2026-07-31 + - uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # Latest as of 2026-07-31 with: cache-all-crates: "true" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8bc0354..76fa112 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,25 +1,27 @@ name: Continuous Integration -on: [push] +"on": [push] jobs: test-unit: name: Unit tests runs-on: ubuntu-latest steps: - - uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # Latest as of 2026-07-31 - uses: ./.github/actions/setup-nix-direnv-rust - run: just test-unit test-integration: name: Integration test (& build all in dev-mode) runs-on: ubuntu-latest steps: - - uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # Latest as of 2026-07-31 - uses: ./.github/actions/setup-nix-direnv-rust - run: OPSQUEUE_PYTEST_TIMEOUT=600 just test-integration lint: name: Lint & Style Check runs-on: ubuntu-latest steps: - - uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # Latest as of 2026-07-31 + with: + fetch-tags: "true" - uses: ./.github/actions/setup-nix-direnv-rust - run: | just lint