Add a benchmark which uses Google benchmark library #10
Workflow file for this run
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: Benchmark | |
on: | |
push: | |
branches: ["master"] | |
pull_request: | |
branches: ["dev"] | |
env: | |
BUILD_DIR: Dist | |
permissions: | |
contents: read | |
jobs: | |
benchmark: | |
runs-on: ubuntu-latest | |
container: seladb/ubuntu2204 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
# Checkout is performed out of the container and doesn't match our user | |
- name: Fix checkout ownership | |
run: chown -R "$(id -u):$(id -g)" "$GITHUB_WORKSPACE" | |
- name: Install dependencies | |
run: apt-get update && apt-get install -y libbenchmark-dev | |
- name: Configure PcapPlusPlus | |
run: cmake -DPCAPPP_BUILD_BENCHMARK_SUITE=ON -S . -B "$BUILD_DIR" | |
- name: Build PcapPlusPlus | |
run: cmake --build "$BUILD_DIR" -j | |
- name: Run PcapPlusPlus benchmark | |
run: cd Tests/Benchmarks && ./Bin/PcppBenchmark --benchmark_out=benchmark_result.json | |
- name: Download previous benchmark data | |
uses: actions/cache@v4 | |
with: | |
path: ./cache | |
key: ${{ runner.os }}-benchmark | |
- name: Store benchmark result | |
uses: benchmark-action/github-action-benchmark@v1 | |
with: | |
tool: 'googlecpp' | |
output-file-path: Tests/Benchmarks/benchmark_result.json | |
external-data-json-path: ./cache/benchmark_result.json | |
fail-on-alert: true | |
summary-always: true | |
- name: Upload benchmark data | |
uses: actions/upload-artifact@v4 | |
with: | |
name: benchmark_data | |
path: ./cache/benchmark_result.json |