-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (57 loc) · 2.4 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
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 environment
shell: cmake -P {0}
run: |
if ("${{ matrix.compiler }}" STREQUAL "msvc")
file(APPEND $ENV{GITHUB_ENV} "VCPKG_TARGET_TRIPLET=x64-windows\n")
file(APPEND $ENV{GITHUB_ENV} "CXXFLAGS=/EHsc /W4\n")
file(APPEND $ENV{GITHUB_ENV} "CFLAGS=/EHsc /W4\n")
else()
file(APPEND $ENV{GITHUB_ENV} "VCPKG_TARGET_TRIPLET=x64-linux\n")
file(APPEND $ENV{GITHUB_ENV} "CXXFLAGS=-Wall -Wextra -Wpedantic -Wconversion -Wshadow\n")
file(APPEND $ENV{GITHUB_ENV} "CFLAGS=-Wall -Wextra -Wpedantic -Wconversion -Wshadow\n")
if ("${{ matrix.compiler }}" STREQUAL "gcc")
file(APPEND $ENV{GITHUB_ENV} "CC=gcc-13\n")
file(APPEND $ENV{GITHUB_ENV} "CXX=g++-13\n")
else()
file(APPEND $ENV{GITHUB_ENV} "CC=clang-15\n")
file(APPEND $ENV{GITHUB_ENV} "CXX=clang++-15\n")
endif()
endif()
file(APPEND $ENV{GITHUB_ENV} "CMAKE_TOOLCHAIN_FILE=$ENV{VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake\n")
- name: Configure
run: cmake -S . -B build -D CMAKE_BUILD_TYPE=${{ matrix.config }}
- 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@v4
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