summaryrefslogtreecommitdiff
path: root/.github/workflows
diff options
context:
space:
mode:
authorValery Ivanov <ivalery111@gmail.com>2022-06-01 17:25:23 +0300
committerValery Ivanov <ivalery111@gmail.com>2022-06-01 18:19:02 +0300
commit692a2aef28ca17b49100cee02e71b03db7a5c3ba (patch)
tree17ff0e9ba5deaae46c7ef952708d4cc540b8db52 /.github/workflows
parentc78f381d2248f3115cc842ef83794eb40159a583 (diff)
downloadlibnet-692a2aef28ca17b49100cee02e71b03db7a5c3ba.tar.gz
workflow: run unit-tests
Signed-off-by: Valery Ivanov <ivalery111@gmail.com>
Diffstat (limited to '.github/workflows')
-rw-r--r--.github/workflows/build.yml46
1 files changed, 46 insertions, 0 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index fb30e85..7b54db9 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -8,6 +8,9 @@ on:
env:
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners
MAKEFLAGS: -j3
+ GCC_CFLAGS: "-Wall -Wextra -Wshadow -Wunused -Wpedantic -Wmisleading-indentation -Wduplicated-cond -Wduplicated-branches -Wlogical-op"
+ CLANG_CFLAGS: "-Wall -Wextra -Wshadow -Wunused -Wpedantic"
+
jobs:
build:
@@ -47,3 +50,46 @@ jobs:
make V=1
make install-strip DESTDIR=/tmp
tree /tmp/usr
+ unit-tests:
+ strategy:
+ matrix:
+ name: [ ubuntu-latest-gcc, ubuntu-latest-clang, macos-latest-clang ]
+ include:
+ - name: ubuntu-latest-gcc
+ os: ubuntu-latest
+ cc: gcc
+ - name: ubuntu-latest-clang
+ os: ubuntu-latest
+ cc: clang
+ - name: macos-latest-clang
+ os: macos-latest
+ cc: clang
+
+ runs-on: ${{ matrix.os }}
+ steps:
+ - uses: actions/checkout@v2
+ - name: Install MacOS dependencies
+ if: startsWith(matrix.os,'macos')
+ run: |
+ brew update
+ brew install automake tree doxygen cmocka
+ - name: Install Linux dependencies
+ if: startsWith(matrix.os,'ubuntu')
+ run: |
+ sudo apt-get update
+ sudo apt-get install -y build-essential autoconf automake tree doxygen libcmocka-dev
+ - name: Configure
+ run: |
+ if ${{ matrix.cc == 'gcc' }}; then
+ ./autogen.sh
+ ./configure --prefix=/usr CC=${{ matrix.cc }} CFLAGS="${GCC_CFLAGS}" --enable-tests
+ else
+ ./autogen.sh
+ ./configure --prefix=/usr CC=${{ matrix.cc }} CFLAGS="${CLANG_CFLAGS}" --enable-tests
+ fi
+ - name: Build
+ run: |
+ make V=1
+ - name: Run Unit-Test
+ run: |
+ sudo ./tests/libnet_unit_tests