feat: bench generate-package-json-webpack-plugin (#47) #281
This file contains 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: CI | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- "**/*.md" | |
pull_request: | |
types: [opened, synchronize] | |
branches: [main] | |
paths-ignore: | |
- "**/*.md" | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: ${{ github.ref_name != 'main' }} | |
jobs: | |
prepare-binding: | |
name: Prepare Rspack Binding | |
runs-on: [self-hosted, benchmark] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Init env | |
uses: ./.github/actions/env | |
- uses: ./.github/actions/prepare-rspack-binding | |
with: | |
path: ${{ env.RSPACK_DIR }} | |
bench: | |
needs: prepare-binding | |
runs-on: [self-hosted, benchmark] | |
timeout-minutes: 30 | |
strategy: | |
matrix: | |
shardIndex: [1] | |
shardTotal: [1] | |
fail-fast: false | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Init env | |
uses: ./.github/actions/env | |
- uses: ./.github/actions/build-rspack | |
with: | |
path: ${{ env.RSPACK_DIR }} | |
- name: Run benchmark | |
run: node bin/cli.js bench --shard ${{ matrix.shardIndex }}/${{ matrix.shardTotal }} | |
- id: print-compare-results | |
name: Print compare results | |
run: | | |
result=$(node bin/cli.js compare --base latest --current current) | |
echo "$result" | |
echo "diff-result=${result//$'\n'/'@@'}" >> $GITHUB_OUTPUT | |
- name: Check Threshold | |
run: | | |
result='${{ steps.print-compare-results.outputs.diff-result }}'; | |
if [[ $result =~ "Threshold exceeded" ]]; then | |
echo "Some benchmark cases exceed the threshold, please visit the previous step for more information" | |
exit 1 | |
fi |