Skip to content

Commit ff11151

Browse files
fi3eworkampcode-com
andcommitted
feat(rspack): support reusing binding artifact from rspack CI
When sourceRunId is provided, download pre-built binding from rspack's CI workflow instead of rebuilding from scratch (~18 min saved). Falls back to local Rust build when sourceRunId is empty (manual dispatch). Amp-Thread-ID: https://ampcode.com/threads/T-019d4391-1316-72c3-a295-7a86e5a54a3d Co-authored-by: Amp <amp@ampcode.com>
1 parent 1345990 commit ff11151

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

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

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,16 @@ on:
5656
required: true
5757
type: string
5858
default: "precoded"
59+
sourceRunId:
60+
description: "workflow run ID from rspack CI that produced the binding artifact"
61+
required: false
62+
type: string
63+
default: ""
64+
sourceRepo:
65+
description: "rspack repository that produced the binding artifact"
66+
required: false
67+
type: string
68+
default: "web-infra-dev/rspack"
5969

6070
jobs:
6171
get-runner-labels:
@@ -68,7 +78,29 @@ jobs:
6878
runs-on: ${{ fromJSON(needs.get-runner-labels.outputs.LINUX_RUNNER_LABELS) }}
6979
steps:
7080
- uses: actions/checkout@v4
71-
- uses: ./.github/actions/prepare-rspack-binding
81+
82+
# Path A: download pre-built binding from rspack CI
83+
- name: Download binding from rspack CI
84+
if: inputs.sourceRunId != ''
85+
uses: actions/download-artifact@v4
86+
with:
87+
name: bindings-x86_64-unknown-linux-gnu
88+
path: workspace/rspack-binding
89+
repository: ${{ inputs.sourceRepo }}
90+
run-id: ${{ inputs.sourceRunId }}
91+
github-token: ${{ secrets.RSPACK_REPO_ACTIONS_READ_ONLY }}
92+
93+
- name: Upload normalized binding artifact
94+
if: inputs.sourceRunId != ''
95+
uses: actions/upload-artifact@v4
96+
with:
97+
name: binding-linux-x64-gnu
98+
path: workspace/rspack-binding/*.node
99+
100+
# Path B: build binding from scratch (manual dispatch)
101+
- name: Build binding from scratch
102+
if: inputs.sourceRunId == ''
103+
uses: ./.github/actions/prepare-rspack-binding
72104
with:
73105
repository: ${{ inputs.repo }}
74106
ref: ${{ inputs.commitSHA }}

0 commit comments

Comments
 (0)