Skip to content

Nightly Failed

Nightly Failed #529

Workflow file for this run

name: Benchmark Rust
on:
issue_comment:
types: [created]
# cancel previous job runs for the same workflow + pr
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true
env:
RUST_LOG: info
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
RUSTUP_MAX_RETRIES: 10
jobs:
bench:
name: Bench
if: github.event.issue.pull_request && contains(github.event.comment.body, '!bench-rust')
runs-on: ubuntu-latest
steps:
- name: Get PR SHA
id: sha
uses: actions/github-script@v6
with:
result-encoding: string
script: |
const response = await github.request(context.payload.issue.pull_request.url);
return response.data.head.sha;
- name: Checkout PR Branch
uses: actions/checkout@v3
with:
submodules: false
ref: ${{ steps.sha.outputs.result }}
- name: Install toolchain
run: rustup show
- name: Cache
uses: Swatinem/rust-cache@v2
with:
shared-key: "bench"
- name: Install critcmp
run: cargo install critcmp
- name: Pnpm Cache
uses: ./.github/actions/pnpm-cache
- name: Run Bench on PR Branch
run: cargo bench --bench main -- --save-baseline pr
- name: Checkout Next Branch
uses: actions/checkout@v3
with:
clean: false
ref: main
- name: Run Bench on Next Branch
run: cargo bench --bench main -- --save-baseline baseline
- name: Compare Bench Results
id: bench_comparison
shell: bash
run: |
echo "### Benchmark Results" > output
echo "\`\`\`" >> output
critcmp baseline pr >> output
echo "\`\`\`" >> output
cat output
comment="$(cat output)"
comment="${comment//'%'/%25}"
comment="${comment//$'\n'/%0A}"
comment="${comment//$'\r'/%0D}"
echo "::set-output name=comment::$comment"
- name: Write a new comment
uses: peter-evans/[email protected]
continue-on-error: true
with:
issue-number: ${{ github.event.issue.number }}
body: |
${{ steps.bench_comparison.outputs.comment }}
- name: Remove Criterion Artifact
run: rm -rf ./target/criterion