From b18d5b572992debb04a7851e43143711319243a0 Mon Sep 17 00:00:00 2001 From: Kirill Isakov Date: Mon, 2 Aug 2021 13:30:16 +0600 Subject: [PATCH] GitHub CI: check project for warnings with clang/gcc. --- .github/workflows/test.yml | 12 ++++++++++++ .github/workflows/warn/run.sh | 22 ++++++++++++++++++++++ Makefile.am | 5 +++++ src/Makefile.am | 5 ++++- test/Makefile.am | 3 +++ 5 files changed, 46 insertions(+), 1 deletion(-) create mode 100755 .github/workflows/warn/run.sh 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 -- 2.20.1