Merge pull request #45 from orlitzky/underlinking #117
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
name: Build and run tests | |
on: [push, pull_request] | |
jobs: | |
build: | |
name: ${{ matrix.config.name }} | |
runs-on: ${{ matrix.config.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- { | |
name: "Windows", | |
os: windows-latest, | |
build_type: "Release", | |
generators: "Visual Studio 17 2022" | |
} | |
- { | |
name: "Ubuntu Linux", | |
os: ubuntu-latest, | |
build_type: "Release", | |
generators: "Ninja" | |
} | |
- { | |
name: "macOS", | |
os: macos-latest, | |
build_type: "Release", | |
generators: "Ninja" | |
} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install dependencies on Windows | |
if: startsWith(matrix.config.os, 'windows') | |
run: choco install -y --no-progress cmake ninja | |
- name: Install dependencies on Linux | |
if: startsWith(matrix.config.os, 'ubuntu') | |
run: | | |
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null | |
echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ focal main' | sudo tee /etc/apt/sources.list.d/kitware.list >/dev/null | |
sudo apt-get update | |
sudo apt-get install ninja-build cmake | |
- name: Install dependencies on macOS | |
if: startsWith(matrix.config.os, 'macos') | |
run: brew install cmake ninja | |
- name: Prepare build folder | |
shell: bash | |
run: | | |
mkdir build | |
cmake \ | |
-S . \ | |
-B build \ | |
-DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} \ | |
-G "${{ matrix.config.generators }}" \ | |
-DCMAKE_INSTALL_PREFIX:PATH=instdir | |
- name: Build project | |
shell: bash | |
run: cmake --build build --config ${{ matrix.config.build_type }} | |
- name: Run tests | |
shell: bash | |
env: | |
CTEST_OUTPUT_ON_FAILURE: 1 | |
run: | | |
cd build | |
ctest --output-junit report.xml | |
- name: Archive unit test results | |
uses: actions/upload-artifact@v2 | |
if: always() | |
with: | |
name: unit-test-results | |
path: build/report.xml | |
- name: Install and strip | |
shell: bash | |
run: cmake --install build --config ${{ matrix.config.build_type }} --strip |