👷 Test with different environments #77
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
on: | |
pull_request: | |
push: | |
branches: | |
- master | |
- main | |
- develop | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
ctest: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ ubuntu-latest ] | |
compiler: | |
- g++-10 | |
- g++-11 | |
- g++-12 | |
- g++-13 | |
- clang++-12 | |
- clang++-13 | |
- clang++-14 | |
- clang++-15 | |
std: | |
- 11 | |
- 14 | |
- 17 | |
- 20 | |
- 23 | |
stdlib: | |
- libstdc++ | |
- libc++ | |
generator: [ Ninja ] | |
include: | |
- os: ubuntu-latest | |
compiler: g++ | |
coverage: true | |
generator: Ninja | |
- os: windows-latest | |
- os: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: 'recursive' | |
- name: Setup Ninja | |
if: ${{ matrix.generator == 'Ninja' }} | |
uses: seanmiddleditch/gha-setup-ninja@v4 | |
- name: Setup Depenedencies | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
shell: bash | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y ${{ matrix.compiler }} | |
- uses: actions/cache@v4 | |
with: | |
path: build/_deps/*-src | |
key: cmake-dependency-src-${{ hashFiles('**/CMakeLists.txt') }} | |
restore-keys: | | |
cmake-dependency-src- | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
build/_deps/*-build | |
build/_deps/*-subbuild | |
key: cmake-dependency-builds-${{ runner.os }}-${{ matrix.compiler }}-${{ matrix.std }}-${{ hashFiles('**/CMakeLists.txt') }} | |
restore-keys: | | |
cmake-dependency-builds-${{ runner.os }}-${{ matrix.compiler }}- | |
cmake-dependency-builds-${{ runner.os }}- | |
- name: Configure and Build Project | |
uses: threeal/[email protected] | |
with: | |
run-build: true | |
args: >- | |
-DCMAKE_BUILD_TYPE=Debug | |
-DCMAKE_VERBOSE_MAKEFILE=ON | |
-DENABLE_COVERAGE=${{ matrix.coverage == true && 'ON' || 'OFF' }} | |
${{ matrix.std && format('-DCMAKE_CXX_STANDARD={0}', matrix.std) || '' }} | |
${{ matrix.stdlib && format('-DCMAKE_CXX_STANDARD_LIB={0}', matrix.stdlib) || '' }} | |
cxx-compiler: ${{ matrix.compiler }} | |
cxx-flags: ${{ matrix.std && format('-std=c++{0}', matrix.std) || '' }} | |
- name: Test Project | |
uses: threeal/[email protected] | |
with: | |
build-config: Debug | |
- name: Check Coverage | |
if: ${{ matrix.coverage == true }} | |
uses: threeal/gcovr-action@xml-out | |
with: | |
xml-out: './build/coverage.xml' | |
coveralls-out: './build/coveralls.json' | |
excludes: | | |
build/* | |
test/* | |
- name: Upload coverage reports to Codecov | |
if: ${{ matrix.coverage == true }} | |
uses: codecov/codecov-action@v4 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
with: | |
fail_ci_if_error: true | |
files: ./build/coverage.xml | |
disable_search: true |