-
Notifications
You must be signed in to change notification settings - Fork 695
227 lines (192 loc) · 6.13 KB
/
ci.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
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
name: ci
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
TMPDIR: /tmp
CI_MAX_KERNEL_VERSION: '6.8'
CI_MIN_CLANG_VERSION: '11'
go_version: '~1.23'
prev_go_version: '~1.22'
CGO_ENABLED: '0'
# This needs to match whatever Netlify supports.
# Also defined in Pipfile.
python_version: '~3.8'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
build-and-lint:
name: Build and Lint
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '${{ env.go_version }}'
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v6.1.0
with:
args: "--out-format colored-line-number"
- name: Generate and format code
run: |
make clean && make container-all
if ! git diff --exit-code; then
echo "found unformatted source files, or generated files are not up to date, run 'make'" >&2
exit 1
fi
- name: Test bpf2go
run: |
sudo apt-get install clang-11 llvm-11
go test -v ./cmd/bpf2go
- name: Build examples
run: go build -v ./...
working-directory: ./examples
- name: Cross build windows
env:
GOOS: windows
run: |
go build -v ./...
go test -c -o /dev/null ./... >/dev/null
- name: Cross build arm32
env:
GOARCH: arm
GOARM: 6
run: |
go build -v ./...
go test -c -o /dev/null ./... >/dev/null
build-docs:
name: Build Documentation
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
with:
# The mkdocs git-authors plugin needs access to the full revision
# history to correctly generate its statistics.
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '${{ env.go_version }}'
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '${{ env.python_version }}'
cache: 'pipenv'
- name: Install pipenv
run: pip3 install pipenv
- name: Install Dependencies
run: pipenv install
working-directory: ./docs
- name: Build Documentation
run: make build
working-directory: ./docs
test-on-prev-go:
name: Run tests on previous stable Go
runs-on: ubuntu-latest
needs: build-and-lint
timeout-minutes: 15
env:
CI_KERNEL_SELFTESTS: '/usr/src/linux/tools/testing/selftests/bpf'
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '${{ env.prev_go_version }}'
- run: go install lmb.io/vimto@latest
- run: go install gotest.tools/gotestsum@v1.8.1
- run: sudo apt-get update && sudo apt-get install -y --no-install-recommends qemu-system-x86
- run: sudo chmod 0666 /dev/kvm
- name: Test
env:
GOTRACEBACK: crash
run: |
gotestsum --raw-command --ignore-non-json-output-lines --junitfile junit.xml -- vimto -kernel :stable-selftests -- go test -timeout 5m -short -count 1 -json ./...
- name: Benchmark
run: vimto -kernel :stable-selftests -- go test -short -run '^$' -bench . -benchtime=1x ./...
- name: Upload coredumps
uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
name: cores
if-no-files-found: ignore
path: |
**/core-*
**/*.test
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v4
with:
name: Test Results (previous stable Go)
path: junit.xml
test-on-arm64:
name: Run tests on arm64
runs-on: ubuntu-22.04-arm64
needs: build-and-lint
timeout-minutes: 15
env:
EBPF_TEST_IGNORE_VERSION: 'TestKprobeMulti,TestKprobeMultiErrors,TestKprobeMultiCookie,TestKprobeMultiProgramCall,TestHaveBPFLinkKprobeMulti,TestHaveProgramType/LircMode2'
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '${{ env.go_version }}'
- run: go install gotest.tools/gotestsum@v1.8.1
- name: Test
# Skip TestGoarches/loong64 because the GH arm64 Go toolchain seems to be weird.
run: gotestsum --ignore-non-json-output-lines --junitfile junit.xml -- -exec 'sudo -E' -short -count 1 -skip '^TestGoarches/loong64$' -json ./...
- name: Benchmark
run: go test -exec sudo -short -run '^$' -bench . -benchtime=1x ./...
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v4
with:
name: Test Results (arm64)
path: junit.xml
- name: Show dmesg
if: failure()
run: |
sudo dmesg
vm-test:
name: Run tests
runs-on: ubuntu-latest
needs: build-and-lint
timeout-minutes: 15
strategy:
matrix:
tag:
- "mainline"
- "stable"
- "6.6"
- "6.1"
- "5.15"
- "5.10"
- "5.4"
- "4.19"
- "4.14"
- "4.9"
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '${{ env.go_version }}'
- run: go install gotest.tools/gotestsum@v1.8.1
- run: go install lmb.io/vimto@latest
- run: sudo apt-get update && sudo apt-get install -y --no-install-recommends qemu-system-x86
- run: sudo chmod 0666 /dev/kvm
- name: Test
run: gotestsum --raw-command --ignore-non-json-output-lines --junitfile junit.xml -- vimto -kernel :${{ matrix.tag }} -- go test -short -count 1 -json ./...
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v4
with:
name: Test Results (${{ matrix.tag }})
path: junit.xml