Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: introduce a new workflow to verify build script on multi platforms #196

Merged
merged 10 commits into from
Dec 20, 2024
47 changes: 47 additions & 0 deletions .github/workflows/build_verification.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Build Verification

on:
workflow_dispatch:
push:
branches: [ "main", "dev","feature/*" ]
pull_request:
branches: [ "main", "dev","feature/*" ]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}

env:
kyanos_log_option: --bpf-event-log-level 5 --conntrack-log-level 5

permissions:
contents: read

jobs:
verify:
timeout-minutes: 30
continue-on-error: true
# TODO:adapt to different architecture runner
runs-on: ${{ matrix.os }}
# 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
strategy:
matrix:
os: [ "ubuntu-20.04","ubuntu-22.04","ubuntu-24.04" ]

steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
submodules: recursive

- name: Set up Go
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5
with:
go-version: '1.23.3'

- name: Init
run: |
/bin/bash init_env.sh

- name: Build
run: |
make clean && make build-bpf && make
16 changes: 15 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,18 @@ btfgen:
.DELETE_ON_ERROR:

# keep intermediate (.skel.h, .bpf.o, etc) targets
.SECONDARY:
.SECONDARY:

.PHONY: test
test: test-go

.PHONY: test-go
test-go:
go test -v ./...

.PHONY: format
format: format-go

.PHONY: format-go
format-go:
gofmt -s -w .
2 changes: 1 addition & 1 deletion bpf/loader/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ func filterFunctions(coll *ebpf.CollectionSpec, kernelVersion compatible.KernelV
}

needsDelete := make([]string, 0)
for cProgName, _ := range coll.Programs {
for cProgName := range coll.Programs {
if slices.Index(finalCProgNames, cProgName) == -1 {
needsDelete = append(needsDelete, cProgName)
}
Expand Down
6 changes: 4 additions & 2 deletions init_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ fi

CLANG_NUM=-12
# shellcheck disable=SC2209
if [ ${release_num} == "20.10" ]; then
if [ ${release_num} == "20.04" ]; then
CLANG_NUM=-10
elif [ ${release_num} == "20.04" ]; then
CLANG_NUM=-10
elif [ ${release_num} == "21.04" ]; then
CLANG_NUM=-11
Expand All @@ -21,7 +23,7 @@ if [ ${release_num} == "20.10" ]; then
elif [ ${release_num} == "23.04" ];then
CLANG_NUM=-15
elif [ ${release_num} == "23.10" ];then
CLANG_NUM=-15
CLANG_NUM=-15
elif [ ${release_num} == "24.04" ];then
CLANG_NUM=-18
else
Expand Down
Loading