Skip to content

Commit 042fde6

Browse files
committed
ci: add concurrency and timeout
1 parent f0f2e5c commit 042fde6

1 file changed

Lines changed: 25 additions & 6 deletions

File tree

.github/workflows/benchmark.yml

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,13 @@ name: Benchmarks
1111

1212
on:
1313
push:
14-
branches: [ "main" ]
14+
branches: ["main"]
1515
pull_request:
16-
branches: [ "main" ]
16+
branches: ["main"]
17+
18+
concurrency:
19+
group: ${{ github.workflow }}-${{ github.ref }}
20+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
1721

1822
permissions:
1923
contents: write
@@ -23,14 +27,29 @@ permissions:
2327
env:
2428
CARGO_TERM_COLOR: always
2529
CARGO_INCREMENTAL: 0
30+
CARGO_NET_RETRY: 10
31+
RUSTUP_MAX_RETRIES: 10
2632

2733
jobs:
2834
benchmark:
2935
name: Continuous benchmarking
3036
runs-on: ubuntu-latest
37+
timeout-minutes: 30
3138
steps:
3239
- uses: actions/checkout@v4
3340

41+
- uses: actions/cache@v4
42+
with:
43+
path: |
44+
~/.cargo/bin/
45+
~/.cargo/registry/index/
46+
~/.cargo/registry/cache/
47+
~/.cargo/git/db/
48+
target/
49+
key: ${{ runner.os }}-bench-${{ hashFiles('**/Cargo.lock') }}
50+
restore-keys: |
51+
${{ runner.os }}-bench-
52+
3453
# TODO(template) update the bench command if you use a different
3554
# benchmark harness or need to pass extra flags
3655
- name: Run benchmarks
@@ -50,10 +69,10 @@ jobs:
5069
with:
5170
# TODO(template) update the name to match your project
5271
name: Benchmark
53-
tool: 'cargo'
72+
tool: "cargo"
5473
output-file-path: benchmark-output.txt
5574
external-data-json-path: ./cache/benchmark-data.json
56-
alert-threshold: '130%'
75+
alert-threshold: "130%"
5776
comment-on-alert: true
5877
fail-on-alert: true
5978
github-token: ${{ secrets.GITHUB_TOKEN }}
@@ -65,11 +84,11 @@ jobs:
6584
with:
6685
# TODO(template) update the name to match your project
6786
name: Rust Template Benchmark
68-
tool: 'cargo'
87+
tool: "cargo"
6988
output-file-path: benchmark-output.txt
7089
gh-pages-branch: gh-pages
7190
benchmark-data-dir-path: dev/bench
72-
alert-threshold: '130%'
91+
alert-threshold: "130%"
7392
comment-on-alert: true
7493
github-token: ${{ secrets.GITHUB_TOKEN }}
7594
auto-push: true

0 commit comments

Comments
 (0)