github: Add in build and test workflow

Unfortunately out of path builds do not work at present.

Signed-off-by: Jon Shallow <supjps-libcoap@jpshallow.com>
This commit is contained in:
Jon Shallow 2022-08-08 08:44:30 +01:00 committed by Achim Kraus
parent 388888486a
commit 86f4988fc4
7 changed files with 71 additions and 6 deletions

64
.github/workflows/main.yml vendored Normal file
View File

@ -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

View File

@ -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)

View File

@ -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)

View File

@ -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@

View File

@ -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

View File

@ -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@

View File

@ -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@