-
Notifications
You must be signed in to change notification settings - Fork 25
203 lines (194 loc) · 5.83 KB
/
go.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
name: Go
on:
pull_request:
branches:
- main
- release-*
- feature/*
push:
branches:
- main
- release-*
- feature/*
jobs:
check-changes:
name: Check whether tests need to be run based on diff
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: antrea-io/has-changes@v2
id: check_diff
with:
paths-ignore: docs/* ci/jenkins/* *.md hack/.notableofcontents
outputs:
has_changes: ${{ steps.check_diff.outputs.has_changes }}
test-unit:
needs: check-changes
if: ${{ needs.check-changes.outputs.has_changes == 'yes' }}
name: Unit test
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Check-out code
uses: actions/checkout@v4
- name: Set up Go using version from go.mod
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Run unit tests
run: make test-unit
- name: Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: .coverage/unit/coverage-unit.txt
flags: unit-tests
name: codecov-unit-test
check-snowflake-changes:
name: Check whether snowflake tests need to be run based on diff
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: antrea-io/has-changes@v2
id: check_diff
with:
paths: snowflake/*
outputs:
has_changes: ${{ steps.check_diff.outputs.has_changes }}
test-unit-snowflake:
needs: check-snowflake-changes
if: ${{ needs.check-snowflake-changes.outputs.has_changes == 'yes' }}
name: Unit test snowflake
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Check-out code
uses: actions/checkout@v4
- name: Set up Go using version from go.mod
uses: actions/setup-go@v5
with:
go-version-file: 'snowflake/go.mod'
cache-dependency-path: 'snowflake/go.sum'
- name: Run unit tests
run: |
cd snowflake
make test-unit
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: snowflake/.coverage/coverage-unit.txt
flags: unit-tests
name: codecov-unit-test-snowflake
golangci-lint:
needs: check-changes
if: ${{ needs.check-changes.outputs.has_changes == 'yes' }}
name: Golangci-lint
strategy:
matrix:
platform: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.platform }}
steps:
- name: Check-out code
uses: actions/checkout@v4
- name: Set up Go using version from go.mod
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache-dependency-path: '**/go.sum'
- name: Run golangci-lint
run: make golangci
snowflake-golangci-lint:
needs: check-changes
if: ${{ needs.check-changes.outputs.has_changes == 'yes' }}
name: Snowflake-golangci-lint
strategy:
matrix:
platform: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.platform }}
steps:
- name: Check-out code
uses: actions/checkout@v4
- name: Set up Go using version from go.mod
uses: actions/setup-go@v5
with:
go-version-file: 'snowflake/go.mod'
cache-dependency-path: '**/snowflake/go.sum'
- name: Run snowflake golangci-lint
run: cd snowflake ; make golangci
tidy-manifest:
needs: check-changes
if: ${{ needs.check-changes.outputs.has_changes == 'yes' }}
name: Check tidy and manifest
runs-on: [ubuntu-latest]
steps:
- name: Check-out code
uses: actions/checkout@v4
- name: Set up Go using version from go.mod
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache-dependency-path: '**/go.sum'
- name: Check tidy
run: make test-tidy
- name: Check manifest
run: ./ci/check-manifest.sh
- name: Check copyright
run: ./ci/check-copyright.sh
tidy-snowflake-tidy:
needs: check-changes
if: ${{ needs.check-changes.outputs.has_changes == 'yes' }}
name: Check tidy and manifest
runs-on: [ubuntu-latest]
steps:
- name: Check-out code
uses: actions/checkout@v4
- name: Set up Go using version from go.mod
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache-dependency-path: '**/go.sum'
- name: Check tidy for Snowflake
run: cd snowflake; make test-tidy
verify:
name: Verify docs and spelling
runs-on: [ubuntu-latest]
steps:
- name: Check-out code
uses: actions/checkout@v4
- name: Set up Go using version from go.mod
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache-dependency-path: '**/go.sum'
- name: Run verify scripts
run: make verify
- name: Checking for broken Markdown links
if: ${{ github.event_name == 'pull_request' }}
uses: gaurav-nelson/github-action-markdown-link-check@v1
with:
# Check modified files only for pull requests. Cronjob "Verify docs" takes care of checking all markdown files.
check-modified-files-only: yes
base-branch: ${{ github.base_ref }}
config-file: 'hack/.md_links_config.json'
- name: Markdownlint
run: |
sudo npm install -g [email protected]
make markdownlint
- name: Checking whether autogenerated Helm chart documentation is up-to-date
working-directory: build/charts/
run: |
make helm-docs
DIFF=$(git diff .)
if [ -n "$DIFF" ]; then
echo "The Helm chart documentation is out-of-date; please run 'make helm-docs' in 'build/charts/' and commit the changes"
exit 1
fi