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

feat: use codspeed #60

Closed
wants to merge 5 commits into from
Closed
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
40 changes: 23 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,22 @@ jobs:
name: Get Runner Labels
uses: ./.github/workflows/get-runner-labels.yml

prepare-binding:
name: Prepare Rspack Binding
needs: [get-runner-labels]
runs-on: ${{ fromJSON(needs.get-runner-labels.outputs.LINUX_RUNNER_LABELS) }}
steps:
- uses: actions/checkout@v4
- name: Init env
uses: ./.github/actions/env
- uses: ./.github/actions/prepare-rspack-binding
with:
path: ${{ env.RSPACK_DIR }}
# prepare-binding:
# name: Prepare Rspack Binding
# needs: [get-runner-labels]
# runs-on: ${{ fromJSON(needs.get-runner-labels.outputs.LINUX_RUNNER_LABELS) }}
# 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]
# needs: [get-runner-labels, prepare-binding]
needs: [get-runner-labels]
runs-on: ${{ fromJSON(needs.get-runner-labels.outputs.LINUX_RUNNER_LABELS) }}
timeout-minutes: 30
strategy:
matrix:
Expand All @@ -47,11 +48,16 @@ jobs:
uses: actions/checkout@v4
- name: Init env
uses: ./.github/actions/env
- uses: ./.github/actions/build-rspack
# - uses: ./.github/actions/build-rspack
# with:
# path: ${{ env.RSPACK_DIR }}
# - name: Run benchmark
# run: node bin/cli.js bench --shard ${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
- name: Run benchmarks
uses: CodSpeedHQ/action@v3
with:
path: ${{ env.RSPACK_DIR }}
- name: Run benchmark
run: node bin/cli.js bench --shard ${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
run: pnpm exec vitest bench
token: ${{ secrets.CODSPEED_TOKEN }}
- id: print-compare-results
name: Print compare results
run: |
Expand Down
23 changes: 23 additions & 0 deletions arco-pro.bench.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { bench, describe } from "vitest";
import { rspack } from "@rspack/core";
import rspackConfig from './cases/arco-pro/rspack.config';

describe("arco pro project", () => {
bench("build with development mode", () => new Promise((resolve, reject) => {
rspack({
...rspackConfig,
mode: "production",
optimization: {
minimize: false,
}
}, (err, stats) => {
if (err) {
reject(err);
}
if (stats?.hasErrors()) {
reject(new Error(stats.toString({})));
}
resolve();
});
}));
});
1 change: 1 addition & 0 deletions cases/10000/rspack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const ReactRefreshPlugin = require("@rspack/plugin-react-refresh");
const prod = process.env.NODE_ENV === "production";
/** @type {import("@rspack/cli").Configuration} */
module.exports = {
context: __dirname,
resolve: {
extensions: [".js", ".jsx"]
},
Expand Down
1 change: 1 addition & 0 deletions cases/arco-pro/rspack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const POSTCSS_LOADER = {
const prod = process.env.NODE_ENV === "production";
/** @type {import("@rspack/cli").Configuration} */
module.exports = {
context: __dirname,
target: 'web',
experiments: {
asyncWebAssembly: true,
Expand Down
Loading
Loading