chore(deps): update dependency memfs to v4.20.0 (#11187) #1717
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Ecosystem Benchmark | |
on: | |
workflow_dispatch: | |
inputs: | |
pr: | |
type: number | |
description: "Run Benchmark PR number" | |
required: true | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- "**/*.md" | |
- "website/**" | |
tags-ignore: | |
- "**" | |
permissions: | |
# Allow commenting on commits | |
contents: write | |
# Allow commenting on issues | |
issues: write | |
# Allow commenting on pull requests | |
pull-requests: write | |
jobs: | |
build: | |
name: Test Linux | |
if: github.repository == 'web-infra-dev/rspack' | |
uses: ./.github/workflows/reusable-build.yml | |
with: | |
target: x86_64-unknown-linux-gnu | |
runner: ${{ vars.LINUX_SELF_HOSTED_RUNNER_LABELS || '"ubuntu-22.04"' }} | |
ref: ${{ github.event_name == 'workflow_dispatch' && format('refs/pull/{0}/head', inputs.pr) || github.sha }} | |
profile: "release" | |
test: false | |
bench: false | |
prefer_docker: false | |
create-comment: | |
if: github.repository == 'web-infra-dev/rspack' | |
runs-on: ubuntu-latest | |
outputs: | |
comment-id: ${{ steps.create-comment.outputs.result }} | |
steps: | |
- id: create-comment | |
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
result-encoding: string | |
script: | | |
const url = `${context.serverUrl}//${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}` | |
const urlLink = `[Open](${url})` | |
const body = `⏳ Triggered benchmark: ${urlLink}` | |
if (context.eventName === 'workflow_dispatch') { | |
const { data: comment } = await github.rest.issues.createComment({ | |
issue_number: context.payload.inputs.pr, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body | |
}) | |
return comment.id | |
} | |
const { data: comment } = await github.rest.repos.createCommitComment({ | |
commit_sha: context.sha, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body | |
}) | |
return comment.id | |
bench: | |
if: github.repository == 'web-infra-dev/rspack' | |
needs: [build] | |
runs-on: [self-hosted, benchmark] | |
outputs: | |
diff-result: ${{ steps.run-benchmark.outputs.diff-result }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
with: | |
ref: ${{ github.event_name == 'workflow_dispatch' && format('refs/pull/{0}/head', inputs.pr) || github.sha }} | |
- name: Clean | |
uses: ./.github/actions/clean | |
with: | |
target: x86_64-unknown-linux-gnu | |
- name: Download bindings | |
uses: ./.github/actions/artifact/download | |
with: | |
name: bindings-x86_64-unknown-linux-gnu | |
path: crates/node_binding/ | |
force-use-github: true | |
- name: Show restored binding | |
shell: bash | |
run: ls -lah crates/node_binding/*.node | |
- name: Pnpm Setup | |
uses: ./.github/actions/pnpm/setup | |
- name: Pnpm Install | |
uses: ./.github/actions/pnpm/install-dependencies | |
- name: Build JS | |
run: pnpm run build:js | |
- name: Run rspack-ecosystem-benchmark | |
id: run-benchmark | |
run: | | |
RSPACK_DIR=$(pwd) | |
git clone --single-branch --depth 1 https://github.com/web-infra-dev/rspack-ecosystem-benchmark.git | |
cd rspack-ecosystem-benchmark | |
pnpm i | |
RSPACK_DIR="$RSPACK_DIR" node bin/cli.js bench | |
result=$(node bin/cli.js compare --base latest --current current) | |
echo "$result" | |
echo "diff-result=${result//$'\n'/'@@'}" >> $GITHUB_OUTPUT | |
- name: Upload benchmark result | |
if: github.event_name == 'push' | |
id: upload-benchmark-data | |
run: | | |
RSPACK_DIR=$(pwd) | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
cd rspack-ecosystem-benchmark | |
RSPACK_DIR="$RSPACK_DIR" GITHUB_ACTOR=x-access-token node bin/upload.js ${{ secrets.PERF_DATA_TOKEN }} ${{ github.sha }} | |
comment-compare-results: | |
if: github.repository == 'web-infra-dev/rspack' && !cancelled() | |
runs-on: ubuntu-latest | |
needs: [create-comment, bench] | |
steps: | |
- uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const diffResult = `${{ needs.bench.outputs.diff-result }}` | |
let result = "task ${{ needs.bench.result }}" | |
if (diffResult) { | |
result = diffResult.replace(/@@/g, "\n"); | |
} | |
const url = `${context.serverUrl}//${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}` | |
const urlLink = `[Open](${url})` | |
const body = ` | |
📝 Benchmark detail: ${urlLink} | |
${result} | |
` | |
if (context.eventName === 'workflow_dispatch') { | |
await github.rest.issues.updateComment({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
comment_id: `${{ needs.create-comment.outputs.comment-id }}`, | |
body | |
}) | |
} else { | |
await github.rest.repos.updateCommitComment({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
comment_id: `${{ needs.create-comment.outputs.comment-id }}`, | |
body, | |
}); | |
} | |
if (result.includes("Threshold exceeded")) { | |
console.log("Some benchmark cases exceed the threshold, please visit the previous step for more information"); | |
process.exit(1); | |
} |