.github: build: rewrite and add clang+gcc build matrix

- add build matrix with both gcc and clang
 - run on all pushes and pull requests, except dev (coverity)
 - use DESTDIR for install, not --prefix
 - check install-strip with tree and ldd+size with usage
 - add example w/ libsyslog, from .travis.yml

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg 2021-07-26 23:30:34 +02:00
parent b0d4e4cc3f
commit e89ccd44ec
2 changed files with 55 additions and 28 deletions

55
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,55 @@
name: Bob the Builder
# Run on all branches, including all pull requests, except the 'dev'
# branch since that's where we run Coverity Scan (limited tokens/day)
on:
push:
branches:
- '**'
- '!dev'
pull_request:
branches:
- '**'
jobs:
build:
# Verify we can build on latest Ubuntu with both gcc and clang
name: ${{ matrix.compiler }}
strategy:
matrix:
compiler: [gcc, clang]
fail-fast: false
runs-on: ubuntu-latest
env:
MAKEFLAGS: -j3
CC: ${{ matrix.compiler }}
steps:
- name: Install build dependencies ...
run: |
sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install -qq -y tree tshark
- uses: actions/checkout@v2
- name: Configure
run: |
./autogen.sh
./configure --prefix=
- name: Build
run: |
make V=1
- name: Install
run: |
make V=1 DESTDIR=~/tmp install-strip
tree ~/tmp
ldd ~/tmp/sbin/syslogd
size ~/tmp/sbin/syslogd
~/tmp/sbin/syslogd -?
- name: Example w/ libsyslog
run: |
mkdir -p ~/tmp/example
cp -a example/example.* ~/tmp/example/
pushd ~/tmp/example/
PKG_CONFIG_LIBDIR=~/tmp/lib/pkgconfig make -f example.mk
popd
- name: Unit tests
run: |
sudo make check || (cat test/start.log; cat test/remote.log; false)

View File

@ -1,28 +0,0 @@
name: C/C++ CI
on: [push]
jobs:
build:
name: sysklogd ci
runs-on: ubuntu-latest
steps:
- name: Update packagage cache ...
run: sudo apt-get update
- name: Install build dependencies ...
run: sudo DEBIAN_FRONTEND=noninteractive apt-get install -qq -y tree tshark
- uses: actions/checkout@v1
- name: Generate and run configure script ...
run: ./autogen.sh && ./configure --disable-silent-rules
- name: Build project ...
run: make
- name: Run project unit tests ...
run: sudo make check || (cat cat test/start.log; cat test/remote.log; false)
# - name: clang-tidy check
# uses: muxee/clang-tidy-action@0.0.1-rc1
# - name: SonarCloud Scan
# uses: SonarSource/sonarcloud-github-action@v1.1
- name: Check project installation ...
run: make install-strip DESTDIR=/tmp/tok; tree /tmp/tok