Skip to content

Commit 347c371

Browse files
committed
CI: Mark CGO warnings as errors
Treat warning as errors only in the CI. We can enforce it in the source code (like setting CFLAGS in libcontainer/nsenter/nsenter.go), but that can force other downstream to patch the code if thei C compiler produces warnings. For that reason, we do it only on the CI. Todays CGO warnings are quite hidden in the CI (only shown for the compilation step, that is collapsed) and CI is green anyways. With this patch, CI fails if a warning is introduced. Signed-off-by: Rodrigo Campos <[email protected]>
1 parent b144f3d commit 347c371

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

.github/workflows/test.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ on:
1111
- release-*
1212
pull_request:
1313

14+
env:
15+
# Don't ignore C warnings. Note that the output of "go env CGO_CFLAGS" by default is "-g -O2", so we keep them.
16+
CGO_CFLAGS: -g -O2 -Werror
17+
1418
jobs:
1519
test:
1620
runs-on: ubuntu-20.04

.github/workflows/validate.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ jobs:
2525

2626
compile-buildtags:
2727
runs-on: ubuntu-20.04
28+
env:
29+
# Don't ignore C warnings. Note that the output of "go env CGO_CFLAGS" by default is "-g -O2", so we keep them.
30+
CGO_CFLAGS: -g -O2 -Werror
2831
steps:
2932
- uses: actions/checkout@v2
3033
- name: compile with no build tags

0 commit comments

Comments
 (0)