Fix building on Windows with MSYS2 #117
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 Build Matrix | |
on: [ push, pull_request ] | |
jobs: | |
build: | |
name: ${{ matrix.config.name }} | |
runs-on: ${{ matrix.config.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- name: "Ubuntu 22.04 GCC 11" | |
os: ubuntu-22.04 | |
build_type: Release | |
packages: ninja-build | |
generator: Ninja | |
compatibility: "cxx_std_11;cxx_std_17;cxx_std_20" | |
cc: gcc | |
cxx: g++ | |
- name: "Ubuntu 22.04 Clang 13.0" | |
os: ubuntu-22.04 | |
build_type: Release | |
packages: ninja-build libc++-13-dev libc++abi-13-dev | |
generator: Ninja | |
compatibility: "cxx_std_11;cxx_std_17;cxx_std_20" | |
cc: clang-13 | |
cxx: clang++-13 | |
- name: "Ubuntu 22.04 Clang 15.0" | |
os: ubuntu-22.04 | |
build_type: Release | |
packages: ninja-build libc++-15-dev libc++abi-15-dev | |
generator: Ninja | |
compatibility: "cxx_std_11;cxx_std_17;cxx_std_20" | |
cc: clang-15 | |
cxx: clang++-15 | |
- name: "Ubuntu 22.04 GCC 11 coverage" | |
os: ubuntu-22.04 | |
build_type: Debug | |
packages: ninja-build lcov | |
generator: Ninja | |
compatibility: "cxx_std_11;cxx_std_17;cxx_std_20" | |
cc: gcc | |
cxx: g++ | |
- name: "Ubuntu 20.04 GCC 9.3" | |
os: ubuntu-20.04 | |
build_type: Release | |
packages: ninja-build | |
generator: Ninja | |
compatibility: "cxx_std_11;cxx_std_17;cxx_std_20" | |
cc: gcc | |
cxx: g++ | |
- name: "Ubuntu 20.04 Clang 10.0" | |
os: ubuntu-20.04 | |
build_type: Release | |
packages: ninja-build | |
generator: Ninja | |
compatibility: "cxx_std_11;cxx_std_17;cxx_std_20" | |
cc: clang-10 | |
cxx: clang++-10 | |
- name: "Ubuntu 20.04 Clang 11.0" | |
os: ubuntu-20.04 | |
build_type: Release | |
packages: ninja-build clang-11 libc++-11-dev libc++abi-11-dev | |
generator: Ninja | |
compatibility: "cxx_std_11;cxx_std_17;cxx_std_20" | |
cc: clang-11 | |
cxx: clang++-11 | |
- name: "Ubuntu 20.04 GCC 9.3 coverage" | |
os: ubuntu-20.04 | |
build_type: Debug | |
packages: ninja-build lcov | |
generator: Ninja | |
compatibility: "cxx_std_11;cxx_std_17;cxx_std_20" | |
cc: gcc | |
cxx: g++ | |
- name: "Windows MSVC 2019" | |
os: windows-2019 | |
build_type: Release | |
build_std_testing: 'OFF' | |
packages: ninja | |
generator: "Visual Studio 16 2019" | |
compatibility: "cxx_std_11;cxx_std_17;cxx_std_20" | |
cc: cl | |
cxx: cl | |
- name: "Windows MSYS2 UCRT64" | |
os: windows-2019 | |
msystem: ucrt64 | |
build_type: Release | |
build_std_testing: 'OFF' | |
packages: cmake gcc ninja | |
generator: Ninja | |
compatibility: "cxx_std_11;cxx_std_17;cxx_std_20" | |
cc: gcc | |
cxx: g++ | |
- name: "Windows MSYS2 CLANG64" | |
os: windows-2019 | |
msystem: clang64 | |
build_type: Release | |
packages: cmake clang ninja | |
generator: Ninja | |
compatibility: "cxx_std_11;cxx_std_17;cxx_std_20" | |
cc: clang | |
cxx: clang++ | |
- name: "macOS 13 AppleClang" | |
os: macos-13 | |
build_type: Release | |
packages: ninja | |
generator: Ninja | |
compatibility: "cxx_std_11;cxx_std_17;cxx_std_20" | |
cc: clang | |
cxx: clang++ | |
steps: | |
- uses: actions/checkout@v2 | |
- name: print environment | |
run: | | |
echo github.event.action: ${{ github.event.action }} | |
echo github.event_name: ${{ github.event_name }} | |
- name: Install dependencies on Ubuntu | |
if: startsWith(matrix.config.os, 'ubuntu') | |
shell: bash | |
run: | | |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y | |
sudo apt update | |
sudo apt install ${{ matrix.config.packages }} | |
- name: Install dependencies on windows (MSVC) | |
if: startsWith(matrix.config.os, 'windows') && matrix.config.msystem == '' | |
run: | | |
choco install ${{ matrix.config.packages }} | |
- name: Install dependencies on windows (MSYS2) | |
if: startsWith(matrix.config.os, 'windows') && matrix.config.msystem != '' | |
uses: msys2/setup-msys2@v2 | |
with: | |
msystem: ${{ matrix.config.msystem }} | |
update: true | |
pacboy: ${{ matrix.config.packages }} | |
- name: Install dependencies on macOS | |
if: startsWith(matrix.config.os, 'macos') | |
run: | | |
brew install ${{ matrix.config.packages }} | |
- name: Configure project | |
if: matrix.config.msystem == '' | |
shell: bash | |
run: | | |
export CC=${{ matrix.config.cc }} | |
export CXX=${{ matrix.config.cxx }} | |
ninja --version | |
cmake --version | |
mkdir build | |
mkdir install | |
args=(-G "${{ matrix.config.generator }}" -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }}) | |
[[ "${{ matrix.config.build_type }}" == "Debug" ]] && args+=(-DGHC_COVERAGE=ON) | |
[[ -n "${{ matrix.config.msystem }}" ]] && args+=(-DGHC_FILESYSTEM_BUILD_STD_TESTING=NO) | |
args+=(-DCMAKE_INSTALL_PREFIX:PATH=install) | |
cmake "${args[@]}" | |
- name: Configure project (MSYS2) | |
if: matrix.config.msystem != '' | |
shell: msys2 {0} | |
run: | | |
export CC=${{ matrix.config.cc }} | |
export CXX=${{ matrix.config.cxx }} | |
ninja --version | |
cmake --version | |
mkdir build | |
mkdir install | |
args=(-G "${{ matrix.config.generator }}" -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }}) | |
[[ "${{ matrix.config.build_type }}" == "Debug" ]] && args+=(-DGHC_COVERAGE=ON) | |
[[ -n "${{ matrix.config.msystem }}" ]] && args+=(-DGHC_FILESYSTEM_BUILD_STD_TESTING=NO) | |
args+=(-DCMAKE_INSTALL_PREFIX:PATH=install) | |
cmake "${args[@]}" | |
- name: Build project | |
if: matrix.config.msystem == '' | |
shell: bash | |
run: | | |
cmake --build build --config ${{ matrix.config.build_type }} | |
- name: Build project (MSYS2) | |
if: matrix.config.msystem != '' | |
shell: msys2 {0} | |
run: | | |
cmake --build build --config ${{ matrix.config.build_type }} | |
- name: Run tests | |
if: matrix.config.msystem == '' | |
shell: bash | |
run: | | |
cd build && ctest -C ${{ matrix.config.build_type }} | |
- name: Run tests (MSYS2) | |
if: matrix.config.msystem != '' | |
shell: msys2 {0} | |
run: | | |
cd build && ctest -C ${{ matrix.config.build_type }} | |
- name: Collect coverage info | |
if: startsWith(matrix.config.build_type, 'Debug') | |
run: | | |
cd build | |
lcov --compat-libtool --directory . --capture --output-file coverage_output.info | |
lcov --remove coverage_output.info '/usr/*' '*/c++/*' '*.h' '*/catch.hpp' -o coverage.info | |
# sed -i 's|SF:/.*/filesystem/|SF:../|g' coverage.info | |
- name: Upload coverage info | |
if: startsWith(matrix.config.build_type, 'Debug') | |
env: | |
COVERALLS_DEBUG: true | |
NODE_COVERALLS_DEBUG: 1 | |
uses: coverallsapp/github-action@master | |
with: | |
path-to-lcov: ${{ github.workspace }}/build/coverage.info | |
github-token: ${{ secrets.GITHUB_TOKEN }} |