simplified handling of dependencies #84
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: Googlebenchmark | |
on: | |
push: | |
branches: | |
- main | |
permissions: | |
# deployments permission to deploy GitHub pages website | |
deployments: write | |
# contents permission to update benchmark contents in gh-pages branch | |
contents: write | |
jobs: | |
benchmark: | |
name: Performance regression check | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Loki | |
uses: actions/checkout@v2 | |
- name: Checkout Google Benchmark | |
uses: actions/checkout@v2 | |
with: | |
repository: google/benchmark | |
path: 'benchmark' | |
ref: '4575fc415f17c45911f7df7aacbf83a378c5565a' # they plan to add a dependency to abseil soon that we want to avoid | |
- name: Cache Google Benchmark | |
id: cache-benchmark | |
uses: actions/cache@v2 | |
with: | |
path: benchmark-install | |
key: ${{ runner.os }}-benchmark-${{ hashFiles('**/benchmark/CMakeLists.txt') }} # Unique key based on OS and CMake file | |
- name: Build and Install Google Benchmark | |
if: steps.cache-benchmark.outputs.cache-hit != 'true' | |
run: | | |
cd benchmark | |
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DBENCHMARK_ENABLE_GTEST_TESTS=OFF -DCMAKE_INSTALL_PREFIX="$GITHUB_WORKSPACE/benchmark-install" | |
cmake --build build -j$(nproc) | |
cmake --install build | |
- name: Download and extract boost, no building required | |
run: | | |
wget --no-check-certificate 'https://archives.boost.io/release/1.84.0/source/boost_1_84_0.tar.gz' | |
tar xf boost_1_84_0.tar.gz | |
- name: Configure CMake | |
run: cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_BENCHMARKING:BOOL=TRUE -DCMAKE_PREFIX_PATH="$GITHUB_WORKSPACE/benchmark-install;$GITHUB_WORKSPACE/boost_1_84_0" -S . -B build | |
- name: Build Loki | |
run: export CXXFLAGS="-Werror" && cmake --build build -j$(nproc) | |
# Run benchmarks and store the output to a file | |
- name: Run benchmark construct_atoms | |
run: build/benchmarks/construct_atoms --benchmark_format=json | tee benchmark_result_construct_atoms.json | |
- name: Run benchmark iterate_atoms | |
run: build/benchmarks/iterate_atoms --benchmark_format=json | tee benchmark_result_iterate_atoms.json | |
# Combine outputs to a single file | |
- name: Combine JSON files | |
run: python3 benchmarks/combine_results.py benchmark_result_construct_atoms.json benchmark_result_iterate_atoms.json > benchmark_result.json | |
# Run `github-action-benchmark` action | |
- name: Store benchmark result | |
uses: benchmark-action/github-action-benchmark@v1 | |
with: | |
# What benchmark tool the output.txt came from | |
tool: 'googlecpp' | |
# Where the output from the benchmark tool is stored | |
output-file-path: benchmark_result.json | |
# Access token to deploy GitHub Pages branch | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
# Push and deploy GitHub pages branch automatically | |
auto-push: true |