Skip to content

refactor: use safer logic to get ModuleTable#modules (#3156) #7104

refactor: use safer logic to get ModuleTable#modules (#3156)

refactor: use safer logic to get ModuleTable#modules (#3156) #7104

name: Benchmarks Node
on:
push:
branches:
- 'main' # or "master"
paths:
- '**/*.rs'
- '**/*.toml'
- 'Cargo.lock'
- 'rust-toolchain.toml'
- 'packages/rolldown/**'
- 'packages/bench/**'
- '.github/workflows/**'
- 'package.json'
- 'pnpm-lock.yaml'
pull_request:
types: [opened, synchronize]
paths:
- '**/*.rs'
- '**/*.toml'
- 'Cargo.lock'
- 'rust-toolchain.toml'
- 'packages/rolldown/**'
- 'packages/bench/**'
- '.github/workflows/**'
- 'package.json'
- 'pnpm-lock.yaml'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: ${{ github.ref_name != 'main' }}
jobs:
benchmark-node:
name: Benchmark Node
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: write
steps:
- name: Checkout Branch
uses: actions/checkout@v4
with:
# Whether Pull submodules for additional files
submodules: false
- name: Download previous benchmark data
uses: actions/checkout@v4
with:
# https://github.com/rolldown/benchmark-results-storage
repository: rolldown/benchmark-results-storage
path: tmp
- name: List Files
run: find -maxdepth 2 -ls
- name: Setup Node
uses: ./.github/actions/setup-node
- name: Setup Rust
uses: ./.github/actions/setup-rust
with:
tools: just
cache-key: release-build
- name: Setup Benchmark Input
run: just setup-bench
- name: Build packages
run: just build native release
- name: Run benchmarks
run: pnpm --filter bench run bench-ci
- name: Show/Update benchmark result
uses: benchmark-action/github-action-benchmark@v1
with:
name: 'Node Benchmark'
# What benchmark tool the output.txt came from
tool: 'customSmallerIsBetter'
# Where the output from the benchmark tool is stored
output-file-path: tmp/new-benchmark-node-output.json
# Where the previous data file is stored
external-data-json-path: tmp/benchmark-node-output.json
fail-on-alert: false
summary-always: true
comment-always: false
save-data-file: ${{ github.event_name == 'push' }}
alert-threshold: '110%' # Too much noise in the benchmark results
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Save benchmark result
if: github.event_name == 'push'
# https://github.com/dmnemec/copy_file_to_another_repo_action
uses: dmnemec/copy_file_to_another_repo_action@bbebd3da22e4a37d04dca5f782edd5201cb97083
env:
# Results are stored in https://github.com/rolldown/benchmark-results-storage
API_TOKEN_GITHUB: ${{ secrets.REPO_TOKEN_BENCHMARK_RESULTS }}
with:
source_file: './tmp/benchmark-node-output.json'
destination_repo: 'rolldown/benchmark-results-storage'
user_email: 'github-actions[bot]@users.noreply.github.com'
user_name: 'github-actions[bot]'
commit_message: 'Update `benchmark-node-output.json`'