Skip to content

Using another strategy to set those variables #217

Using another strategy to set those variables

Using another strategy to set those variables #217

Workflow file for this run

name: unit tests
on: [push]
jobs:
unit-tests:
runs-on: ${{ matrix.os }}
strategy:
matrix:
config: [Release, Debug]
os: [ubuntu-latest, windows-latest]
compiler: [gcc, clang, msvc]
exclude:
- os: windows-latest
compiler: gcc
- os: windows-latest
compiler: clang
- os: ubuntu-latest
compiler: msvc
steps:
- uses: actions/checkout@v4
- name: Get latest cmake
uses: lukka/get-cmake@latest
- name: Set MSVC environment
if: matrix.compiler == 'msvc'
run: |
echo "VCPKG_TARGET_TRIPLET=x64-windows" >> $ebv.GITHUB_ENV
echo CXXFLAGS="/EHsc /W4" >> $ebv.GITHUB_ENV
echo CFLAGS="/EHsc /W4" >> $ebv.GITHUB_ENV
- name: Set GCC
if: matrix.compiler == 'gcc'
run: |
echo VCPKG_TARGET_TRIPLET=x64-linux >> $GITHUB_ENV
echo CXXFLAGS="-Wall -Wextra -Wpedantic -Wconversion -Wshadow" >> $GITHUB_ENV
echo CFLAGS="-Wall -Wextra -Wpedantic -Wconversion -Wshadow" >> $GITHUB_ENV
echo CC=gcc-13 >> $GITHUB_ENV
echo CXX=g++-13 >> $GITHUB_ENV
- name: Set CLang
if: matrix.compiler == 'clang'
run: |
echo VCPKG_TARGET_TRIPLET=x64-linux >> $GITHUB_ENV
echo CXXFLAGS="-Wall -Wextra -Wpedantic -Wconversion -Wshadow" >> $GITHUB_ENV
echo CFLAGS="-Wall -Wextra -Wpedantic -Wconversion -Wshadow" >> $GITHUB_ENV
echo CC=clang-15 >> $GITHUB_ENV
echo CXX=clang++-15 >> $GITHUB_ENV
- name: Configure
run: cmake -S . -B build -D CMAKE_BUILD_TYPE=${{ matrix.config }} --toolchain "${VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake"
- name: Build
run: cmake --build build --config ${{ matrix.config }} --parallel
- name: Execute
run: ctest --test-dir build -C ${{ matrix.config }}
- name: Publish test report
uses: mikepenz/action-junit-report@v3
with:
report_paths: 'build/test/junit_*.xml'
- name: Install
run: cmake --install build --prefix install --config ${{ matrix.config }}
- name: Configure with install
run: cmake -S test -B install_build -D CMAKE_BUILD_TYPE=${{ matrix.config }} -D "io1_DIR=../install/share/io1/cmake"
- name: Build with install
run: cmake --build install_build --config ${{ matrix.config }} --parallel