Skip to content

Commit bef542c

Browse files
authored
Move lint job from push.yml to separate check.yml workflow (#4013)
## Why Doesn't need to run on a schedule and always applies to all files in the repository. Can consider separating fmt and lint in a follow-up PR.
1 parent 73515a5 commit bef542c

File tree

2 files changed

+49
-37
lines changed

2 files changed

+49
-37
lines changed

.github/workflows/check.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: check
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize]
6+
merge_group:
7+
types: [checks_requested]
8+
9+
jobs:
10+
lint:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
15+
16+
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
17+
with:
18+
go-version-file: go.mod
19+
# Use different schema from regular job, to avoid overwriting the same key
20+
cache-dependency-path: |
21+
go.sum
22+
.golangci.yaml
23+
24+
- name: Run go mod tidy
25+
run: go mod tidy
26+
27+
- name: Fail if go.mod/go.sum changed
28+
run: git diff --exit-code
29+
30+
- name: Run Go lint checks (does not include formatting checks)
31+
run: go tool -modfile=tools/go.mod golangci-lint run --timeout=15m
32+
33+
- name: Run ruff (Python linter and formatter)
34+
uses: astral-sh/ruff-action@57714a7c8a2e59f32539362ba31877a1957dded1 # v3.5.1
35+
with:
36+
version: "0.9.1"
37+
args: "format --check"
38+
39+
- name: "make fmtfull: Python and Go formatting"
40+
# Python formatting is already checked above, but this also checks Go and YAML formatting
41+
# and verifies that the make command works correctly
42+
run: |
43+
make fmtfull
44+
git diff --exit-code
45+
46+
- name: "make checks: custom checks outside of fmt and lint"
47+
run: |-
48+
make checks
49+
git diff --exit-code

.github/workflows/push.yml

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -104,43 +104,6 @@ jobs:
104104
- name: Analyze slow tests
105105
run: make slowest
106106

107-
linters:
108-
needs: cleanups
109-
name: lint
110-
runs-on: ubuntu-latest
111-
steps:
112-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
113-
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
114-
with:
115-
go-version-file: go.mod
116-
# Use different schema from regular job, to avoid overwriting the same key
117-
cache-dependency-path: |
118-
go.sum
119-
.golangci.yaml
120-
- name: Run go mod tidy
121-
run: |
122-
go mod tidy
123-
- name: Fail on differences
124-
run: |
125-
# Exit with status code 1 if there are differences (i.e. unformatted files)
126-
git diff --exit-code
127-
- name: Run Go lint checks (does not include formatting checks)
128-
run: go tool -modfile=tools/go.mod golangci-lint run --timeout=15m
129-
- name: Run ruff (Python linter and formatter)
130-
uses: astral-sh/ruff-action@57714a7c8a2e59f32539362ba31877a1957dded1 # v3.5.1
131-
with:
132-
version: "0.9.1"
133-
args: "format --check"
134-
- name: "make fmtfull: Python and Go formatting"
135-
# This is already done by actions, but good to check that make command is working
136-
run: |
137-
make fmtfull
138-
git diff --exit-code
139-
- name: "make checks: custom checks outside of fmt and lint"
140-
run: |
141-
make checks
142-
git diff --exit-code
143-
144107
validate-generated-is-up-to-date:
145108
needs: cleanups
146109
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)