Skip to content

Commit

Permalink
test ci
Browse files Browse the repository at this point in the history
  • Loading branch information
BSWANG committed Apr 15, 2024
1 parent 446beab commit 8484036
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 12 deletions.
28 changes: 20 additions & 8 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,27 @@ jobs:
DEFAULT_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

check-btf:
check-bpf:
runs-on: ubuntu-latest
steps:
- name: build-btf
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install LLVM and Clang
uses: KyleMayes/install-llvm-action@v2
with:
version: "17.0"
directory: ${{ runner.temp }}/llvm
- name: build-bpf
run: |
cd ${{ github.workspace }} && make generate-btf-in-container
- name: check-btf-update
make generate-bpf-in-container
- name: check-bpf-update
run: |
if [ -n "$(git status --porcelain)" ]; then
echo "Please run 'make generate-btf-in-container' and submit your changes"
exit 1
fi
for bpfobjfile in `git status --porcelain | awk '{print $2}'`; do
git show HEAD:$bpfobjfile > ${bpfobjfile}.old
if llvm-objdump --headers $bpfobjfile &>/dev/null && ! diff <(llvm-objcopy --remove-section '.BTF' ${bpfobjfile}.old) <(llvm-objcopy --remove-section '.BTF' $bpfobjfile); then
echo "$bpfobjfile changed; Please run 'make generate-bpf-in-container' and submit your changes"
exit 1
fi
rm -f ${bpfobjfile}.old
done
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ build-btfhack:
build-webconsole:
cd webui && CGO_ENABLED=0 go build -o ../bin/webconsole -ldflags $(ldflags) .

.PHONY: generate-btf
generate-btf:
.PHONY: generate-bpf
generate-bpf:
go generate ./pkg/exporter/probe/...

.PHONY: generate-btf-in-container
generate-btf-in-container:
.PHONY: generate-bpf-in-container
generate-bpf-in-container:
docker run -v $(PWD):/go/src/github.com/alibaba/kubeskoop --workdir /go/src/github.com/alibaba/kubeskoop kubeskoop/bpf-build:go121-clang17 go generate ./pkg/exporter/probe/...

0 comments on commit 8484036

Please sign in to comment.