From: Kirill Isakov Date: Mon, 2 Aug 2021 07:30:16 +0000 (+0600) Subject: GitHub CI: check project for warnings with clang/gcc. X-Git-Url: https://tinc-vpn.org/git/browse?a=commitdiff_plain;h=b18d5b572992debb04a7851e43143711319243a0;p=tinc GitHub CI: check project for warnings with clang/gcc. --- diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 900af01f..6db9ea5e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 index 00000000..f3b06db1 --- /dev/null +++ b/.github/workflows/warn/run.sh @@ -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 diff --git a/Makefile.am b/Makefile.am index 6f0f687d..489fedf3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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: diff --git a/src/Makefile.am b/src/Makefile.am index 306bbc42..9a776dcb 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -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: diff --git a/test/Makefile.am b/test/Makefile.am index 20fee657..0ba4da94 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -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