blob: 7f1a759f76ce8cb1c5d9daed4f97295a5292671c [file] [log] [blame]
# Based on: https://github.com/onqtam/doctest/blob/master/.github/workflows/main.yml
name: CI
on: [push, pull_request]
jobs:
ci:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
env:
CMAKE_GENERATOR: Ninja
strategy:
fail-fast: false
matrix:
name: [
ubuntu-18.04-gcc-4.9,
ubuntu-18.04-gcc-5,
ubuntu-18.04-gcc-6,
ubuntu-18.04-gcc-7,
ubuntu-18.04-gcc-8,
ubuntu-18.04-gcc-9,
ubuntu-18.04-clang-3.5,
ubuntu-18.04-clang-3.8,
ubuntu-18.04-clang-4.0,
ubuntu-18.04-clang-5.0,
ubuntu-18.04-clang-6.0,
ubuntu-18.04-clang-7,
ubuntu-18.04-clang-8,
ubuntu-20.04-clang-9,
windows-2016-cl,
windows-2016-clang-cl,
windows-2016-clang,
windows-2016-gcc,
windows-2019-cl,
windows-2019-clang-cl,
windows-2019-clang,
windows-2019-gcc,
macOS-10.15-gcc-7,
macOS-10.15-gcc-8,
macOS-10.15-gcc-9,
macOS-latest-xcode-11.3,
macOS-latest-xcode-12.2,
]
include:
- name: ubuntu-18.04-gcc-4.9
os: ubuntu-18.04
compiler: gcc
version: "4.9"
- name: ubuntu-18.04-gcc-5
os: ubuntu-18.04
compiler: gcc
version: "5"
- name: ubuntu-18.04-gcc-6
os: ubuntu-18.04
compiler: gcc
version: "6"
- name: ubuntu-18.04-gcc-7
os: ubuntu-18.04
compiler: gcc
version: "7"
- name: ubuntu-18.04-gcc-8
os: ubuntu-18.04
compiler: gcc
version: "8"
- name: ubuntu-18.04-gcc-9
os: ubuntu-18.04
compiler: gcc
version: "9"
- name: ubuntu-18.04-clang-3.5
os: ubuntu-18.04
compiler: clang
version: "3.5"
- name: ubuntu-18.04-clang-3.8
os: ubuntu-18.04
compiler: clang
version: "3.8"
- name: ubuntu-18.04-clang-4.0
os: ubuntu-18.04
compiler: clang
version: "4.0"
- name: ubuntu-18.04-clang-5.0
os: ubuntu-18.04
compiler: clang
version: "5.0"
- name: ubuntu-18.04-clang-6.0
os: ubuntu-18.04
compiler: clang
version: "6.0"
- name: ubuntu-18.04-clang-7
os: ubuntu-18.04
compiler: clang
version: "7"
- name: ubuntu-18.04-clang-8
os: ubuntu-18.04
compiler: clang
version: "8"
- name: ubuntu-20.04-clang-9
os: ubuntu-20.04
compiler: clang
version: "9"
- name: windows-2016-cl
os: windows-2016
compiler: cl
- name: windows-2016-clang-cl
os: windows-2016
compiler: clang-cl
- name: windows-2016-clang
os: windows-2016
compiler: clang
- name: windows-2019-cl
os: windows-2019
compiler: cl
- name: windows-2016-gcc
os: windows-2016
compiler: gcc
- name: windows-2019-clang-cl
os: windows-2019
compiler: clang-cl
- name: windows-2019-clang
os: windows-2019
compiler: clang
- name: windows-2019-gcc
os: windows-2019
compiler: gcc
- name: macOS-10.15-gcc-7
os: macOS-10.15
compiler: gcc
version: "7"
- name: macOS-10.15-gcc-8
os: macOS-10.15
compiler: gcc
version: "8"
- name: macOS-10.15-gcc-9
os: macOS-10.15
compiler: gcc
version: "9"
- name: macOS-latest-xcode-11.3
os: macOS-latest
compiler: xcode
version: "11.3"
- name: macOS-latest-xcode-12.2
os: macOS-latest
compiler: xcode
version: "12.2"
steps:
- uses: actions/checkout@v1
- name: Install (Linux)
if: runner.os == 'Linux'
run: |
# Required for libc6-dbg:i386 and g++-multilib packages which are
# needed for x86 builds.
sudo dpkg --add-architecture i386
# clang-3.7 and earlier are not available in Bionic anymore so we get
# them from the Xenial repositories instead.
sudo add-apt-repository "deb http://dk.archive.ubuntu.com/ubuntu/ xenial main"
sudo add-apt-repository "deb http://dk.archive.ubuntu.com/ubuntu/ xenial universe"
sudo apt-get update
# libc6-dbg:i386 is required for running valgrind on x86.
sudo apt-get install -y ninja-build valgrind libc6-dbg:i386
if [ "${{ matrix.compiler }}" = "gcc" ]; then
sudo apt-get install -y g++-${{ matrix.version }} g++-${{ matrix.version }}-multilib
echo "CC=gcc-${{ matrix.version }}" >> $GITHUB_ENV
echo "CXX=g++-${{ matrix.version }}" >> $GITHUB_ENV
else
sudo apt-get install -y clang-${{ matrix.version }} g++-multilib
echo "CC=clang-${{ matrix.version }}" >> $GITHUB_ENV
echo "CXX=clang++-${{ matrix.version }}" >> $GITHUB_ENV
fi
- name: Install (macOS)
if: runner.os == 'macOS'
run: |
brew install ninja
if [ "${{ matrix.compiler }}" = "gcc" ]; then
brew install gcc@${{ matrix.version }}
brew link gcc@${{ matrix.version }}
echo "CC=gcc-${{ matrix.version }}" >> $GITHUB_ENV
echo "CXX=g++-${{ matrix.version }}" >> $GITHUB_ENV
else
sudo xcode-select -switch /Applications/Xcode_${{ matrix.version }}.app
echo "CC=clang" >> $GITHUB_ENV
echo "CXX=clang++" >> $GITHUB_ENV
fi
- name: Install (Windows)
if: runner.os == 'Windows'
shell: powershell
run: |
Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')
scoop install ninja --global
if ("${{ matrix.compiler }}".StartsWith("clang")) {
scoop install llvm --global
}
if ("${{ matrix.compiler }}" -eq "gcc") {
# Chocolatey GCC is broken on the windows-2019 image.
# See: https://github.com/DaanDeMeyer/doctest/runs/231595515
# See: https://github.community/t5/GitHub-Actions/Something-is-wrong-with-the-chocolatey-installed-version-of-gcc/td-p/32413
# scoop install gcc --global
choco install mingw
echo "CC=gcc" >> $GITHUB_ENV
echo "CXX=g++" >> $GITHUB_ENV
} elseif ("${{ matrix.compiler }}" -eq "clang") {
echo "CC=clang" >> $GITHUB_ENV
echo "CXX=clang++" >> $GITHUB_ENV
} else {
echo "CC=${{ matrix.compiler }}" >> $GITHUB_ENV
echo "CXX=${{ matrix.compiler }}" >> $GITHUB_ENV
}
# Scoop modifies the PATH so we make the modified PATH global.
echo "PATH=$env:PATH" >> $GITHUB_ENV
- name: Configure
if: runner.os == 'Windows'
run: .github\workflows\vsenv.bat -arch=x64 -host_arch=x64
- name: Build & Test Debug
run: |
cmake -E remove_directory build
cmake -B build -S . -DCMAKE_BUILD_TYPE=Debug
cmake --build build -j2
cd build && ctest -j2 --output-on-failure
- name: Build & Test Release
run: |
cmake -E remove_directory build
cmake -B build -S . -DCMAKE_BUILD_TYPE=Release
cmake --build build -j2
cd build && ctest -j2 --output-on-failure