Skip to content

Commit 0333b9f

Browse files
committed
feat: clippy check in build
1 parent b74fc55 commit 0333b9f

4 files changed

Lines changed: 59 additions & 3 deletions

File tree

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ jobs:
9090
name: "Quick Check (workspace clippy)"
9191
runs-on: self-hosted
9292
timeout-minutes: 30
93-
needs: pre-commit-checks
93+
needs: warm-nix-cache
9494
steps:
9595
- name: checkout
9696
uses: actions/checkout@v5
@@ -101,7 +101,7 @@ jobs:
101101
useDaemon: false
102102
continue-on-error: true
103103
- name: Run workspace clippy
104-
run: nix develop -i -L .#stable --command cargo clippy --workspace --all-targets -- -D warnings
104+
run: nix build -L .#checks.x86_64-linux.workspace-clippy-all-targets
105105

106106
# Discover CI check groups from flake - single source of truth
107107
discover_ci_groups:
@@ -120,7 +120,7 @@ jobs:
120120
id: groups
121121
run: |
122122
examples=$(nix eval .#checks.x86_64-linux --apply 'attrs: builtins.filter (n: builtins.substring 0 8 n == "example-") (builtins.attrNames attrs)' --json)
123-
checks=$(nix eval .#checks.x86_64-linux --apply 'attrs: builtins.filter (n: n != "pre-commit-check" && n != "doc-tests" && n != "strict-docs" && n != "ffi-tests" && builtins.substring 0 8 n != "example-" && builtins.substring 0 5 n != "msrv-" && builtins.substring 0 5 n != "wasm-") (builtins.attrNames attrs)' --json)
123+
checks=$(nix eval .#checks.x86_64-linux --apply 'attrs: builtins.filter (n: n != "pre-commit-check" && n != "workspace-clippy-all-targets" && n != "doc-tests" && n != "strict-docs" && n != "ffi-tests" && builtins.substring 0 8 n != "example-" && builtins.substring 0 5 n != "msrv-" && builtins.substring 0 5 n != "wasm-") (builtins.attrNames attrs)' --json)
124124
msrv_checks=$(nix eval .#checks.x86_64-linux --apply 'attrs: builtins.filter (n: builtins.substring 0 5 n == "msrv-") (builtins.attrNames attrs)' --json)
125125
wasm_checks=$(nix eval .#checks.x86_64-linux --apply 'attrs: builtins.filter (n: builtins.substring 0 5 n == "wasm-") (builtins.attrNames attrs)' --json)
126126
{

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ build
1313
config.toml
1414
.pre-commit-config.yaml
1515
result
16+
result-*
1617
static-bin/
1718
.aider*
1819
**/postgres_data/

flake.nix

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@
218218
./Cargo.toml
219219
./Cargo.lock
220220
./Cargo.lock.msrv
221+
./clippy.toml
221222
./.typos.toml
222223
./rustfmt.toml
223224
./README.md
@@ -238,6 +239,7 @@
238239
lib.fileset.unions [
239240
./Cargo.toml
240241
./Cargo.lock.msrv
242+
./clippy.toml
241243
./.typos.toml
242244
./rustfmt.toml
243245
./README.md
@@ -493,6 +495,19 @@
493495
}
494496
);
495497

498+
# Workspace-wide clippy check for all targets. This preserves the quick
499+
# check coverage while reusing the warmed Crane dependency derivation.
500+
workspaceClippyAllTargets = craneLib.mkCargoDerivation (
501+
commonCraneArgs
502+
// {
503+
pname = "cdk-workspace-clippy-all-targets";
504+
cargoArtifacts = workspaceDeps;
505+
buildPhaseCargoCommand = "cargo clippy --workspace --all-targets -- -D warnings";
506+
doCheck = false;
507+
installPhaseCommand = "mkdir -p $out";
508+
}
509+
);
510+
496511
# Strict docs check - build docs with warnings as errors
497512
# Uses mkCargoDerivation for custom RUSTDOCFLAGS
498513
strictDocs = craneLib.mkCargoDerivation (
@@ -844,6 +859,8 @@
844859
git
845860
pkg-config
846861
curl
862+
cachix
863+
jq
847864
just
848865
protobuf
849866
nixpkgs-fmt
@@ -1303,6 +1320,9 @@
13031320
exampleChecks
13041321
))
13051322
// {
1323+
# Workspace-wide all-targets clippy check
1324+
workspace-clippy-all-targets = workspaceClippyAllTargets;
1325+
13061326
# Doc tests
13071327
doc-tests = docTests;
13081328

justfile

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,41 @@ build-static-all: (build-static "cdk-mintd-static") (build-static "cdk-mintd-ldk
5858
echo "Checksums:"
5959
cat SHA256SUMS
6060
61+
# Build the CI cache warmup targets locally.
62+
ci-cache-build:
63+
#!/usr/bin/env bash
64+
set -euo pipefail
65+
cd "{{justfile_directory()}}"
66+
nix build -L --no-link \
67+
'path:.#deps' \
68+
'path:.#deps-msrv' \
69+
'path:.#checks.x86_64-linux.workspace-clippy-all-targets' \
70+
'path:.#dart-bindings' \
71+
'path:.#kotlin-bindings' \
72+
'path:.#go-bindings'
73+
74+
# Push the locally built CI cache warmup targets to Cachix.
75+
ci-cache-push:
76+
#!/usr/bin/env bash
77+
set -euo pipefail
78+
cd "{{justfile_directory()}}"
79+
nix build --json --no-link \
80+
'path:.#deps' \
81+
'path:.#deps-msrv' \
82+
'path:.#checks.x86_64-linux.workspace-clippy-all-targets' \
83+
'path:.#dart-bindings' \
84+
'path:.#kotlin-bindings' \
85+
'path:.#go-bindings' \
86+
| jq -r '.[].outputs | to_entries[].value' \
87+
| cachix push cashudevkit
88+
89+
# Build and push CI cache warmup targets as they complete.
90+
ci-cache-watch:
91+
#!/usr/bin/env bash
92+
set -euo pipefail
93+
cd "{{justfile_directory()}}"
94+
cachix watch-exec cashudevkit -- just ci-cache-build
95+
6196
# run `cargo check` on everything
6297
check *ARGS="--workspace --all-targets":
6398
#!/usr/bin/env bash

0 commit comments

Comments
 (0)