GitHub CI: check project for warnings with clang/gcc.
authorKirill Isakov <is-kir@ya.ru>
Mon, 2 Aug 2021 07:30:16 +0000 (13:30 +0600)
committerKirill Isakov <is-kir@ya.ru>
Mon, 2 Aug 2021 07:31:02 +0000 (13:31 +0600)
.github/workflows/test.yml
.github/workflows/warn/run.sh [new file with mode: 0755]
Makefile.am
src/Makefile.am
test/Makefile.am

index 900af01..6db9ea5 100644 (file)
@@ -68,6 +68,18 @@ jobs:
             -exec clang-tidy --header-filter='.*' '{}' +
         if: always()
 
+      - name: Check warnings (gcc)
+        run: bash .github/workflows/warn/run.sh
+        env:
+          CC: gcc
+        if: always()
+
+      - name: Check warnings (clang)
+        run: bash .github/workflows/warn/run.sh
+        env:
+          CC: clang
+        if: always()
+
   sanitizer:
     runs-on: ubuntu-latest
     timeout-minutes: 10
diff --git a/.github/workflows/warn/run.sh b/.github/workflows/warn/run.sh
new file mode 100755 (executable)
index 0000000..f3b06db
--- /dev/null
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+set -eu
+
+test -n "$CC"
+export CFLAGS="${CFLAGS:-} -Werror"
+
+result=0
+
+check_warnings() {
+  git clean -dfx
+
+  autoreconf -fsi
+  ./configure --enable-uml --enable-vde --enable-miniupnpc "$@"
+
+  make -j"$(nproc)" all extra || result=$?
+}
+
+check_warnings
+check_warnings --disable-legacy-protocol
+
+exit $result
index 6f0f687..489fedf 100644 (file)
@@ -10,6 +10,11 @@ EXTRA_DIST = COPYING.README README.android SECURITY.md
 
 @CODE_COVERAGE_RULES@
 
+.PHONY: extra
+extra:
+       $(MAKE) -C $(srcdir)/src extra
+       $(MAKE) -C $(srcdir)/test extra
+
 # If git describe works, force autoconf to run in order to make sure we have the
 # current version number from git in the resulting configure script.
 configure-version:
index 306bbc4..9a776dc 100644 (file)
@@ -2,10 +2,13 @@
 
 sbin_PROGRAMS = tincd tinc
 check_PROGRAMS = sptps_test sptps_keypair
-EXTRA_PROGRAMS = sptps_test sptps_keypair
+EXTRA_PROGRAMS = $(check_PROGRAMS)
 
 CLEANFILES = version_git.h
 
+.PHONY: extra
+extra: $(EXTRA_PROGRAMS)
+
 .PHONY: version-stamp
 version-stamp:
 
index 20fee65..0ba4da9 100644 (file)
@@ -33,6 +33,9 @@ check_PROGRAMS = \
 
 splice_SOURCES = splice.c
 
+.PHONY: extra
+extra: $(check_PROGRAMS)
+
 clean-local:
        -for pid in *.test.?/pid; do ../src/tinc --pidfile="$$pid" stop; done
        -killall ../src/sptps_test