Skip to content

Commit 1d5c2df

Browse files
[Backport release-25.05] workflows/lint: run all the static lints in same workflow (#416404)
2 parents 0797b0b + 4b21b23 commit 1d5c2df

File tree

4 files changed

+101
-145
lines changed

4 files changed

+101
-145
lines changed

.github/workflows/check-format.yml

Lines changed: 0 additions & 50 deletions
This file was deleted.

.github/workflows/lint.yml

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
name: Lint
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- .github/workflows/lint.yml
7+
pull_request_target:
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.run_id }}
11+
cancel-in-progress: true
12+
13+
permissions: {}
14+
15+
defaults:
16+
run:
17+
shell: bash
18+
19+
jobs:
20+
treefmt:
21+
runs-on: ubuntu-24.04-arm
22+
steps:
23+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
24+
with:
25+
sparse-checkout: .github/actions
26+
- name: Check if the PR can be merged and checkout the merge commit
27+
uses: ./.github/actions/get-merge-commit
28+
with:
29+
merged-as-untrusted: true
30+
31+
- uses: cachix/install-nix-action@17fe5fb4a23ad6cbbe47d6b3f359611ad276644c # v31
32+
with:
33+
extra_nix_config: sandbox = true
34+
35+
- name: Check that files are formatted
36+
run: |
37+
# Note that it's fine to run this on untrusted code because:
38+
# - There's no secrets accessible here
39+
# - The build is sandboxed
40+
if ! nix-build untrusted/ci -A fmt.check; then
41+
echo "Some files are not properly formatted"
42+
echo "Please format them by going to the Nixpkgs root directory and running one of:"
43+
echo " nix-shell --run treefmt"
44+
echo " nix develop --command treefmt"
45+
echo " nix fmt"
46+
echo "Make sure your branch is up to date with master; rebase if not."
47+
echo "If you're having trouble, please ping @NixOS/nix-formatting"
48+
exit 1
49+
fi
50+
51+
parse:
52+
runs-on: ubuntu-24.04-arm
53+
steps:
54+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
55+
with:
56+
sparse-checkout: .github/actions
57+
- name: Check if the PR can be merged and checkout the merge commit
58+
uses: ./.github/actions/get-merge-commit
59+
with:
60+
merged-as-untrusted: true
61+
62+
- uses: cachix/install-nix-action@526118121621777ccd86f79b04685a9319637641 # v31
63+
with:
64+
extra_nix_config: sandbox = true
65+
66+
- name: Parse all nix files
67+
run: |
68+
# Tests multiple versions at once, let's make sure all of them run, so keep-going.
69+
nix-build untrusted/ci -A parse --keep-going
70+
71+
nixpkgs-vet:
72+
runs-on: ubuntu-24.04-arm
73+
# This should take 1 minute at most, but let's be generous. The default of 6 hours is definitely too long.
74+
timeout-minutes: 10
75+
steps:
76+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
77+
with:
78+
sparse-checkout: .github/actions
79+
- name: Check if the PR can be merged and checkout merged and target commits
80+
uses: ./.github/actions/get-merge-commit
81+
with:
82+
merged-as-untrusted: true
83+
target-as-trusted: true
84+
85+
- uses: cachix/install-nix-action@526118121621777ccd86f79b04685a9319637641 # v31
86+
with:
87+
extra_nix_config: sandbox = true
88+
89+
- name: Running nixpkgs-vet
90+
env:
91+
# Force terminal colors to be enabled. The library that `nixpkgs-vet` uses respects https://bixense.com/clicolors/
92+
CLICOLOR_FORCE: 1
93+
run: |
94+
if nix-build untrusted/ci -A nixpkgs-vet --arg base "./trusted" --arg head "./untrusted"; then
95+
exit 0
96+
else
97+
exitCode=$?
98+
echo "To run locally: ./ci/nixpkgs-vet.sh $GITHUB_BASE_REF https://github.com/$GITHUB_REPOSITORY.git"
99+
echo "If you're having trouble, ping @NixOS/nixpkgs-vet"
100+
exit "$exitCode"
101+
fi

.github/workflows/nix-parse-v2.yml

Lines changed: 0 additions & 41 deletions
This file was deleted.

.github/workflows/nixpkgs-vet.yml

Lines changed: 0 additions & 54 deletions
This file was deleted.

0 commit comments

Comments
 (0)