Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert old version #34

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 0 additions & 52 deletions .github/actions/build-rspack/action.yaml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/actions/env/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ runs:
using: composite
steps:
- name: Setup node
uses: actions/setup-node@v4
uses: actions/setup-node@v3
with:
node-version: 20
- name: Activate corepack
Expand All @@ -19,7 +19,7 @@ runs:
corepack enable
- name: Install dependencies with pnpm
shell: bash
run: pnpm install --prefer-frozen-lockfile --prefer-offline
run: pnpm install
- name: Set Rspack Dir
shell: bash
run: |
Expand Down
41 changes: 0 additions & 41 deletions .github/actions/prepare-rspack-binding/action.yaml

This file was deleted.

74 changes: 23 additions & 51 deletions .github/workflows/bench_rspack_commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,66 +9,43 @@ on:
type: string

jobs:
prepare-binding:
name: Prepare Rspack Binding
run-bench:
runs-on: [self-hosted, benchmark]
outputs:
diff-result: ${{ steps.print-results.outputs.diff-result }}
steps:
- uses: actions/checkout@v4
- name: Checkout
uses: actions/checkout@v2
- name: Init env
uses: ./.github/actions/env
- uses: ./.github/actions/prepare-rspack-binding
with:
path: ${{ env.RSPACK_DIR }}

bench:
runs-on: [self-hosted, benchmark]
needs: prepare-binding
timeout-minutes: 30
strategy:
matrix:
shardIndex: [1, 2, 3]
shardTotal: [3]
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Init env
uses: ./.github/actions/env
- uses: ./.github/actions/build-rspack
with:
path: ${{ env.RSPACK_DIR }}
- name: Build rspack
run: node bin/build-rspack.js origin ${{ inputs.commit_sha }}
- name: Run benchmark
run: node bin/cli.js bench --shard ${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
- uses: actions/upload-artifact@v4
with:
name: benchmark-artifacts-${{ matrix.shardIndex }}-${{ matrix.shardTotal }}
path: output

comment-compare-results:
runs-on: ubuntu-latest
needs: bench
if: always()
steps:
- uses: actions/checkout@v4
- name: Init env
uses: ./.github/actions/env
- uses: actions/download-artifact@v4
with:
pattern: benchmark-artifacts-*
path: output
merge-multiple: true
run: node bin/bench.js
- id: print-results
name: Print results
run: |
result=$(node bin/cli.js compare --base latest --current current)
result=$(node bin/compare-bench.js latest current)
echo "$result"
echo "diff-result=${result//$'\n'/'@@'}" >> $GITHUB_OUTPUT
- uses: actions/github-script@v6
if [[ $result =~ "Threshold exceeded" ]]; then
echo "Some benchmark cases exceed the threshold, please visit the previous step for more information"
exit 1
fi

create-comment:
runs-on: ubuntu-latest
needs: [run-bench]
if: always()
steps:
- id: create-comment
uses: actions/github-script@v6
with:
github-token: ${{ secrets.RSPACK_BOT_ACCESS_TOKEN }}
result-encoding: string
script: |
const diffResult = `${{ steps.print-results.outputs.diff-result }}`
let result = "task ${{ needs.bench.result }}"
const diffResult = `${{ needs.run-bench.outputs.diff-result }}`
let result = "task ${{ needs.run-bench.result }}"
if (diffResult) {
result = diffResult.replace(/@@/g, "\n");
}
Expand All @@ -86,8 +63,3 @@ jobs:
repo: 'rspack',
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);
}
72 changes: 20 additions & 52 deletions .github/workflows/bench_rspack_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,69 +31,42 @@ jobs:
})
return comment.id

prepare-binding:
name: Prepare Rspack Binding
run-bench:
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:
runs-on: [self-hosted, benchmark]
needs: [create-comment, prepare-binding]
timeout-minutes: 30
strategy:
matrix:
shardIndex: [1, 2, 3]
shardTotal: [3]
fail-fast: false
needs: create-comment
outputs:
diff-result: ${{ steps.print-results.outputs.diff-result }}
steps:
- uses: actions/checkout@v4
- name: Checkout
uses: actions/checkout@v2
- name: Init env
uses: ./.github/actions/env
- uses: ./.github/actions/build-rspack
with:
path: ${{ env.RSPACK_DIR }}
ref: pull/${{ inputs.prNumber }}/head
- name: Build rspack
run: node bin/build-rspack.js origin pull/${{ inputs.prNumber }}/head
- name: Run benchmark
run: node bin/cli.js bench --shard ${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
- uses: actions/upload-artifact@v4
with:
name: benchmark-artifacts-${{ matrix.shardIndex }}-${{ matrix.shardTotal }}
path: output

comment-compare-results:
runs-on: ubuntu-latest
needs: [create-comment, bench]
if: always()
steps:
- uses: actions/checkout@v4
- name: Init env
uses: ./.github/actions/env
- uses: actions/download-artifact@v4
with:
pattern: benchmark-artifacts-*
path: output
merge-multiple: true
run: node bin/bench.js
- id: print-results
name: Print results
run: |
result=$(node bin/cli.js compare --base latest --current current)
result=$(node bin/compare-bench.js latest current)
echo "$result"
echo "diff-result=${result//$'\n'/'@@'}" >> $GITHUB_OUTPUT
if [[ $result =~ "Threshold exceeded" ]]; then
echo "Some benchmark cases exceed the threshold, please visit the previous step for more information"
exit 1
fi

update-comment:
runs-on: ubuntu-latest
needs: [create-comment, run-bench]
if: always()
steps:
- uses: actions/github-script@v6
with:
github-token: ${{ secrets.RSPACK_BOT_ACCESS_TOKEN }}
script: |
const diffResult = `${{ steps.print-results.outputs.diff-result }}`

let result = "task ${{ needs.bench.result }}"
const diffResult = `${{ needs.run-bench.outputs.diff-result }}`
let result = "task ${{ needs.run-bench.result }}"
if (diffResult) {
result = diffResult.replace(/@@/g, "\n");
}
Expand All @@ -112,8 +85,3 @@ jobs:
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);
}
33 changes: 7 additions & 26 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
- "**/*.md"
pull_request:
types: [opened, synchronize]
branches: [main]
branches: [ main ]
paths-ignore:
- "**/*.md"

Expand All @@ -17,40 +17,21 @@ concurrency:
cancel-in-progress: ${{ github.ref_name != 'main' }}

jobs:
prepare-binding:
name: Prepare Rspack Binding
ci:
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, 2, 3]
shardTotal: [3]
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v2
- name: Init env
uses: ./.github/actions/env
- uses: ./.github/actions/build-rspack
with:
path: ${{ env.RSPACK_DIR }}
- name: Build rspack
run: node bin/build-rspack.js
- name: Run benchmark
run: node bin/cli.js bench --shard ${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
run: node bin/bench.js
- id: print-compare-results
name: Print compare results
run: |
result=$(node bin/cli.js compare --base latest --current current)
result=$(node bin/compare-bench.js latest current)
echo "$result"
echo "diff-result=${result//$'\n'/'@@'}" >> $GITHUB_OUTPUT
- name: Check Threshold
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/scheduled_bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,18 @@ jobs:
bench:
runs-on: [self-hosted, benchmark]
steps:
- uses: actions/checkout@v4
- name: Checkout
uses: actions/checkout@v2
- name: Init env
uses: ./.github/actions/env
- name: Build rspack
run: node bin/cli.js build
run: node bin/build-rspack.js
- name: Run benchmark
run: node bin/cli.js bench
run: node bin/bench.js
- id: print-compare-results
name: Print compare results
run: |
result=$(node bin/cli.js compare --base latest --current current)
result=$(node bin/compare-bench.js latest current)
echo "$result"
echo "diff-result=${result//$'\n'/'@@'}" >> $GITHUB_OUTPUT
- name: Setup git user
Expand Down
5 changes: 0 additions & 5 deletions .prettierignore

This file was deleted.

Loading
Loading