Skip to content

Commit a04a873

Browse files
feat: migrate rspack ecosystem CI to the central repo (#23)
Co-authored-by: Amp <amp@ampcode.com>
1 parent 0f14668 commit a04a873

5 files changed

Lines changed: 241 additions & 56 deletions

File tree

.github/actions/prepare-rspack-binding/action.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,12 @@ runs:
4949
run: ls -lah ${{ inputs.path }}/target
5050
- name: Build Rspack
5151
shell: bash
52+
env:
53+
TARGET_CC: clang
5254
run: |
5355
cd ${{ inputs.path }}
5456
pnpm i --frozen-lockfile
57+
pnpm run install-binding-dependencies
5558
cargo codegen
5659
pnpm run build:binding:release
5760
- uses: actions/upload-artifact@v4

.github/workflows/ci.yml

Lines changed: 44 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -155,29 +155,29 @@ jobs:
155155
matrix:
156156
include:
157157
- suite: modernjs
158-
os: ubuntu-22.04
158+
os: ubuntu-latest
159159
- suite: _selftest
160-
os: ubuntu-22.04
160+
os: ubuntu-latest
161161
- suite: rspress
162-
os: ubuntu-22.04
162+
os: ubuntu-latest
163163
- suite: rsbuild
164-
os: ubuntu-22.04
164+
os: ubuntu-latest
165165
- suite: examples
166-
os: ubuntu-22.04
166+
os: ubuntu-latest
167167
- suite: rslib
168-
os: ubuntu-22.04
168+
os: ubuntu-latest
169169
- suite: rstest
170-
os: ubuntu-22.04
170+
os: ubuntu-latest
171171
- suite: rsdoctor
172-
os: ubuntu-22.04
172+
os: ubuntu-latest
173173
- suite: devserver
174-
os: ubuntu-22.04
174+
os: ubuntu-latest
175175
- suite: plugin
176-
os: ubuntu-22.04
176+
os: ubuntu-latest
177177
- suite: lynx-stack
178-
os: ubuntu-22.04
178+
os: ubuntu-latest
179179
- suite: rsbuild-rsc-plugin
180-
os: ubuntu-22.04
180+
os: ubuntu-latest
181181
fail-fast: false
182182
runs-on: ${{ matrix.os }}
183183
name: rspack (${{ matrix.suite }})
@@ -187,6 +187,7 @@ jobs:
187187
- name: Install
188188
run: pnpm install --frozen-lockfile --prefer-offline
189189
- name: Lint
190+
if: matrix.suite == '_selftest'
190191
run: pnpm lint
191192
- name: Setup Node.js
192193
if: matrix.suite == 'lynx-stack' || matrix.suite == '_selftest'
@@ -198,7 +199,37 @@ jobs:
198199
uses: actions-rust-lang/setup-rust-toolchain@v1
199200
- name: Expose GitHub Runtime
200201
uses: crazy-max/ghaction-github-runtime@v3
201-
- run: >-
202+
# Verdaccio is required for rspack-stack testing.
203+
# pnpm has a known bug (pnpm/pnpm#9270) where file: protocol overrides
204+
# for packages with native optionalDependencies cause version mismatch
205+
# or silent registry fallback. Publishing to a local registry avoids this.
206+
- name: Setup Verdaccio
207+
if: matrix.suite != '_selftest'
208+
run: |
209+
pnpm verdaccio --config verdaccio.yaml &
210+
printf '\n//localhost:4873/:_authToken="this-is-a-fake-token"\n' >> ~/.npmrc
211+
sleep 3
212+
- name: Publish rspack packages to Verdaccio
213+
if: matrix.suite != '_selftest'
214+
working-directory: workspace/rspack
215+
run: |
216+
for pkg in $(pnpm -r --filter "@rspack/binding*..." --filter "@rspack/core..." --filter "@rspack/tracing..." --filter "@rspack/test-tools..." exec -- node -p "process.cwd()"); do
217+
jq 'del(.publishConfig.provenance)' "$pkg/package.json" > "$pkg/package.json.tmp"
218+
mv "$pkg/package.json.tmp" "$pkg/package.json"
219+
done
220+
pnpm -r --filter "@rspack/binding*..." --filter "@rspack/core..." --filter "@rspack/tracing..." --filter "@rspack/test-tools..." publish --no-git-checks --provenance=false --access public --registry=http://localhost:4873
221+
- name: Run suite (with Verdaccio)
222+
if: matrix.suite != '_selftest'
223+
run: >-
224+
NPM_CONFIG_REGISTRY=http://localhost:4873
225+
pnpm tsx ecosystem-ci.ts
226+
run-suites
227+
--stack rspack
228+
--release "$(node -p "require('./workspace/rspack/packages/rspack/package.json').version")"
229+
${{ matrix.suite }}
230+
- name: Run suite (selftest)
231+
if: matrix.suite == '_selftest'
232+
run: >-
202233
pnpm tsx ecosystem-ci.ts
203234
run-suites
204235
--stack rspack

.github/workflows/rspack-ecosystem-ci-from-commit.yml

Lines changed: 82 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ on:
1313
description: "commit sha"
1414
required: true
1515
type: string
16+
updateComment:
17+
description: "whether to update the PR comment"
18+
required: false
19+
type: boolean
20+
default: false
1621
repo:
1722
description: "rspack repository to use"
1823
required: true
@@ -35,6 +40,7 @@ on:
3540
- devserver
3641
- plugin
3742
- lynx-stack
43+
- rsbuild-rsc-plugin
3844
suiteRefType:
3945
description: "type of suite ref to use"
4046
required: true
@@ -68,7 +74,7 @@ jobs:
6874
ref: ${{ inputs.commitSHA }}
6975

7076
execute-selected-suite:
71-
runs-on: ubuntu-22.04
77+
runs-on: ubuntu-latest
7278
needs: [get-runner-labels, prepare-binding]
7379
if: "inputs.suite != '-'"
7480
steps:
@@ -77,10 +83,44 @@ jobs:
7783
with:
7884
repository: ${{ inputs.repo }}
7985
ref: ${{ inputs.commitSHA }}
86+
- name: Setup Rust
87+
if: inputs.suite == 'lynx-stack'
88+
uses: actions-rust-lang/setup-rust-toolchain@v1
8089
- run: pnpm i --frozen-lockfile
8190
- name: Expose GitHub Runtime
8291
uses: crazy-max/ghaction-github-runtime@v3
83-
- run: >-
92+
# Verdaccio is required for rspack-stack testing.
93+
# pnpm has a known bug (pnpm/pnpm#9270) where file: protocol overrides
94+
# for packages with native optionalDependencies cause version mismatch
95+
# or silent registry fallback. Publishing to a local registry avoids this.
96+
- name: Setup Verdaccio
97+
if: inputs.suite != '_selftest'
98+
run: |
99+
pnpm verdaccio --config verdaccio.yaml &
100+
printf '\n//localhost:4873/:_authToken="this-is-a-fake-token"\n' >> ~/.npmrc
101+
sleep 3
102+
- name: Publish rspack packages to Verdaccio
103+
if: inputs.suite != '_selftest'
104+
working-directory: workspace/rspack
105+
run: |
106+
for pkg in $(pnpm -r --filter "@rspack/binding*..." --filter "@rspack/core..." --filter "@rspack/tracing..." --filter "@rspack/test-tools..." exec -- node -p "process.cwd()"); do
107+
jq 'del(.publishConfig.provenance)' "$pkg/package.json" > "$pkg/package.json.tmp"
108+
mv "$pkg/package.json.tmp" "$pkg/package.json"
109+
done
110+
pnpm -r --filter "@rspack/binding*..." --filter "@rspack/core..." --filter "@rspack/tracing..." --filter "@rspack/test-tools..." publish --no-git-checks --provenance=false --access public --registry=http://localhost:4873
111+
- name: Run suite (with Verdaccio)
112+
if: inputs.suite != '_selftest'
113+
run: >-
114+
NPM_CONFIG_REGISTRY=http://localhost:4873
115+
pnpm tsx ecosystem-ci.ts
116+
run-suites
117+
--stack rspack
118+
--release "$(node -p "require('./workspace/rspack/packages/rspack/package.json').version")"
119+
--suite-${{ inputs.suiteRefType }} ${{ inputs.suiteRef }}
120+
${{ inputs.suite }}
121+
- name: Run suite (selftest)
122+
if: inputs.suite == '_selftest'
123+
run: >-
84124
pnpm tsx ecosystem-ci.ts
85125
run-suites
86126
--stack rspack
@@ -94,27 +134,29 @@ jobs:
94134
matrix:
95135
include:
96136
- suite: modernjs
97-
os: ubuntu-22.04
137+
os: ubuntu-latest
98138
- suite: _selftest
99-
os: ubuntu-22.04
139+
os: ubuntu-latest
100140
- suite: rsdoctor
101-
os: ubuntu-22.04
141+
os: ubuntu-latest
102142
- suite: rspress
103-
os: ubuntu-22.04
143+
os: ubuntu-latest
104144
- suite: rslib
105-
os: ubuntu-22.04
145+
os: ubuntu-latest
106146
- suite: rstest
107-
os: ubuntu-22.04
147+
os: ubuntu-latest
108148
- suite: rsbuild
109-
os: ubuntu-22.04
149+
os: ubuntu-latest
110150
- suite: examples
111-
os: ubuntu-22.04
151+
os: ubuntu-latest
112152
- suite: devserver
113-
os: ubuntu-22.04
153+
os: ubuntu-latest
114154
- suite: plugin
115-
os: ubuntu-22.04
155+
os: ubuntu-latest
116156
- suite: lynx-stack
117-
os: ubuntu-22.04
157+
os: ubuntu-latest
158+
- suite: rsbuild-rsc-plugin
159+
os: ubuntu-latest
118160
fail-fast: false
119161
runs-on: ${{ matrix.os }}
120162
name: execute-all (${{ matrix.suite }})
@@ -128,7 +170,33 @@ jobs:
128170
- run: pnpm i --frozen-lockfile
129171
- name: Expose GitHub Runtime
130172
uses: crazy-max/ghaction-github-runtime@v3
131-
- run: >-
173+
- name: Setup Verdaccio
174+
if: matrix.suite != '_selftest'
175+
run: |
176+
pnpm verdaccio --config verdaccio.yaml &
177+
printf '\n//localhost:4873/:_authToken="this-is-a-fake-token"\n' >> ~/.npmrc
178+
sleep 3
179+
- name: Publish rspack packages to Verdaccio
180+
if: matrix.suite != '_selftest'
181+
working-directory: workspace/rspack
182+
run: |
183+
for pkg in $(pnpm -r --filter "@rspack/binding*..." --filter "@rspack/core..." --filter "@rspack/tracing..." --filter "@rspack/test-tools..." exec -- node -p "process.cwd()"); do
184+
jq 'del(.publishConfig.provenance)' "$pkg/package.json" > "$pkg/package.json.tmp"
185+
mv "$pkg/package.json.tmp" "$pkg/package.json"
186+
done
187+
pnpm -r --filter "@rspack/binding*..." --filter "@rspack/core..." --filter "@rspack/tracing..." --filter "@rspack/test-tools..." publish --no-git-checks --provenance=false --access public --registry=http://localhost:4873
188+
- name: Run suite (with Verdaccio)
189+
if: matrix.suite != '_selftest'
190+
run: >-
191+
NPM_CONFIG_REGISTRY=http://localhost:4873
192+
pnpm tsx ecosystem-ci.ts
193+
run-suites
194+
--stack rspack
195+
--release "$(node -p "require('./workspace/rspack/packages/rspack/package.json').version")"
196+
${{ matrix.suite }}
197+
- name: Run suite (selftest)
198+
if: matrix.suite == '_selftest'
199+
run: >-
132200
pnpm tsx ecosystem-ci.ts
133201
run-suites
134202
--stack rspack

.github/workflows/rspack-ecosystem-ci-from-pr.yml

Lines changed: 55 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ on:
3939
- devserver
4040
- plugin
4141
- lynx-stack
42+
- rsbuild-rsc-plugin
4243
suiteRefType:
4344
description: "type of suite ref to use"
4445
required: true
@@ -72,7 +73,7 @@ jobs:
7273
ref: ${{ inputs.branchName }}
7374

7475
execute-selected-suite:
75-
runs-on: ubuntu-22.04
76+
runs-on: ubuntu-latest
7677
needs: prepare-binding
7778
if: "inputs.suite != '-'"
7879
steps:
@@ -81,13 +82,36 @@ jobs:
8182
with:
8283
repository: ${{ inputs.repo }}
8384
ref: ${{ inputs.branchName }}
85+
- name: Setup Rust
86+
if: inputs.suite == 'lynx-stack'
87+
uses: actions-rust-lang/setup-rust-toolchain@v1
8488
- run: pnpm i --frozen-lockfile
8589
- name: Expose GitHub Runtime
8690
uses: crazy-max/ghaction-github-runtime@v3
87-
- run: >-
91+
# Verdaccio is required for rspack-stack testing.
92+
# pnpm has a known bug (pnpm/pnpm#9270) where file: protocol overrides
93+
# for packages with native optionalDependencies cause version mismatch
94+
# or silent registry fallback. Publishing to a local registry avoids this.
95+
- name: Setup Verdaccio
96+
run: |
97+
pnpm verdaccio --config verdaccio.yaml &
98+
printf '\n//localhost:4873/:_authToken="this-is-a-fake-token"\n' >> ~/.npmrc
99+
sleep 3
100+
- name: Publish rspack packages to Verdaccio
101+
working-directory: workspace/rspack
102+
run: |
103+
for pkg in $(pnpm -r --filter "@rspack/binding*..." --filter "@rspack/core..." --filter "@rspack/tracing..." --filter "@rspack/test-tools..." exec -- node -p "process.cwd()"); do
104+
jq 'del(.publishConfig.provenance)' "$pkg/package.json" > "$pkg/package.json.tmp"
105+
mv "$pkg/package.json.tmp" "$pkg/package.json"
106+
done
107+
pnpm -r --filter "@rspack/binding*..." --filter "@rspack/core..." --filter "@rspack/tracing..." --filter "@rspack/test-tools..." publish --no-git-checks --provenance=false --access public --registry=http://localhost:4873
108+
- name: Run suite
109+
run: >-
110+
NPM_CONFIG_REGISTRY=http://localhost:4873
88111
pnpm tsx ecosystem-ci.ts
89112
run-suites
90113
--stack rspack
114+
--release "$(node -p "require('./workspace/rspack/packages/rspack/package.json').version")"
91115
--suite-${{ inputs.suiteRefType }} ${{ inputs.suiteRef }}
92116
${{ inputs.suite }}
93117
@@ -98,25 +122,27 @@ jobs:
98122
matrix:
99123
include:
100124
- suite: modernjs
101-
os: ubuntu-22.04
125+
os: ubuntu-latest
102126
- suite: rspress
103-
os: ubuntu-22.04
127+
os: ubuntu-latest
104128
- suite: rslib
105-
os: ubuntu-22.04
129+
os: ubuntu-latest
106130
- suite: rstest
107-
os: ubuntu-22.04
131+
os: ubuntu-latest
108132
- suite: rsbuild
109-
os: ubuntu-22.04
133+
os: ubuntu-latest
110134
- suite: rsdoctor
111-
os: ubuntu-22.04
135+
os: ubuntu-latest
112136
- suite: examples
113-
os: ubuntu-22.04
137+
os: ubuntu-latest
114138
- suite: devserver
115-
os: ubuntu-22.04
139+
os: ubuntu-latest
116140
- suite: plugin
117-
os: ubuntu-22.04
141+
os: ubuntu-latest
118142
- suite: lynx-stack
119-
os: ubuntu-22.04
143+
os: ubuntu-latest
144+
- suite: rsbuild-rsc-plugin
145+
os: ubuntu-latest
120146
fail-fast: false
121147
runs-on: ${{ matrix.os }}
122148
name: execute-all (${{ matrix.suite }})
@@ -130,8 +156,24 @@ jobs:
130156
- run: pnpm i --frozen-lockfile
131157
- name: Expose GitHub Runtime
132158
uses: crazy-max/ghaction-github-runtime@v3
133-
- run: >-
159+
- name: Setup Verdaccio
160+
run: |
161+
pnpm verdaccio --config verdaccio.yaml &
162+
printf '\n//localhost:4873/:_authToken="this-is-a-fake-token"\n' >> ~/.npmrc
163+
sleep 3
164+
- name: Publish rspack packages to Verdaccio
165+
working-directory: workspace/rspack
166+
run: |
167+
for pkg in $(pnpm -r --filter "@rspack/binding*..." --filter "@rspack/core..." --filter "@rspack/tracing..." --filter "@rspack/test-tools..." exec -- node -p "process.cwd()"); do
168+
jq 'del(.publishConfig.provenance)' "$pkg/package.json" > "$pkg/package.json.tmp"
169+
mv "$pkg/package.json.tmp" "$pkg/package.json"
170+
done
171+
pnpm -r --filter "@rspack/binding*..." --filter "@rspack/core..." --filter "@rspack/tracing..." --filter "@rspack/test-tools..." publish --no-git-checks --provenance=false --access public --registry=http://localhost:4873
172+
- name: Run suite
173+
run: >-
174+
NPM_CONFIG_REGISTRY=http://localhost:4873
134175
pnpm tsx ecosystem-ci.ts
135176
run-suites
136177
--stack rspack
178+
--release "$(node -p "require('./workspace/rspack/packages/rspack/package.json').version")"
137179
${{ matrix.suite }}

0 commit comments

Comments
 (0)