Added Menaures' Crasher as a test setup #475
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: build-and-test | |
on: [push, pull_request] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
cc: [gcc, clang] | |
coverage: [false, true] | |
machine: [i386, amd64] | |
exclude: | |
- machine: i386 | |
coverage: true | |
continue-on-error: ${{ matrix.coverage }} | |
steps: | |
- name: Install dependencies | |
run: | | |
${{ matrix.machine == 'i386' && 'sudo dpkg --add-architecture i386' || 'true' }} | |
sudo apt-get update -y | |
sudo apt-get install -y --no-install-recommends ${{ matrix.cc }} bison autoconf autogen ${{matrix.machine=='i386' && 'gcc-multilib' || ''}} libgcc-s1:${{matrix.machine}} libstdc++6:${{matrix.machine}} libgcrypt20-dev:${{matrix.machine}} libgnutls28-dev:${{matrix.machine}} libsqlite3-dev:${{matrix.machine}} libpq-dev:${{matrix.machine}} libmysqlclient-dev:${{matrix.machine}} ${{ matrix.machine == 'amd64' && 'python3-dev python3' || '' }} libpcre3-dev:${{matrix.machine}} libjson-c-dev:${{matrix.machine}} libxml2-dev:${{matrix.machine}} zlib1g-dev:${{matrix.machine}} ${{ (matrix.cc == 'gcc' && matrix.coverage) && 'lcov python3-pip' || ''}} ${{ (matrix.cc == 'clang' && matrix.coverage) && 'llvm' || ''}} | |
- name: Checkout sources | |
uses: actions/checkout@v3 | |
- name: Generate build files | |
working-directory: src | |
run: ./autogen.sh | |
- name: Configure build | |
working-directory: src | |
shell: sh | |
run: ./configure --enable-use-ipv6 --enable-use-mccp --enable-use-json --enable-use-pcre | |
--enable-use-mysql --enable-use-pgsql --enable-use-sqlite | |
--enable-use-xml --enable-use-tls --enable-use-gcrypt | |
--enable-malloc-trace --enable-malloc-lpc-trace --enable-dynamic-costs | |
--enable-eval-cost-trace --enable-trace-code --enable-swap-efun | |
${{ matrix.machine == 'amd64' && '--enable-use-python' || '' }} | |
${{ matrix.machine == 'i386' && '--target=i686-pc-linux-gnu' || '' }} | |
${{ matrix.coverage && '--with-optimize=no' || ''}} | |
EXTRA_CFLAGS="-DINSIDE_TRAVIS -Werror ${{ matrix.machine == 'i386' && '-m32' || '' }} ${{ matrix.cc == 'gcc' && '-Wno-unused-result' || '' }} ${{ matrix.cc == 'gcc' && !matrix.coverage && '-D_FORTIFY_SOURCE=2' || '' }}" | |
${{ matrix.machine == 'i386' && 'LDFLAGS=-m32'}} | |
CC=${{ matrix.cc }} | |
- name: Build driver | |
working-directory: src | |
run: make ${{ matrix.cc == 'gcc' && matrix.coverage && 'PROFIL="--coverage"' || ''}} ${{ matrix.cc == 'clang' && matrix.coverage && 'PROFIL="-fprofile-instr-generate -fcoverage-mapping "' || ''}} | |
- name: Run tests | |
working-directory: test | |
shell: sh | |
run: ./run.sh | |
- name: Generate coverage reports (gcc) | |
if: matrix.cc == 'gcc' && matrix.coverage | |
shell: bash | |
working-directory: test | |
run: | | |
pip3 install fastcov | |
for dir in coverage/t-*; do ln ../src/*.gcno "$dir"; done | |
fastcov -d coverage -c ../src -e /usr/include --lcov -o coverage.info | |
genhtml coverage.info --output-directory html | |
- name: Generate coverage reports (clang) | |
if: matrix.cc == 'clang' && matrix.coverage | |
shell: bash | |
working-directory: test | |
run: | | |
llvm-profdata merge -sparse coverage/*.profraw -o coverage.profdata | |
llvm-cov show ../src/ldmud -instr-profile=coverage.profdata -format=html -output-dir=html -show-instantiations=false | |
- name: Upload coverage report | |
if: matrix.coverage | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage ${{ matrix.cc }} | |
path: test/html |