Skip to content

Commit d9635f9

Browse files
authored
Merge branch 'main' into fix/10721
2 parents 517b77e + 0a13bb4 commit d9635f9

File tree

126 files changed

+1957
-1784
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

126 files changed

+1957
-1784
lines changed

.cargo/config.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ CARGO_WORKSPACE_DIR = { value = "", relative = true }
66
lint = "clippy --workspace --all-targets -- --deny warnings"
77
# AKA `test-update`, handy cargo rst update without install `cargo-rst` binary
88
t = "test --no-fail-fast"
9-
tu = "run -p cargo-rst -- update"
9+
deny-ext = "run -p deny-ext"
10+
codegen = "run -p codegen"
1011

1112
[target.'cfg(all())']
1213
rustflags = [

.github/actions/binary-limit/action.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,19 @@ name: Binary Size Limit
33
description: Compare binary size with default
44

55
inputs:
6-
percentage-threshold:
7-
description: "the"
8-
default: "5"
6+
size-threshold:
7+
description: "the increase size limit in bytes, default is 50kb"
8+
default: "51200"
99
required: false
1010

1111
runs:
1212
using: composite
1313

1414
steps:
1515
- name: GitHub Script
16-
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea
16+
uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b
1717
with:
1818
script: |
19+
const limit = parseInt("${{ inputs.size-threshold }}") || 51200;
1920
const action = require("./.github/actions/binary-limit/binary-limit-script.js");
20-
await action({github, context});
21+
await action({github, context, limit});

.github/actions/binary-limit/binary-limit-script.js

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ const fs = require("node:fs");
22

33
/**
44
* @param {import("@octokit/rest")} github
5+
* @param {Number} limit
56
*/
6-
module.exports = async function action({ github, context }) {
7+
module.exports = async function action({ github, context, limit }) {
78
const commits = await github.rest.repos.listCommits({
89
owner: context.repo.owner,
910
repo: context.repo.repo,
@@ -38,9 +39,19 @@ module.exports = async function action({ github, context }) {
3839
"./crates/node_binding/rspack.linux-x64-gnu.node"
3940
).size;
4041

41-
const comment = compareBinarySize(headSize, baseSize, baseCommit);
42+
console.log(`Base commit size: ${baseSize}`);
43+
console.log(`Head commit size: ${headSize}`);
44+
45+
const comment = compareBinarySize(headSize, baseSize, context, baseCommit);
4246

4347
await commentToPullRequest(github, context, comment);
48+
49+
const increasedSize = headSize - baseSize;
50+
if (increasedSize > limit) {
51+
throw new Error(
52+
`Binary size increased by ${increasedSize} bytes, exceeding the limit of ${limit} bytes`
53+
);
54+
}
4455
};
4556

4657
async function commentToPullRequest(github, context, comment) {
@@ -85,11 +96,12 @@ const SIZE_LIMIT_HEADING = "## 📦 Binary Size-limit";
8596
const DATA_URL_BASE =
8697
"https://raw.githubusercontent.com/web-infra-dev/rspack-ecosystem-benchmark/data";
8798

88-
function compareBinarySize(headSize, baseSize, baseCommit) {
99+
function compareBinarySize(headSize, baseSize, context, baseCommit) {
89100
const message = baseCommit.commit.message.split("\n")[0];
90101
const author = baseCommit.commit.author.name;
102+
const headSha = context.payload.pull_request?.head.sha || context.sha;
91103

92-
const info = `> Comparing binary size with Commit: [${message} by ${author}](${baseCommit.html_url})\n\n`;
104+
const info = `> Comparing [\`${headSha.slice(0, 7)}\`](${context.payload.repository.html_url}/commit/${headSha}) to [${message} by ${author}](${baseCommit.html_url})\n\n`;
93105

94106
const diff = headSize - baseSize;
95107
const percentage = (Math.abs(diff / baseSize) * 100).toFixed(2);

.github/workflows/ci-rust.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ jobs:
3737
save-if: ${{ github.ref_name == 'main' }}
3838
key: check
3939

40+
- name: Run Cargo codegen
41+
run: cargo codegen
42+
4043
# Compile test without debug info for reducing the CI cache size
4144
- name: Change profile.test
4245
shell: bash

.github/workflows/ci.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,16 +127,26 @@ jobs:
127127
test-windows,
128128
test-mac,
129129
test-wasm,
130-
check-changed
130+
check-changed,
131+
size-limit
131132
]
132133
if: ${{ always() && !cancelled() }}
133134
runs-on: ubuntu-latest
134135
steps:
135136
- name: Log
136137
run: echo ${{ join(needs.*.result, ',') }}
137138
- name: Test check
138-
if: ${{ needs.check-changed.outputs.code_changed == 'true' && join(needs.*.result, ',')!='success,success,success,success,success,success' }}
139+
if: ${{ needs.check-changed.outputs.code_changed == 'true'
140+
&& github.event_name == 'pull_request'
141+
&& join(needs.*.result, ',')!='success,success,success,success,success,success,success' }}
139142
run: echo "Tess Failed" && exit 1
143+
144+
- name: Test check
145+
if: ${{ needs.check-changed.outputs.code_changed == 'true'
146+
&& github.event_name != 'pull_request'
147+
&& join(needs.*.result, ',')!='success,success,success,success,success,success,skipped' }}
148+
run: echo "Tess Failed" && exit 1
149+
140150
- name: No check to Run test
141151
run: echo "Success"
142152

.github/workflows/release-crates.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ jobs:
2222
release_crates:
2323
environment: crate
2424
name: Release Crates
25-
runs-on: ubuntu-latest
25+
permissions:
26+
contents: write
27+
runs-on: ${{ fromJSON(vars.LINUX_SELF_HOSTED_RUNNER_LABELS || '"ubuntu-22.04"') }}
2628
needs: [rust_tests]
2729
if: ${{ github.event_name == 'workflow_dispatch' }}
2830
steps:
@@ -37,8 +39,19 @@ jobs:
3739
save-if: true
3840
key: release
3941

42+
- uses: cargo-bins/cargo-binstall@8aac5aa2bf0dfaa2863eccad9f43c68fe40e5ec8 # v1.14.1
43+
4044
- name: Install cargo-workspaces
41-
run: cargo install cargo-workspaces --locked
45+
run: cargo binstall --no-confirm cargo-workspaces@0.4.0 --force
46+
47+
- name: Pnpm Setup
48+
uses: ./.github/actions/pnpm/setup
49+
50+
- name: Pnpm Install
51+
uses: ./.github/actions/pnpm/install-dependencies
52+
53+
- name: Run Cargo codegen
54+
run: cargo codegen
4255

4356
- name: Publish Crates
4457
run: |

.github/workflows/reusable-build-bench.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
key: build-bench-${{ inputs.target }}
4343

4444
- name: Install cargo-codspeed binary
45-
uses: taiki-e/install-action@726a5c9e4be3a589bab5f60185f0cdde7ed4498e # v2
45+
uses: taiki-e/install-action@2383334cf567d78771fc7d89b6b3802ef1412cf6 # v2
4646
with:
4747
tool: cargo-codspeed@2.10.1
4848

.github/workflows/reusable-build-build.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ jobs:
6161
- name: Setup Rust Target
6262
run: rustup target add ${{ inputs.target }}
6363

64+
- name: Run Cargo codegen
65+
run: cargo codegen
66+
6467
- name: Trim paths
6568
run: |
6669
echo $'\n' >> .cargo/config.toml

.github/workflows/reusable-build-codspeed.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,13 @@ jobs:
3030
key: build-bench-${{ inputs.target }}
3131

3232
- name: Install cargo-codspeed binary
33-
uses: taiki-e/install-action@726a5c9e4be3a589bab5f60185f0cdde7ed4498e # v2
33+
uses: taiki-e/install-action@2383334cf567d78771fc7d89b6b3802ef1412cf6 # v2
3434
with:
3535
tool: cargo-codspeed@2.10.1
3636

37+
- name: Run Cargo codegen
38+
run: cargo codegen
39+
3740
- name: Build Benchmark
3841
env:
3942
RUSTFLAGS: "--cfg codspeed"

.github/workflows/reusable-build-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ jobs:
6666
runs-on: ${{ fromJSON(inputs.runner) }}
6767
timeout-minutes: 60
6868
strategy:
69-
fail-fast: true # for better utilize ci runners
69+
fail-fast: false # wait for all test to finish for determining if it's node version based problem or general problem
7070
matrix:
7171
node: ${{ fromJSON(
7272
inputs.target == 'wasm32-wasip1-threads'

0 commit comments

Comments
 (0)