-
Notifications
You must be signed in to change notification settings - Fork 701
169 lines (142 loc) · 4.66 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
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
TMPDIR: /tmp
CI_MAX_KERNEL_VERSION: '6.6'
CI_MIN_CLANG_VERSION: '11'
go_version: '~1.21'
prev_go_version: '~1.20'
# This needs to match whatever Netlify supports.
# Also defined in Pipfile.
python_version: '~3.8'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-and-lint:
name: Build and Lint
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '${{ env.go_version }}'
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v3.7.0
with:
args: "--out-format colored-line-number"
skip-pkg-cache: true
- 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 darwin
env:
GOOS: darwin
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
- name: Cross build arm64
env:
GOARCH: arm64
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@v3
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@v4
with:
go-version: '${{ env.go_version }}'
- name: Set up Python
uses: actions/setup-python@v4
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-4cores-16gb
needs: build-and-lint
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '${{ env.prev_go_version }}'
- run: go install gotest.tools/gotestsum@v1.8.1
- run: sudo pip3 install https://github.com/amluto/virtme/archive/beb85146cd91de37ae455eccb6ab67c393e6e290.zip
- run: sudo apt-get update && sudo apt-get install -y --no-install-recommends qemu-system-x86
- name: Test
run: gotestsum --raw-command --ignore-non-json-output-lines --junitfile junit.xml -- ./run-tests.sh $CI_MAX_KERNEL_VERSION -short -count 1 -json ./...
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v3
with:
name: Test Results (previous stable Go)
path: junit.xml
vm-test:
name: Run tests on pre-built kernel
runs-on: ubuntu-latest-4cores-16gb
needs: build-and-lint
timeout-minutes: 10
strategy:
matrix:
version: ["6.6", "6.1", "5.15", "5.10", "5.4", "4.19", "4.14", "4.9"]
env:
KERNEL_VERSION: "${{ matrix.version }}"
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '${{ env.prev_go_version }}'
- run: go install gotest.tools/gotestsum@v1.8.1
- run: sudo pip3 install https://github.com/amluto/virtme/archive/beb85146cd91de37ae455eccb6ab67c393e6e290.zip
- run: sudo apt-get update && sudo apt-get install -y --no-install-recommends qemu-system-x86
- name: Test
run: gotestsum --raw-command --ignore-non-json-output-lines --junitfile junit.xml -- ./run-tests.sh $KERNEL_VERSION -short -count 1 -json ./...
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v3
with:
name: Test Results (${{ matrix.version }})
path: junit.xml