Update README.md for reduce #216
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Heavily inspired (i.e. copy/paste) from https://gist.github.com/NickNaso/0d478f1481686d5bcc868cac06620a60 | |
name: CMake Build Matrix | |
# Controls when the action will run. Triggers the workflow on push | |
on: | |
push: | |
pull_request: | |
release: | |
# tags: | |
# - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow contains a single job called "build" | |
build: | |
# The type of runner that the job will run on | |
name: ${{ matrix.config.name }} | |
runs-on: ${{ matrix.config.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- { | |
name: "Windows Latest MSVC (C++11)", | |
os: windows-latest, | |
build_type: "Debug", | |
cc: "cl", | |
cxx: "cl", | |
environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat", | |
generators: "Visual Studio 17 2022" | |
} | |
- { | |
name: "Windows Latest MSVC (C++17)", | |
os: windows-latest, | |
build_type: "Debug", | |
cc: "cl", | |
cxx: "cl", | |
environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat", | |
generators: "Visual Studio 17 2022" | |
} | |
- { | |
name: "Ubuntu Latest GCC (C++11)", | |
os: ubuntu-latest, | |
build_type: "Debug", | |
cc: "gcc", | |
cxx: "g++", | |
generators: "Ninja" | |
} | |
- { | |
name: "Ubuntu Latest GCC (C++17)", | |
os: ubuntu-latest, | |
build_type: "Debug", | |
cc: "gcc", | |
cxx: "g++", | |
generators: "Ninja" | |
} | |
- { | |
name: "macOS Latest Clang (C++11)", | |
os: macos-latest, | |
build_type: "Debug", | |
cc: "clang", | |
cxx: "clang++", | |
generators: "Xcode" | |
} | |
- { | |
name: "macOS Latest Clang (C++17)", | |
os: macos-latest, | |
build_type: "Debug", | |
cc: "clang", | |
cxx: "clang++", | |
generators: "Xcode" | |
} | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v2 | |
- name: Print env | |
run: | | |
echo github.event.action: ${{ github.event.action }} | |
echo github.event_name: ${{ github.event_name }} | |
- name: Install dependencies on windows | |
if: startsWith(matrix.config.os, 'windows') | |
run: | | |
choco install ninja cmake | |
ninja --version | |
cmake --version | |
- name: Install dependencies on ubuntu | |
if: startsWith(matrix.config.name, 'Ubuntu Latest GCC') | |
run: | | |
sudo apt-get update | |
sudo apt-get install ninja-build cmake libtbb-dev | |
ninja --version | |
cmake --version | |
gcc --version | |
- name: Install dependencies on macos | |
if: startsWith(matrix.config.os, 'macos') | |
run: | | |
brew install cmake ninja | |
ninja --version | |
cmake --version | |
- name: Configure C++11 | |
shell: bash | |
if: contains(matrix.config.name, 'C++11') | |
run: | | |
mkdir build | |
cmake \ | |
-S . \ | |
-B build \ | |
-DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} \ | |
-G "${{ matrix.config.generators }}" | |
- name: Configure C++17 | |
shell: bash | |
if: contains(matrix.config.name, 'C++17') | |
run: | | |
mkdir build | |
cmake \ | |
-S . \ | |
-B build \ | |
-DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} \ | |
-DCMAKE_CXX_STANDARD=17 \ | |
-G "${{ matrix.config.generators }}" | |
- name: Build | |
shell: bash | |
run: cmake --build build --config ${{ matrix.config.build_type }} | |
- name: Run tests on Windows | |
if: startsWith(matrix.config.os, 'windows') | |
shell: bash | |
run: | | |
status=$? | |
cmd="build/bin/${{ matrix.config.build_type }}/unit_tests" | |
$cmd | |
status=$? | |
[ $status -eq 0 ] && exit 0 || exit 1 | |
- name: Run tests on macos | |
if: startsWith(matrix.config.os, 'macos') | |
shell: bash | |
run: | | |
status=$? | |
cmd="build/tests/${{ matrix.config.build_type }}/unit_tests" | |
$cmd | |
status=$? | |
[ $status -eq 0 ] && exit 0 || exit 1 | |
- name: Run tests on Ubuntu | |
if: startsWith(matrix.config.name, 'Ubuntu Latest GCC') | |
shell: bash | |
run: | | |
status=$? | |
cmd="./build/tests/unit_tests" | |
$cmd | |
status=$? | |
[ $status -eq 0 ] && exit 0 || exit 1 |