Skip to content

Update main.yml

Update main.yml #18

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 -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl -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