improve testing support and the CI #64
Workflow file for this run
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: CMake | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
on: [push, pull_request, workflow_dispatch] | |
defaults: | |
run: | |
shell: bash --noprofile --norc -xeo pipefail {0} | |
env: | |
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) | |
BUILD_TYPE: Release | |
jobs: | |
build: | |
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac. | |
# You can convert this to a matrix build if you need cross-platform coverage. | |
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-20.04, macos-12] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install dependencies on Linux | |
if: runner.os == 'Linux' | |
run: | | |
packages=( | |
gnuplot | |
libgif-dev | |
libopenjp2-7-dev | |
libwebp-dev | |
ninja-build | |
) | |
sudo apt -q update | |
sudo apt -qy install --no-install-recommends "${packages[@]}" | |
cmake --version | |
- name: Install dependencies on macOS | |
if: runner.os == 'macOS' | |
run: | | |
packages=( | |
giflib | |
gnuplot | |
ninja | |
openjpeg | |
webp | |
) | |
brew install "${packages[@]}" | |
cmake --version | |
- name: Configure | |
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. | |
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type | |
# Note: `-DCMAKE_FIND_FRAMEWORK=LAST` is used to avoid a mismatch on macOS between | |
# the version of the PNG library linked with / used at runtime (provided by brew) | |
# and the version of the header used at compile time (provided by the system): | |
# libpng warning: Application built with libpng-1.4.12 but running with 1.6.40 | |
run: cmake -B build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -G Ninja -DCMAKE_FIND_FRAMEWORK=LAST -DSW_BUILD=OFF -DBUILD_PROG=ON -DBUILD_SHARED_LIBS=ON -DBUILD_TEST=ON | |
- name: Build | |
run: cmake --build build --config ${{env.BUILD_TYPE}} | |
- name: Test | |
run: ctest --test-dir build --build-config ${{env.BUILD_TYPE}} --output-on-failure --parallel 3 | |
- name: Install | |
run: sudo cmake --build build --config ${{env.BUILD_TYPE}} --target install |