Skip to content

Commit b82ca27

Browse files
committed
Merge #161: Add: cargo-semver-checks
Approved-by: ReinierMaas Priority: Normal Auto-deploy: false
2 parents 061656c + 3d88581 commit b82ca27

5 files changed

Lines changed: 33 additions & 22 deletions

File tree

‎.github/actions/setup-nix-direnv-rust/action.yml‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ description: Checks out the git repo and sets up Nix, Direnv and Rust, with appr
33
runs:
44
using: "composite"
55
steps:
6-
- uses: nixbuild/nix-quick-install-action@8505cd40ae3d4791ca658f2697c5767212e5ce71 # v30
7-
- uses: nix-community/cache-nix-action@135667ec418502fa5a3598af6fb9eb733888ce6a # v6
6+
- uses: nixbuild/nix-quick-install-action@9f63be77f412a248c9d9a65a4c82cf066cdf8f0c # Latest as of 2026-07-31
7+
- uses: nix-community/cache-nix-action@7df957e333c1e5da7721f60227dbba6d06080569 # Latest as of 2026-07-31
88
with:
99
# restore and save a cache using this key
1010
primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix', 'nix/sources.json', 'rust-toolchain.toml') }}
1111
# if there's no cache hit, restore a cache by this prefix
1212
restore-prefixes-first-match: nix-${{ runner.os }}-
13-
- uses: HatsuneMiku3939/direnv-action@89ed6f6786c25aa7a69cd12f9fd0fdcb46c7c489 # Latest as of 2025-05-16
14-
- uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # v2.7.8
13+
- uses: HatsuneMiku3939/direnv-action@c81e6f10d47895cdd46432d8801bff0fabc73a6b # Latest as of 2026-07-31
14+
- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # Latest as of 2026-07-31
1515
with:
1616
cache-all-crates: "true"

‎.github/workflows/ci.yml‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,28 @@
11
name: Continuous Integration
2-
on: [push]
2+
"on": [push]
33
jobs:
44
test-unit:
55
name: Unit tests
66
runs-on: ubuntu-latest
77
steps:
8-
- uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98
8+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # Latest as of 2026-07-31
99
- uses: ./.github/actions/setup-nix-direnv-rust
1010
- run: just test-unit
1111
test-integration:
1212
name: Integration test (& build all in dev-mode)
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98
15+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # Latest as of 2026-07-31
1616
- uses: ./.github/actions/setup-nix-direnv-rust
1717
- run: OPSQUEUE_PYTEST_TIMEOUT=600 just test-integration
1818
lint:
1919
name: Lint & Style Check
2020
runs-on: ubuntu-latest
2121
steps:
22-
- uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98
22+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # Latest as of 2026-07-31
23+
with:
24+
# We need tags for the `just semver` check, which is part of `just lint`, so we fetch them here.
25+
fetch-tags: "true"
2326
- uses: ./.github/actions/setup-nix-direnv-rust
2427
- run: |
25-
just lint-light --show-diff-on-failure --all
26-
just lint-heavy
28+
just lint

‎.semaphore/semaphore.yml‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,5 +86,4 @@ blocks:
8686
jobs:
8787
- name: "Type- and format-check"
8888
commands:
89-
- "just lint-light --show-diff-on-failure --all"
90-
- "just lint-heavy"
89+
- "just lint"

‎default.nix‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,10 @@ let
4747
# Rust build tools
4848
pkgs.cargo-audit
4949
pkgs.cargo-edit
50-
pkgs.cargo-insta
5150
pkgs.cargo-hakari
51+
pkgs.cargo-insta
5252
pkgs.cargo-nextest
53+
pkgs.cargo-semver-checks
5354
pkgs.maturin
5455

5556
# Resolve native sqlite from Nix for libsqlite3-sys

‎justfile‎

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ bench-chunks-select:
8787
8888
# Run all linters, fast and slow
8989
[group('lint')]
90-
lint: (lint-light "--all-files") lint-heavy
90+
lint: (lint-light "--show-diff-on-failure" "--all-files") lint-heavy
9191

9292
# Run only the fast per-file linters; these might opt to only look at the changed files. Args are passed to pre-commit
9393
[group('lint')]
@@ -97,16 +97,16 @@ lint-light *ARGS:
9797
# Run the slow linters/static analysers that need to look at everything
9898
[group('lint')]
9999
[parallel]
100-
lint-heavy: clippy-fix lint-cargo mypy
100+
lint-heavy: semver clippy-fix lint-cargo mypy
101101

102-
# Serial execution on the main `CARGO_TARGET_DIR`
103-
[group('lint')]
104-
lint-cargo: clippy hakari
105-
106-
# Verify the workspace-hack crate is up to date
102+
# Verify the semver bounds are respected since the last tagged build
107103
[group('lint')]
108-
hakari:
109-
cargo hakari verify
104+
semver:
105+
#!/usr/bin/env bash
106+
set -euo pipefail
107+
export DATABASE_URL="sqlite://{{justfile_directory()}}/opsqueue/opsqueue_example_database_schema.db"
108+
# We select the latest git tag, not to be confused with the latest Cargo version.
109+
cargo semver-checks --workspace --target x86_64-unknown-linux-gnu --baseline-rev "$(git tag -l --sort=-version:refname | head -1)"
110110
111111
# Rust static analysis
112112
[group('lint')]
@@ -116,6 +116,15 @@ clippy-fix:
116116
CARGO_TARGET_DIR=target/clippy-fix cargo clippy --no-deps --all-targets --no-default-features --fix --allow-dirty --allow-staged -- -Dwarnings
117117
CARGO_TARGET_DIR=target/clippy-fix cargo clippy --no-deps --all-targets --all-features --fix --allow-dirty --allow-staged -- -Dwarnings
118118

119+
# Serial execution on the main `CARGO_TARGET_DIR`
120+
[group('lint')]
121+
lint-cargo: clippy hakari
122+
123+
# Verify the workspace-hack crate is up to date
124+
[group('lint')]
125+
hakari:
126+
cargo hakari verify
127+
119128
# Rust static analysis
120129
[group('lint')]
121130
clippy:

0 commit comments

Comments
 (0)