-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (59 loc) · 2.41 KB
/
unit_tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
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