-
Notifications
You must be signed in to change notification settings - Fork 676
76 lines (63 loc) · 2.54 KB
/
benchmark.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
name: Benchmark
on:
pull_request:
branches: ["dev"]
push:
branches: ["master"]
env:
BUILD_DIR: Dist
CCACHE_DIR: ${{ github.workspace }}/.ccache
permissions:
contents: read
jobs:
benchmark:
runs-on: ubuntu-latest
container: seladb/ubuntu2204
steps:
- name: Checkout code
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Checkout benchmark results from docs repo
if: github.ref == 'refs/heads/master'
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
repository: PcapPlusPlus/pcapplusplus.github.io
path: Benchmarks
sparse-checkout: benchmark-results
# 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: Restore Ccache
id: ccache-restore
uses: actions/cache/restore@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: |
${{ env.CCACHE_DIR }}
key: ubuntu2204-ccache-${{ github.run_id }}
restore-keys: |
ubuntu2204-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 -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-results/benchmark_result_${GITHUB_SHA}.json
- name: Upload benchmark results
if: github.ref == 'refs/heads/master'
uses: cpina/github-action-push-to-another-repository@07c4d7b3def0a8ebe788a8f2c843a4e1de4f6900 # main
env:
SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }}
with:
source-directory: Benchmarks/benchmark-results
destination-github-username: "PcapPlusPlus"
destination-repository-name: "pcapplusplus.github.io"
user-email: noreply@github.com
commit-message: Add benchmark for commit ORIGIN_COMMIT
target-branch: master
target-directory: benchmark-results
- name: Save Ccache
uses: actions/cache/save@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ steps.ccache-restore.outputs.cache-primary-key }}