Skip to content

Commit 95eead1

Browse files
committed
Add seccomp codegen check to CI
Signed-off-by: Austin Vazquez <[email protected]>
1 parent 63f9952 commit 95eead1

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

.github/workflows/ci.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,19 @@ jobs:
8282
run: |
8383
echo "One or more lint checks failed"
8484
exit 1
85+
86+
check-codegen:
87+
name: Check seccomp code generation
88+
runs-on: ubuntu-latest
89+
steps:
90+
- name: Checkout code
91+
uses: actions/checkout@v4
92+
93+
- name: Set up Go
94+
uses: actions/setup-go@v5
95+
with:
96+
go-version: stable
97+
98+
- name: Validate seccomp code generation
99+
run: bash script/validate/default-seccomp
100+

script/validate/default-seccomp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env bash
2+
3+
# We run 'go generate' and see if we have a diff afterwards
4+
go generate ./seccomp/ > /dev/null
5+
# Let see if the working directory is clean
6+
diffs="$(git status --porcelain -- seccomp 2> /dev/null)"
7+
if [ "$diffs" ]; then
8+
{
9+
echo 'The result of go generate ./seccomp/ differs'
10+
echo
11+
echo "$diffs"
12+
echo
13+
echo 'Please re-run go generate ./seccomp/'
14+
echo
15+
} >&2
16+
false
17+
else
18+
echo 'Congratulations! Seccomp profile generation is done correctly.'
19+
fi

0 commit comments

Comments
 (0)