Skip to content

Workflow file for this run

name: Build and run tests
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
build:
strategy:
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations.
# Consider changing this to true when your workflow is stable.
fail-fast: true
# [Debug, Release, RelWithDebInfo]
# [g++, clang++, cl]
# [14, 17, 20, 23]
#
matrix:
os: [ubuntu-latest, windows-latest]
build_type: [Debug]
cpp_compiler: [clang++, cl]
cpp_standard: [14]
exclude:
- os: windows-latest
cpp_compiler: g++
- os: ubuntu-latest
cpp_compiler: cl
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Cache Google Test
id: cache-google-test
uses: actions/cache@v2
env:
cache-name: cache-google-test-repo
with:
path: googletest
key: ${{ matrix.os }}-build-${{ env.cache-name }}
- name: Install Google Test
if: steps.cache-google-test.outputs.cache-hit != 'true'
run: |
git clone https://github.com/google/googletest.git
mkdir googletest/build
cd googletest/build
cmake ..
make
- name: Cache Google Benchmark
id: cache-google-benchmark
uses: actions/cache@v2
env:
cache-name: cache-google-benchmark-repo
with:
path: benchmark
key: ${{ matrix.os }}-build-${{ env.cache-name }}
- name: Install Google Benchmark
if: steps.cache-google-benchmark.outputs.cache-hit != 'true'
run: |
git clone https://github.com/google/benchmark.git
mkdir benchmark/build
cd benchmark/build
cmake .. -DBENCHMARK_ENABLE_TESTING=OFF
make
# Configure CMake in a 'build' subdirectory.
# `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
#
- name: Configure CMake
run: |
cmake -S ${{ github.workspace }} -B ${{ github.workspace }}/build \
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} \
-DCMAKE_CXX_STANDARD=${{ matrix.cpp_standard }} \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DCMAKE_PREFIX_PATH="${{ github.workspace }}/benchmark/build;${{ github.workspace }}/googletest/build" \
-DGTEST_ROOT=${{ github.workspace }}/googletest
cd ${{ github.workspace }}/build
make
./bin/utest