Skip to content

[pre-commit.ci] pre-commit autoupdate #100

[pre-commit.ci] pre-commit autoupdate

[pre-commit.ci] pre-commit autoupdate #100

Workflow file for this run

name: CI
on:
# We run CI on pushes to the main branch
push:
branches:
- main
# and on all pull requests to the main branch
pull_request:
branches:
- main
# as well as upon manual triggers through the 'Actions' tab of the Github UI
workflow_dispatch:
defaults:
run:
shell: bash
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v4
with:
submodules: "recursive"
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Build & test
run: |
mkdir build && cd build
cmake -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Release ..
cmake --build . --config Release -j 4
ctest
- name: Run benchmark and plot results
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
./build/bench/Release/bench5.exe --benchmark_out=bench5.json --benchmark_min_time=0.1
else
./build/bench/bench5 --benchmark_out=bench5.json --benchmark_min_time=0.1
fi
pip install -r plots/requirements.txt
./plots/plot.py bench5.json
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: "recursive"
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- run: pip install gcovr
- name: Build & test
run: |
mkdir build && cd build
cmake -DBUILD_TESTING=ON -DCPPBENCH_BUILD_BENCHMARKS=OFF -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="--coverage" ..
cmake --build . -j 4
ctest
- name: Generate coverage report
run: |
gcovr --exclude-throw-branches -r . -f include/ --xml -o coverage.xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
files: ./coverage.xml
verbose: true