-
Notifications
You must be signed in to change notification settings - Fork 109
92 lines (79 loc) · 2.49 KB
/
benchmarks.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
on:
push:
branches:
- master
- kazimuth/benchwrangle
workflow_dispatch:
inputs:
pr_number:
description: 'Pull Request Number'
required: false
default: ''
name: Benchmarks
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
benchmark:
name: run benchmarks
runs-on: benchmarks-runner
steps:
- name: Checkout sources for a PR
if: ${{ github.event.inputs.ref }}
uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.ref }}
fetch-depth: 0
- name: Checkout sources
if: github.event.inputs.ref == ''
uses: actions/checkout@v3
with:
fetch-depth: 10
- name: Set up for PR context
if: github.event.inputs.pr_number
run: |
echo "PR_NUMBER=${{ github.event.inputs.pr_number }}" >> $GITHUB_ENV
PR_DATA=$(gh api repos/${{ github.repository }}/pulls/${{ github.event.inputs.pr_number }} --jq '{ baseRefName: .base.ref, headRefName: .head.ref }')
echo "PR_BASE_REF=$(echo $PR_DATA | jq -r '.baseRefName')" >> $GITHUB_ENV
echo "PR_HEAD_REF=$(echo $PR_DATA | jq -r '.headRefName')" >> $GITHUB_ENV
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: wasm32-unknown-unknown
override: true
- name: ⚡ Cache
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
~/.cargo/.crates.toml
~/.cargo/.crates2.json
target/
key: ${{ runner.os }}-cargo-bench-${{ hashFiles('**/Cargo.lock') }}
- name: Build
working-directory: crates/bench/
run: |
cargo build --release
- name: Install clippy for module build
run: |
rustup component add clippy
- name: Criterion compare base branch
if: ${{ env.PR_BASE_REF }}
uses: clockworklabs/criterion-compare-action@main
with:
cwd: "crates/bench"
branchName: ${{ env.PR_BASE_REF }}
- name: Criterion compare previous commit
if: env.PR_BASE_REF == ''
uses: clockworklabs/criterion-compare-action@main
with:
cwd: "crates/bench"
branchName: "HEAD~1"
- name: Clean up
if: always()
run: |
rm -fr /stdb/*