-
Notifications
You must be signed in to change notification settings - Fork 21
96 lines (90 loc) · 2.9 KB
/
lint.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
name: lints
on:
pull_request:
push:
branches:
- main
defaults:
run:
shell: bash -euo pipefail {0}
jobs:
golangci:
name: golangci-lint
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'
- uses: golangci/golangci-lint-action@v3
with:
# Required: the version of golangci-lint is required and
# should be specified with patch version.
version: v1.59.1
args: --timeout 5m
github-token: ${{ secrets.github_token }}
# caching issues, see: https://github.com/golangci/golangci-lint-action/issues/244#issuecomment-1052190775
skip-pkg-cache: true
skip-build-cache: true
check-go-mod-tidy:
name: check go mod tidy
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'
- name: go mod tidy
run: |
go mod tidy
- name: check diff
run: |
if ! test -z "$(git ls-files --exclude-standard --others .)$(git diff .)"; then
git ls-files --exclude-standard --others .
git diff .
echo "ERROR: 'go mod tidy' modified the source tree."
exit 1
fi
generated:
name: check generated files
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v3
- name: make generate
run: |
make generate
- name: check diff
run: |
if ! test -z "$(git ls-files --exclude-standard --others .)$(git diff .)"; then
git ls-files --exclude-standard --others .
git diff .
echo "ERROR: 'make generate' modified the source tree."
exit 1
fi
codespell:
name: check spelling with codespell
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v3
- uses: codespell-project/actions-codespell@94259cd8be02ad2903ba34a22d9c13de21a74461 # v2.0
with:
check_hidden: true
ignore_words_list: NotIn # k8s match selectors; codespell tries to correct it to 'noting', 'not in', or 'notion'
skip: go.sum,./cluster-autoscaler/ca.patch
actionlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: reviewdog/action-actionlint@54e8faeff91fe07595b1ad3cfdc6aee0157bf51b # v1.40.0
env:
# SC2046 - Quote this to prevent word splitting. - https://www.shellcheck.net/wiki/SC2046
# SC2086 - Double quote to prevent globbing and word splitting. - https://www.shellcheck.net/wiki/SC2086
SHELLCHECK_OPTS: --exclude=SC2046,SC2086
with:
fail_on_error: true
filter_mode: nofilter
level: error