From 86f4988fc4e64974c3c1d8af3f3825f68b4e9153 Mon Sep 17 00:00:00 2001 From: Jon Shallow Date: Mon, 8 Aug 2022 08:44:30 +0100 Subject: [PATCH] github: Add in build and test workflow Unfortunately out of path builds do not work at present. Signed-off-by: Jon Shallow --- .github/workflows/main.yml | 64 ++++++++++++++++++++++++++++++++++++ Makefile.in | 3 +- aes/Makefile.in | 2 +- ecc/Makefile.in | 2 +- sha2/Makefile.in | 2 +- tests/Makefile.in | 2 +- tests/unit-tests/Makefile.in | 2 +- 7 files changed, 71 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..1a2208d6 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,64 @@ +name: Build Tests + +on: + push: + branches: + - main + - develop + - gh-workflows + pull_request: + branches: + - main + - develop + +env: + PLATFORM: posix + TESTS: yes + +jobs: + build-linux-autotools: + runs-on: ubuntu-latest + strategy: + matrix: + CC: ["gcc", "clang" ] + steps: + - uses: actions/checkout@v3 + - name: setup + run: | + sudo apt-get update && sudo apt-get install -y libcunit1-dev libtool libtool-bin exuberant-ctags valgrind + ./autogen.sh + - name: configure + run: | + # mkdir build-${{matrix.CC}} + # cd build-${{matrix.CC}} + $GITHUB_WORKSPACE/configure --enable-tests + - name: compile + run: | + # cd build-${{matrix.CC}} + make EXTRA_CFLAGS=-Werror + - name: tests + run: | + # cd build-${{matrix.CC}} + libtool --mode=execute valgrind --track-origins=yes --leak-check=yes --show-reachable=yes --error-exitcode=123 --quiet tests/unit-tests/testdriver + libtool --mode=execute valgrind --track-origins=yes --leak-check=yes --show-reachable=yes --error-exitcode=123 --quiet tests/ccm-test + + build-linux-cmake: + name: Build for Linux using CMake + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Build tinydtls + run: | + cmake -Dmake_tests=ON . + make + build-macos-cmake: + name: Build for macOS using CMake + runs-on: macos-latest + + steps: + - uses: actions/checkout@v3 + - name: Build tinydtls + run: | + cmake -Dmake_tests=ON . + make diff --git a/Makefile.in b/Makefile.in index 555b2fbf..87a0fead 100644 --- a/Makefile.in +++ b/Makefile.in @@ -47,7 +47,8 @@ HEADERS:=dtls.h hmac.h dtls_debug.h dtls_config.h uthash.h numeric.h crypto.h gl netq.h alert.h utlist.h dtls_prng.h peer.h state.h dtls_time.h session.h \ tinydtls.h dtls_mutex.h PKG_CONFIG_FILES:=tinydtls.pc -CFLAGS:=-Wall -pedantic -std=c99 -DSHA2_USE_INTTYPES_H @CFLAGS@ @WARNING_CFLAGS@ +CFLAGS:=-Wall -pedantic -std=c99 -DSHA2_USE_INTTYPES_H @CFLAGS@ \ + @WARNING_CFLAGS@ $(EXTRA_CFLAGS) CPPFLAGS:=@CPPFLAGS@ -DDTLS_CHECK_CONTENTTYPE -I$(top_srcdir) SUBDIRS:=tests tests/unit-tests doc platform-specific sha2 aes ecc DISTSUBDIRS:=$(SUBDIRS) diff --git a/aes/Makefile.in b/aes/Makefile.in index dfa62a1f..30d5bc5a 100644 --- a/aes/Makefile.in +++ b/aes/Makefile.in @@ -30,7 +30,7 @@ SOURCES:= rijndael.c rijndael_wrap.c HEADERS:= rijndael.h OBJECTS:= $(patsubst %.c, %.o, $(SOURCES)) CPPFLAGS=@CPPFLAGS@ -CFLAGS=-Wall -std=c99 -pedantic @CFLAGS@ @WARNING_CFLAGS@ +CFLAGS=-Wall -std=c99 -pedantic @CFLAGS@ @WARNING_CFLAGS@ $(EXTRA_CFLAGS) LDFLAGS=@LDFLAGS@ LDLIBS=@LIBS@ FILES:=Makefile.in $(SOURCES) $(HEADERS) diff --git a/ecc/Makefile.in b/ecc/Makefile.in index 6963c9d4..9ecc0426 100644 --- a/ecc/Makefile.in +++ b/ecc/Makefile.in @@ -38,7 +38,7 @@ else ECC_OBJECTS:= $(patsubst %.c, %.o, $(ECC_SOURCES)) ecc_test.o PROGRAMS:= testecc testfield CPPFLAGS=@CPPFLAGS@ -CFLAGS=-Wall -std=c99 -pedantic @CFLAGS@ @WARNING_CFLAGS@ -DTEST_INCLUDE +CFLAGS=-Wall -std=c99 -pedantic @CFLAGS@ @WARNING_CFLAGS@ $(EXTRA_CFLAGS) -DTEST_INCLUDE LDFLAGS=@LDFLAGS@ LDLIBS=@LIBS@ diff --git a/sha2/Makefile.in b/sha2/Makefile.in index 2a0975a3..5c880c7c 100644 --- a/sha2/Makefile.in +++ b/sha2/Makefile.in @@ -30,7 +30,7 @@ SOURCES:= sha2.c HEADERS:=sha2.h OBJECTS:= $(patsubst %.c, %.o, $(SOURCES)) CPPFLAGS=@CPPFLAGS@ -I$(top_srcdir) -CFLAGS=-DSHA2_USE_INTTYPES_H -Wall -std=c99 -pedantic @CFLAGS@ @WARNING_CFLAGS@ +CFLAGS=-DSHA2_USE_INTTYPES_H -Wall -std=c99 -pedantic @CFLAGS@ @WARNING_CFLAGS@ $(EXTRA_CFLAGS) LDFLAGS=@LDFLAGS@ LDLIBS=@LIBS@ FILES:=Makefile.in $(SOURCES) $(HEADERS) README sha2prog.c sha2speed.c sha2test.pl diff --git a/tests/Makefile.in b/tests/Makefile.in index f5644d10..a3097d92 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -33,7 +33,7 @@ SOURCES:= dtls-server.c ccm-test.c \ OBJECTS:= $(patsubst %.c, %.o, $(SOURCES)) PROGRAMS:= $(patsubst %.c, %, $(SOURCES)) HEADERS:= -CFLAGS:=-Wall -std=c99 @CFLAGS@ @WARNING_CFLAGS@ -D_GNU_SOURCE +CFLAGS:=-Wall -std=c99 @CFLAGS@ @WARNING_CFLAGS@ $(EXTRA_CFLAGS) -D_GNU_SOURCE CPPFLAGS:=-I$(top_srcdir) @CPPFLAGS@ LDFLAGS:=-L$(top_builddir) @LDFLAGS@ LDLIBS:=$(top_srcdir)/libtinydtls.a @LIBS@ diff --git a/tests/unit-tests/Makefile.in b/tests/unit-tests/Makefile.in index c7c45e47..8c24c91c 100644 --- a/tests/unit-tests/Makefile.in +++ b/tests/unit-tests/Makefile.in @@ -31,7 +31,7 @@ SOURCES:= $(UNITS) PROGRAM:=testdriver OBJECTS:= $(patsubst %.c, %.o, $(SOURCES)) HEADERS:= $(patsubst %.c, %.h, $(UNITS)) -CFLAGS:=-Wall -std=c99 @CUNIT_CFLAGS@ @CFLAGS@ @WARNING_CFLAGS@ +CFLAGS:=-Wall -std=c99 @CUNIT_CFLAGS@ @CFLAGS@ @WARNING_CFLAGS@ $(EXTRA_CFLAGS) CPPFLAGS:=-I$(top_srcdir) @CPPFLAGS@ LDFLAGS:=-L$(top_builddir) @LDFLAGS@ LDLIBS:=$(top_srcdir)/libtinydtls.a @CUNIT_LIBS@ @LIBS@