Skip to content

Commit a883010

Browse files
authored
feat: introduce a new workflow to verify build script on multi platforms (#196)
* feat: introduce new Check workflow * fix: correct matrix * fix: Make different matrices run independently of each other * test: test init_env in the step * style: resolve fmt issues Signed-off-by: spencercjh <[email protected]> * chore: simplify matrix Signed-off-by: spencercjh <[email protected]> * chore: rename the wf Signed-off-by: spencercjh <[email protected]> * chore: remove irrelevant codes to check format issues Signed-off-by: spencercjh <[email protected]> * fix: add missing build step Signed-off-by: spencercjh <[email protected]> * fix: add missing clang_num init biz for ubuntu 20.04 Signed-off-by: spencercjh <[email protected]> --------- Signed-off-by: spencercjh <[email protected]>
1 parent 0cf2e38 commit a883010

File tree

4 files changed

+67
-4
lines changed

4 files changed

+67
-4
lines changed
+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Build Verification
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [ "main", "dev","feature/*" ]
7+
pull_request:
8+
branches: [ "main", "dev","feature/*" ]
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
13+
14+
env:
15+
kyanos_log_option: --bpf-event-log-level 5 --conntrack-log-level 5
16+
17+
permissions:
18+
contents: read
19+
20+
jobs:
21+
verify:
22+
timeout-minutes: 30
23+
continue-on-error: true
24+
# TODO:adapt to different architecture runner
25+
runs-on: ${{ matrix.os }}
26+
# https://docs.github.com/en/actions/using-github-hosted-runners/using-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories
27+
strategy:
28+
matrix:
29+
os: [ "ubuntu-20.04","ubuntu-22.04","ubuntu-24.04" ]
30+
31+
steps:
32+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
33+
with:
34+
submodules: recursive
35+
36+
- name: Set up Go
37+
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5
38+
with:
39+
go-version: '1.23.3'
40+
41+
- name: Init
42+
run: |
43+
/bin/bash init_env.sh
44+
45+
- name: Build
46+
run: |
47+
make clean && make build-bpf && make

Makefile

+15-1
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,18 @@ btfgen:
8787
.DELETE_ON_ERROR:
8888

8989
# keep intermediate (.skel.h, .bpf.o, etc) targets
90-
.SECONDARY:
90+
.SECONDARY:
91+
92+
.PHONY: test
93+
test: test-go
94+
95+
.PHONY: test-go
96+
test-go:
97+
go test -v ./...
98+
99+
.PHONY: format
100+
format: format-go
101+
102+
.PHONY: format-go
103+
format-go:
104+
gofmt -s -w .

bpf/loader/loader.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ func filterFunctions(coll *ebpf.CollectionSpec, kernelVersion compatible.KernelV
209209
}
210210

211211
needsDelete := make([]string, 0)
212-
for cProgName, _ := range coll.Programs {
212+
for cProgName := range coll.Programs {
213213
if slices.Index(finalCProgNames, cProgName) == -1 {
214214
needsDelete = append(needsDelete, cProgName)
215215
}

init_env.sh

+4-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ fi
88

99
CLANG_NUM=-12
1010
# shellcheck disable=SC2209
11-
if [ ${release_num} == "20.10" ]; then
11+
if [ ${release_num} == "20.04" ]; then
12+
CLANG_NUM=-10
13+
elif [ ${release_num} == "20.04" ]; then
1214
CLANG_NUM=-10
1315
elif [ ${release_num} == "21.04" ]; then
1416
CLANG_NUM=-11
@@ -21,7 +23,7 @@ if [ ${release_num} == "20.10" ]; then
2123
elif [ ${release_num} == "23.04" ];then
2224
CLANG_NUM=-15
2325
elif [ ${release_num} == "23.10" ];then
24-
CLANG_NUM=-15
26+
CLANG_NUM=-15
2527
elif [ ${release_num} == "24.04" ];then
2628
CLANG_NUM=-18
2729
else

0 commit comments

Comments
 (0)