Skip to content

Add option to enable compiling with -Werror #2

Add option to enable compiling with -Werror

Add option to enable compiling with -Werror #2

Workflow file for this run

name: Build and Test CI - Linux
# Build and Test CI for ubuntu-latest
on: [ push, pull_request ]
jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: true
matrix:
config:
# <Ubuntu-latest Platform, Release Build, GCC toolchain, Ninja generator>
- name: "ubuntu latest gcc rel ninja"
os: ubuntu-latest
build_type: Release
cc: gcc
cxx: g++
cmake-opts: '-DUHDR_BUILD_TESTS=1 -DUHDR_ENABLE_LOGS=1 -DUHDR_ENABLE_INSTALL=1 -DUHDR_ENABLE_WERROR=1'
# <Ubuntu-latest Platform, Release Build, Clang toolchain, Ninja generator>
- name: "ubuntu latest clang rel ninja"
os: ubuntu-latest
build_type: Release
cc: clang
cxx: clang++
cmake-opts: '-DUHDR_BUILD_TESTS=1 -DUHDR_ENABLE_LOGS=1 -DUHDR_ENABLE_INSTALL=1 -DUHDR_ENABLE_WERROR=1'
# <Ubuntu-latest Platform, Release Build, GCC toolchain, Ninja generator, Build Deps>
- name: "ubuntu latest gcc rel ninja with deps"
os: ubuntu-latest
build_type: Release
cc: gcc
cxx: g++
cmake-opts: '-DUHDR_BUILD_TESTS=1 -DUHDR_ENABLE_LOGS=1 -DUHDR_BUILD_DEPS=1 -DUHDR_ENABLE_WERROR=1'
# <Ubuntu-latest Platform, Release Build, Clang toolchain, Ninja generator, Build Deps, Sanitizer Address>
- name: "ubuntu latest clang rel ninja with deps sanitize address"
os: ubuntu-latest
build_type: Release
cc: clang
cxx: clang++
cmake-opts: '-DUHDR_BUILD_TESTS=1 -DUHDR_ENABLE_LOGS=1 -DUHDR_BUILD_DEPS=1 -DUHDR_SANITIZE_OPTIONS=address -DUHDR_ENABLE_WERROR=1'
# <Ubuntu-latest Platform, Release Build, Clang toolchain, Ninja generator, Build Fuzzers, Sanitizer Address>
- name: "ubuntu latest clang rel ninja fuzzers sanitize address"
os: ubuntu-latest
build_type: Release
cc: clang
cxx: clang++
cmake-opts: '-DUHDR_BUILD_FUZZERS=1 -DUHDR_SANITIZE_OPTIONS=address -DUHDR_ENABLE_WERROR=1'
# <Ubuntu-latest Platform, Release Build, GCC toolchain, Ninja generator, Static linking>
- name: "ubuntu latest gcc rel ninja static"
os: ubuntu-latest
build_type: Release
cc: gcc
cxx: g++
cmake-opts: '-DUHDR_BUILD_TESTS=1 -DUHDR_ENABLE_LOGS=1 -DUHDR_ENABLE_INSTALL=1 -DBUILD_SHARED_LIBS=0 -DUHDR_ENABLE_WERROR=1'
# <Ubuntu-latest Platform, Release Build, Clang toolchain, Ninja generator, Static linking>
- name: "ubuntu latest clang rel ninja static"
os: ubuntu-latest
build_type: Release
cc: clang
cxx: clang++
cmake-opts: '-DUHDR_BUILD_TESTS=1 -DUHDR_ENABLE_LOGS=1 -DUHDR_ENABLE_INSTALL=1 -DBUILD_SHARED_LIBS=0 -DUHDR_ENABLE_WERROR=1'
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- name: Setup ninja
uses: seanmiddleditch/gha-setup-ninja@master
- name: Setup cmake
uses: jwlawson/actions-setup-cmake@v2
- name: Install dependencies on Ubuntu
run: sudo apt install -y libjpeg-dev
- name: Configure CMake
shell: bash
run: |
export CC=${{ matrix.config.cc }}
export CXX=${{ matrix.config.cxx }}
mkdir build
cmake -G Ninja -B build -DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} ${{ matrix.config.cmake-opts }}
- name: Build
run: cmake --build build --config ${{ matrix.config.build_type }}
- name: Test
working-directory: build
run: ctest --build-config ${{ matrix.config.build_type }}