-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (58 loc) · 2.14 KB
/
main.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
name: Build and run tests
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build_and_test:
timeout-minutes: 10
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
compiler: [gcc, clang, MSVC]
exclude:
- os: ubuntu-latest
compiler: MSVC
- os: windows-latest
compiler: gcc
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Ubuntu environment
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y build-essential cmake
- name: Set up Windows + clang environment
if: matrix.os == 'windows-latest' && matrix.compiler == 'clang'
run: choco install ninja -y
- name: Configure CMake for Ubuntu + gcc
if: matrix.os == 'ubuntu-latest' && matrix.compiler == 'gcc'
run: cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -B build
- name: Configure CMake for Ubuntu + clang
if: matrix.os == 'ubuntu-latest' && matrix.compiler == 'clang'
run: cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -B build
- name: Configure CMake for Windows + clang
if: matrix.os == 'windows-latest' && matrix.compiler == 'clang'
run: |
cmake "-DGTEST_LINKED_AS_SHARED_LIBRARY=ON" ^
"-DCMAKE_BUILD_TYPE=Release" ^
"-DCMAKE_C_COMPILER="C:\Program Files\LLVM\bin\clang.exe" ^
"-DCMAKE_CXX_COMPILER="C:\Program Files\LLVM\bin\clang++.exe" ^
"-G Ninja" ^
"-B build"
- name: Configure CMake for Windows + MSVC
if: matrix.os == 'windows-latest' && matrix.compiler == 'MSVC'
run: cmake -DCMAKE_BUILD_TYPE=Release -B build
- name: Build
run: cmake --build build
- name: Run tests
if: matrix.os == 'ubuntu-latest'
run: ./build/tests/run_tests
- name: Run tests
if: matrix.os == 'windows-latest'
run: .\build\tests\run_tests.exe