Merge branch 'libnet:master' into develop #80
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Linux/macOS | |
on: [push, pull_request] | |
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: | |
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@v4 | |
- name: Install MacOS dependencies | |
if: startsWith(matrix.os,'macos') | |
run: | | |
brew update | |
brew install autoconf automake libtool tree doxygen | |
- name: Install Linux dependencies | |
if: startsWith(matrix.os,'ubuntu') | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y build-essential autoconf automake libtool clang tree doxygen | |
- name: Configure | |
run: | | |
./autogen.sh | |
./configure --prefix=/usr CC=${{ matrix.cc }} | |
- name: Build | |
run: | | |
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@v4 | |
- name: Install MacOS dependencies | |
if: startsWith(matrix.os,'macos') | |
run: | | |
brew update | |
brew install autoconf automake libtool pkg-config 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 libtool pkg-config 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 Linux unit tests | |
if: startsWith(matrix.os,'ubuntu') | |
run: | | |
rc=true | |
make check || rc=false | |
echo "## Test Results" >> $GITHUB_STEP_SUMMARY | |
echo '```' >> $GITHUB_STEP_SUMMARY | |
cat test/test-suite.log >> $GITHUB_STEP_SUMMARY | |
echo '```' >> $GITHUB_STEP_SUMMARY | |
cat test/test-suite.log | |
eval $rc | |
- name: Run macOS unit tests | |
if: startsWith(matrix.os,'macos') | |
run: | | |
rc=true | |
sudo make check || rc=false | |
echo "## Test Results" >> $GITHUB_STEP_SUMMARY | |
echo '```' >> $GITHUB_STEP_SUMMARY | |
cat test/test-suite.log >> $GITHUB_STEP_SUMMARY | |
echo '```' >> $GITHUB_STEP_SUMMARY | |
cat test/test-suite.log | |
ls -l /dev/bpf* || true | |
eval $rc |