Skip to content

Update CI workflow

Update CI workflow #24

Workflow file for this run

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