-
Notifications
You must be signed in to change notification settings - Fork 1
49 lines (45 loc) · 1.46 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
name: Benchmark
on:
push:
branches: main
pull_request_target:
env:
CARGO_TERM_COLOR: always
BENCHER_PROJECT: trace4rs
BENCHER_ADAPTER: rust_criterion
BENCHER_TESTBED: ubuntu-latest
jobs:
benchmark_main_with_bencher:
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
name: Track main benchmarks with Bencher
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: bencherdev/bencher@main
- name: Benchmark trace4rs main with Bencher
run: |
bencher run \
--branch main \
--token "${{ secrets.BENCHER_API_TOKEN }}" \
"cargo bench"
benchmark_pr_with_bencher:
if: github.event_name == 'pull_request_target'
name: Track PR benchmarks with Bencher
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
persist-credentials: false
- uses: bencherdev/bencher@main
- name: Benchmark trace4rs PR with Bencher
run: |
bencher run \
--if-branch "${{ github.event.pull_request.head.ref }}" \
--else-if-branch "${{ github.event.pull_request.base.ref }}" \
--else-if-branch main \
--err \
--github-actions "${{ secrets.GITHUB_TOKEN }}" \
--token "${{ secrets.BENCHER_API_TOKEN }}" \
"cargo bench"