Skip to content

Commit 8971743

Browse files
committed
ci: add nix SPDX header check
Signed-off-by: Simon Scatton <sscatton@nvidia.com>
1 parent cc014b8 commit 8971743

3 files changed

Lines changed: 12 additions & 8 deletions

File tree

.github/workflows/nix-ci.yml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -119,18 +119,14 @@ jobs:
119119
cachix_auth_token: ${{ secrets.CACHIX_AUTH_TOKEN }}
120120

121121
lint:
122-
name: Lint ${{ matrix.lint }} (${{ matrix.target.system }})
123-
runs-on: ${{ matrix.target.runner }}
122+
name: Lint ${{ matrix.lint }}
123+
runs-on: linux-amd64-cpu8
124124
strategy:
125125
fail-fast: false
126126
matrix:
127-
target:
128-
- system: x86_64-linux
129-
runner: linux-amd64-cpu8
130-
- system: aarch64-linux
131-
runner: linux-arm64-cpu8
132127
lint:
133128
- rustfmt
129+
- spdx-headers
134130
- openshell-bootstrap-clippy
135131
- openshell-cli-clippy
136132
- openshell-core-clippy
@@ -155,6 +151,6 @@ jobs:
155151
uses: ./.github/actions/setup-nix
156152
with:
157153
build: checks
158-
system: ${{ matrix.target.system }}
154+
system: x86_64-linux
159155
target: ${{ matrix.lint }}
160156
cachix_auth_token: ${{ secrets.CACHIX_AUTH_TOKEN }}

flake.nix

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,12 @@
9191
projectRootFile = "flake.nix";
9292
programs.nixfmt.enable = true;
9393
};
94+
95+
spdxHeaders = pkgs.runCommand "spdx-headers" { src = lib.cleanSource ./.; } ''
96+
cd "$src"
97+
${pkgs.python3}/bin/python scripts/update_license_headers.py --check
98+
touch "$out"
99+
'';
94100
in
95101
{
96102
packages =
@@ -112,6 +118,7 @@
112118
src = craneLib.cleanCargoSource ./.;
113119
cargoExtraArgs = "--all";
114120
};
121+
spdx-headers = spdxHeaders;
115122
};
116123

117124
devShells.default = pkgs.mkShell {

scripts/update_license_headers.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
".yaml": "#",
4444
".yml": "#",
4545
".rego": "#",
46+
".nix": "#",
4647
}
4748

4849
# Directories to skip entirely (relative to repo root).

0 commit comments

Comments
 (0)