Skip to content

chore(deps): update all non-major dependencies (#3738) #6679

chore(deps): update all non-major dependencies (#3738)

chore(deps): update all non-major dependencies (#3738) #6679

name: Benchmarks Rust
on:
push:
branches:
- 'main'
paths:
- '**/*.rs'
- '**/*.toml'
- '.github/workflows/**'
- 'Cargo.lock'
- 'rust-toolchain.toml'
- 'scripts/misc/setup-benchmark-input/**'
pull_request:
types: [opened, synchronize]
paths:
- '**/*.rs'
- '**/*.toml'
- '.github/workflows/**'
- 'Cargo.lock'
- 'rust-toolchain.toml'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: ${{ github.ref_name != 'main' }}
jobs:
codspeed-benchmark:
name: Codspeed Benchmark
runs-on: ubuntu-latest
steps:
- name: Checkout Branch
uses: actions/checkout@v4
with:
# Whether Pull submodules for additional files
submodules: false
- name: Setup Node
uses: ./.github/actions/setup-node
- name: Setup Rust
uses: ./.github/actions/setup-rust
with:
tools: just, cargo-codspeed
cache-key: release-build
- name: Setup Benchmark Input
run: just setup-bench
- name: Build the benchmark target(s)
run: cargo codspeed build -p bench --features codspeed
- name: Run the benchmarks
uses: CodSpeedHQ/action@v3
with:
run: cargo codspeed run -p bench
token: ${{ secrets.CODSPEED_TOKEN }}
env:
# ensure that `root_dir()` from `crates/rolldown_testing/src/workspace.rs` works during the benchmark
# see https://github.com/adriencaccia/rolldown/pull/1 for explanation
CARGO_MANIFEST_DIR: ${{ github.workspace }}/target/codspeed
benchmark-rust:
permissions:
pull-requests: write
name: Benchmark Rust
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Checkout PR Branch
uses: actions/checkout@v4
with:
# Whether Pull submodules for additional files
submodules: false
- name: Setup Node
uses: ./.github/actions/setup-node
- name: Setup Rust
uses: ./.github/actions/setup-rust
with:
tools: just, critcmp
cache-key: release-build
- name: Setup Benchmark Input
run: just setup-bench
- name: Run Bench on PR Branch
run: cargo bench -p bench -- --save-baseline pr
- name: Checkout Target Branch
uses: actions/checkout@v4
with:
clean: false
ref: ${{ github.event.pull_request.base.ref }}
- name: Run Bench on Target Branch
run: cargo bench -p bench -- --save-baseline target
- name: Compare Bench Results
id: bench_comparison
shell: bash
run: |
echo "### Benchmarks Rust" > output
echo "- target: \`${{ github.event.pull_request.base.ref }}\`(${{ github.event.pull_request.base.sha }})" >> output
echo "- pr: \`${{ github.event.pull_request.head.ref }}\`(${{ github.event.pull_request.head.sha }})" >> output
echo "\`\`\`" >> output
critcmp target 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: Find Comment
uses: peter-evans/find-comment@v3
id: find-comment
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: Benchmarks Rust
- name: Write a new comment
uses: peter-evans/create-or-update-comment@v4.0.0
continue-on-error: true
with:
token: ${{ secrets.GITHUB_TOKEN }}
comment-id: ${{ steps.find-comment.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: ${{ steps.bench_comparison.outputs.comment }}
reactions-edit-mode: 'replace'
edit-mode: replace