-
Notifications
You must be signed in to change notification settings - Fork 0
88 lines (71 loc) · 2.36 KB
/
benchmark.yml
File metadata and controls
88 lines (71 loc) · 2.36 KB
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
77
78
79
80
81
82
83
84
85
86
87
88
name: Benchmarks
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
permissions:
contents: write
pull-requests: write
jobs:
benchmark:
name: Run Benchmarks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Rust cache
uses: swatinem/rust-cache@v2
- name: Run benchmarks
run: cargo bench --bench config_parsing --bench registry_lookup --bench version_comparison -- --noplot
- name: Store benchmark results
uses: actions/upload-artifact@v4
with:
name: benchmark-results
path: target/criterion/
retention-days: 30
benchmark-compare:
name: Compare Benchmarks
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Rust cache
uses: swatinem/rust-cache@v2
- name: Install critcmp
run: cargo install critcmp
- name: Checkout base branch
uses: actions/checkout@v4
with:
ref: ${{ github.base_ref }}
path: base
- name: Run base benchmarks
run: |
cd base
cargo bench --bench config_parsing --bench registry_lookup --bench version_comparison -- --save-baseline base --noplot
continue-on-error: true
- name: Checkout PR branch
uses: actions/checkout@v4
with:
path: pr
- name: Run PR benchmarks
run: |
cd pr
cargo bench --bench config_parsing --bench registry_lookup --bench version_comparison -- --save-baseline pr --noplot
- name: Compare benchmarks
id: compare
run: |
echo "## Benchmark Comparison" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
if [ -d "base/target/criterion" ] && [ -d "pr/target/criterion" ]; then
critcmp base/target/criterion pr/target/criterion >> $GITHUB_STEP_SUMMARY 2>/dev/null || echo "No baseline to compare against" >> $GITHUB_STEP_SUMMARY
else
echo "Baseline benchmarks not available for comparison" >> $GITHUB_STEP_SUMMARY
fi
continue-on-error: true