Add a benchmark which uses Google benchmark library #12
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: | |
pull_request: | |
branches: ["dev"] | |
workflow_run: | |
workflows: [CodeQL] | |
types: [completed] | |
env: | |
BUILD_DIR: Dist | |
permissions: | |
contents: read | |
jobs: | |
benchmark: | |
runs-on: ubuntu-latest | |
container: seladb/${{ matrix.image }} | |
strategy: | |
matrix: | |
include: | |
- image: ubuntu2204 | |
# - image: ubuntu2204 | |
# additional-flags: -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ | |
- image: ubuntu2204-icpx | |
additional-flags: -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
# 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: Setup Intel Compiler variables | |
if: contains(matrix.image, 'icpx') | |
run: | | |
. /opt/intel/oneapi/setvars.sh | |
printenv >> $GITHUB_ENV | |
- name: Restore Ccache | |
id: ccache-restore | |
uses: actions/cache/restore@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 | |
with: | |
path: | | |
${{ env.CCACHE_DIR }} | |
!*.gcda | |
!*.gcno | |
key: ${{ matrix.image }}-ccache-${{ github.run_id }} | |
restore-keys: | | |
${{ matrix.image }}-ccache | |
- name: Install dependencies (remove and install this to the container) | |
run: apt-get update && apt-get install -y libbenchmark-dev | |
- name: Configure PcapPlusPlus for benchmarking | |
run: cmake -DPCAPPP_BUILD_BENCHMARK_SUITE=ON ${{ matrix.additional-flags }} -S . -B "$BUILD_DIR" | |
- name: Build PcapPlusPlus | |
run: cmake --build "$BUILD_DIR" -j | |
- name: Run PcapPlusPlus benchmark | |
run: cd Benchmarks && ./Bin/PcppBenchmark --benchmark_out=benchmark_result.json | |
- name: Save Ccache | |
uses: actions/cache/save@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 | |
with: | |
path: ${{ env.CCACHE_DIR }} | |
key: ${{ steps.ccache-restore.outputs.cache-primary-key }} |