forked from open-telemetry/opentelemetry-ebpf-profiler
-
Notifications
You must be signed in to change notification settings - Fork 12
320 lines (306 loc) · 12.5 KB
/
unit-test-on-pull-request.yml
File metadata and controls
320 lines (306 loc) · 12.5 KB
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
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
name: CI
on:
push:
branches: [main, main-next]
pull_request:
branches: ["**"]
permissions:
contents: read
jobs:
legal:
name: Check licenses of dependencies
runs-on: ubuntu-24.04
steps:
- name: Clone code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Go
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
with:
go-version-file: go.mod
cache-dependency-path: go.sum
- name: Check for changes in licenses of dependencies
run: |
make legal
if [ -n "$(git status --porcelain)" ]; then
echo "run \"make legal\"."
exit 1
fi
lint:
name: Lint (${{ matrix.target_arch }})
runs-on: ${{ matrix.runner }}
strategy:
matrix:
include:
- { target_arch: amd64, runner: ubuntu-24.04 }
- { target_arch: arm64, runner: ubuntu-24.04-arm }
steps:
- name: Clone code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up environment
uses: ./.github/workflows/env
- name: linter
env:
CGO_ENABLED: 1
run: make lint
format:
name: Format Go and C code
runs-on: ubuntu-24.04
steps:
- name: Clone code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up environment
uses: ./.github/workflows/env
- name: formatter
env:
CGO_ENABLED: 1
run: |
make format
git diff --exit-code || (echo 'Code base is not Go or C formatted, please run "make format" and commit the changes in this PR.'; exit 1)
test:
name: Test (${{ matrix.target_arch }}${{ matrix.go_flags }})
runs-on: ${{ matrix.runner }}
strategy:
matrix:
include:
- { target_arch: amd64, runner: ubuntu-24.04, go_flags: "" }
- { target_arch: amd64, runner: ubuntu-24.04, go_flags: "-race" }
- { target_arch: arm64, runner: ubuntu-24.04-arm, go_flags: "" }
- { target_arch: arm64, runner: ubuntu-24.04-arm, go_flags: "-race" }
steps:
- name: Clone code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up environment
uses: ./.github/workflows/env
- name: Cache coredump modules
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
with:
path: tools/coredump/modulecache
key: coredumps-${{ matrix.target_arch }}-${{ hashFiles('tools/coredump/testdata/*/*.json') }}
restore-keys: |
coredumps-${{ matrix.target_arch }}
coredumps-
- name: Tests
run: make test TARGET_ARCH=${{ matrix.target_arch }} GO_FLAGS="${{ matrix.go_flags }}"
build-integration-test-binaries:
name: Build integration test binaries (${{ matrix.target_arch }})
runs-on: ${{ matrix.runner }}
timeout-minutes: 10
strategy:
matrix:
include:
- { target_arch: amd64, runner: ubuntu-24.04 }
- { target_arch: arm64, runner: ubuntu-24.04-arm }
steps:
- name: Clone code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up environment
uses: ./.github/workflows/env
- name: Prepare integration test binaries for qemu tests
run: make integration-test-binaries TARGET_ARCH=${{ matrix.target_arch }}
- name: Upload integration test binaries
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: integration-test-binaries-${{ matrix.target_arch }}
path: support/*.test
coredump-test-macos:
name: Coredump tests (macOS)
runs-on: macos-latest
steps:
- name: Clone code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Go
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
with:
go-version-file: go.mod
cache-dependency-path: go.sum
- name: Cache coredump modules
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
with:
path: tools/coredump/modulecache
key: coredumps-arm64-${{ hashFiles('tools/coredump/testdata/*/*.json') }}
restore-keys: |
coredumps-arm64
coredumps-
- name: Run coredump tests
run: GODEBUG=asyncpreemptoff=1 go test -v ./tools/coredump/
integration-tests:
name: Integration tests (v${{ matrix.kernel }} ${{ matrix.target_arch }})
runs-on: ubuntu-24.04
needs: build-integration-test-binaries
timeout-minutes: 10
strategy:
matrix:
include:
# List of available kernels here:
# https://github.com/cilium/ci-kernels/pkgs/container/ci-kernels/versions?filters%5Bversion_type%5D=tagged
# AMD64
- { target_arch: amd64, kernel: 5.4.276 }
- { target_arch: amd64, kernel: 5.10.217 }
- { target_arch: amd64, kernel: 5.15.159 }
- { target_arch: amd64, kernel: 6.1.91 }
- { target_arch: amd64, kernel: 6.6.31 }
- { target_arch: amd64, kernel: 6.8.10 }
- { target_arch: amd64, kernel: 6.9.1 }
- { target_arch: amd64, kernel: 6.12.16 }
# include a kernel that has 4540aed51b12bc13364149bf95f6ecef013197c0
# (see https://github.com/parca-dev/opentelemetry-ebpf-profiler/pull/201)
- { target_arch: amd64, kernel: 6.12.63 }
- { target_arch: amd64, kernel: 6.16 }
- { target_arch: amd64, kernel: 6.18 }
# ARM64 (NOTE: older ARM64 kernels are not available in Cilium repos)
- { target_arch: arm64, kernel: 6.6.31 }
- { target_arch: arm64, kernel: 6.8.4 }
- { target_arch: arm64, kernel: 6.9.1 }
- { target_arch: arm64, kernel: 6.12.16 }
- { target_arch: arm64, kernel: 6.16 }
- { target_arch: arm64, kernel: 6.18 }
steps:
- name: Disable man-db
run: |
echo "set man-db/auto-update false" | sudo debconf-communicate
sudo dpkg-reconfigure man-db
- name: Clone code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Install dependencies
run: |
sudo apt-get update -y
case "${{ matrix.target_arch }}" in
amd64) sudo apt-get -y --no-install-recommends --no-install-suggests install qemu-system-x86 ;;
arm64) sudo apt-get -y --no-install-recommends --no-install-suggests install qemu-system-arm ipxe-qemu ;;
*) echo >&2 "bug: bad arch selected"; exit 1;;
esac
go install github.com/florianl/bluebox@v0.0.1
sudo mv ~/go/bin/bluebox /usr/local/bin/.
- name: Fetch integration test binaries
uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0
with: { name: "integration-test-binaries-${{ matrix.target_arch }}" }
- name: Fetch precompiled kernel
run: |
install -d ci-kernels
echo "FROM ghcr.io/cilium/ci-kernels:${{ matrix.kernel }}" \
| docker buildx build --platform linux/${{ matrix.target_arch }} \
--quiet --pull --output="ci-kernels" -
mv ci-kernels/boot/ ci-kernels/${{ matrix.kernel }}/
- name: Test on kernel ${{ matrix.kernel }}
run: |
chmod a+rx *.test
case "${{ matrix.target_arch }}" in
amd64) export QEMU_ARCH=x86_64;;
arm64) export QEMU_ARCH=aarch64;;
*) echo >&2 "bug: bad arch selected"; exit 1;;
esac
support/run-tests.sh ${{ matrix.kernel }}
interpreter-integration-tests:
name: Interpreter integration (${{ matrix.target_arch }}, ${{ matrix.test_type }})
runs-on: ubuntu-24.04
strategy:
matrix:
target_arch: [amd64, arm64]
test_type: [stable, known-failing]
steps:
- name: Clone code
uses: actions/checkout@v4
- name: Set up environment
uses: ./.github/workflows/env
- name: Test interpreter integration (stable tests)
if: matrix.test_type == 'stable'
run: |
uname -a
sudo go test ./interpreter/... -v -run TestIntegration -skip "TestIntegration/(node-local-nightly|node-latest)"
- name: Test interpreter integration (known failing tests)
if: matrix.test_type == 'known-failing'
continue-on-error: true
run: |
uname -a
sudo go test ./interpreter/... -v -run "TestIntegration/(node-local-nightly|node-latest)"
build-distro-qemu-initramfs:
name: Build distro QEMU initramfs (${{ matrix.target_arch }})
runs-on: ${{ matrix.runner }}
timeout-minutes: 10
strategy:
matrix:
include:
- { target_arch: amd64, runner: ubuntu-24.04 }
- { target_arch: arm64, runner: ubuntu-24.04-arm }
steps:
- name: Clone code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache-dependency-path: go.sum
- name: Set up environment
uses: ./.github/workflows/env
- name: Install dependencies
run: |
sudo apt-get update -y
sudo apt-get install -y --no-install-recommends debootstrap systemtap-sdt-dev
- name: Get parcagpu image digest
id: parcagpu-digest
run: |
digest=$(docker buildx imagetools inspect ghcr.io/parca-dev/parcagpu:latest --format '{{.Digest}}' 2>/dev/null || echo "unknown")
echo "digest=${digest}" >> "$GITHUB_OUTPUT"
- name: Cache parcagpu library
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
with:
path: test/distro-qemu/parcagpu-lib
key: parcagpu-${{ matrix.target_arch }}-${{ steps.parcagpu-digest.outputs.digest }}
- name: Build initramfs
run: |
cd test/distro-qemu
./build-initramfs.sh initramfs-${{ matrix.target_arch }}.gz
- name: Upload initramfs
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: distro-qemu-initramfs-${{ matrix.target_arch }}
path: test/distro-qemu/initramfs-${{ matrix.target_arch }}.gz
distro-qemu-tests:
name: Distro QEMU tests (${{ matrix.kernel }} ${{ matrix.target_arch }})
runs-on: ${{ matrix.target_arch == 'arm64' && 'ubuntu-24.04-arm' || 'ubuntu-24.04' }}
needs: build-distro-qemu-initramfs
timeout-minutes: 10
strategy:
matrix:
include:
- { target_arch: amd64, kernel: 5.4.276 }
- { target_arch: amd64, kernel: 5.10.217 }
- { target_arch: amd64, kernel: 5.15.159 }
- { target_arch: amd64, kernel: 6.1.91 }
- { target_arch: amd64, kernel: 6.6.31 }
- { target_arch: amd64, kernel: 6.8.10 }
- { target_arch: amd64, kernel: 6.9.1 }
- { target_arch: amd64, kernel: 6.12.16 }
# include a kernel that has 4540aed51b12bc13364149bf95f6ecef013197c0
# (see https://github.com/parca-dev/opentelemetry-ebpf-profiler/pull/201)
- { target_arch: amd64, kernel: 6.12.63 }
- { target_arch: amd64, kernel: 6.16 }
# ARM64 (NOTE: older ARM64 kernels are not available in Cilium repos)
- { target_arch: arm64, kernel: 6.6.31 }
- { target_arch: arm64, kernel: 6.8.4 }
- { target_arch: arm64, kernel: 6.9.1 }
- { target_arch: arm64, kernel: 6.12.16 }
steps:
- name: Clone code
uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update -y
case "${{ matrix.target_arch }}" in
amd64) sudo apt-get -y --no-install-recommends --no-install-suggests install qemu-system-x86;;
arm64) sudo apt-get -y --no-install-recommends --no-install-suggests install qemu-system-arm ipxe-qemu;;
*) echo >&2 "bug: bad arch selected"; exit 1;;
esac
- name: Fetch initramfs
uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0
with:
name: distro-qemu-initramfs-${{ matrix.target_arch }}
path: test/distro-qemu
- name: Download kernel
run: |
cd test/distro-qemu
./download-kernel.sh ${{ matrix.kernel }}
- name: Run distro tests in QEMU
run: |
cd test/distro-qemu
./run-qemu.sh ${{ matrix.kernel }} initramfs-${{ matrix.target_arch }}.gz