-
Notifications
You must be signed in to change notification settings - Fork 293
126 lines (120 loc) · 3.79 KB
/
unit-test-on-pull-request.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
name: CI
on:
push:
branches: [main]
pull_request:
branches: ["**"]
jobs:
lint:
name: Lint
runs-on: ubuntu-24.04
strategy:
fail-fast: true
max-parallel: 2
matrix:
go: ["stable"]
steps:
- name: Clone code
uses: actions/checkout@v4
- name: Set up environment
uses: ./.github/workflows/env
- name: Linter
run: |
go version
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.56.2
make lint
test:
name: Test
runs-on: ubuntu-24.04
strategy:
fail-fast: true
max-parallel: 2
matrix:
go: ["stable"]
toolchain:
- { goarch: amd64, cc: gcc }
- { goarch: arm64, cc: aarch64-linux-gnu-gcc }
steps:
- name: Clone code
uses: actions/checkout@v4
- name: Set up environment
uses: ./.github/workflows/env
- name: Build
run: |
export GOARCH=${{ matrix.toolchain.goarch }}
export CC=${{ matrix.toolchain.cc }}
export OBJCOPY=llvm-objcopy # works cross-arch
export CGO_ENABLED=1
make test
- name: Tests
run: |
make test
build-integration-test-binaries:
name: Build integration test binaries
runs-on: ubuntu-24.04
timeout-minutes: 10
strategy:
matrix:
toolchain:
- { goarch: amd64, cc: gcc }
- { goarch: arm64, cc: aarch64-linux-gnu-gcc }
steps:
- name: Clone code
uses: actions/checkout@v4
- name: Set up environment
uses: ./.github/workflows/env
- name: Prepare integration test binaries for qemu tests
run: |
export GOARCH=${{ matrix.toolchain.goarch }}
export CC=${{ matrix.toolchain.cc }}
export OBJCOPY=llvm-objcopy # works cross-arch
export CGO_ENABLED=1
make integration-test-binaries
- name: Upload integration test binaries
uses: actions/upload-artifact@v4
with:
name: integration-test-binaries-${{ matrix.toolchain.goarch }}
path: support/*.test
integration-tests:
name: Integration tests (kernel v${{ matrix.kernel-version }})
runs-on: ubuntu-24.04
needs: build-integration-test-binaries
strategy:
matrix:
toolchain:
- { arch: x86, goarch: amd64, cc: gcc }
- { arch: aarch64, goarch: arm64, cc: aarch64-linux-gnu-gcc }
kernel-version:
- "4.19.314"
- "5.4.276"
- "5.10.217"
- "5.15.159"
- "6.1.91"
- "6.6.31"
- "6.8.10"
- "6.9.1"
steps:
- name: Clone code
uses: actions/checkout@v4
- name: Set up environment
uses: ./.github/workflows/env
- name: Install dependencies
run: |
sudo apt-get -y install qemu-system-${{ matrix.toolchain.arch }}
go install github.com/florianl/[email protected]
sudo mv ~/go/bin/bluebox /usr/local/bin/.
- name: Fetch integration test binaries
uses: actions/download-artifact@v4
with: { name: integration-test-binaries-${{ matrix.toolchain.goarch }} }
- name: Fetch precompiled kernels
run: |
install -d ci-kernels
echo "FROM ghcr.io/cilium/ci-kernels:${{ matrix.kernel-version }}" \
| docker buildx build --platform linux/${{ matrix.toolchain.goarch }} \
--quiet --pull --output="ci-kernels" -
mv ci-kernels/boot/ ci-kernels/${{ matrix.kernel-version }}/
- name: Test on kernel ${{ matrix.kernel-version }}
run: |
chmod a+rx *.test
export QEMU_ARCH=${{ matrix.toolchain.arch}}
support/run-tests.sh ${{ matrix.kernel-version }}