Skip to content

Commit b29e8cd

Browse files
authored
Merge pull request #11629 from DestinyItemManager/webpack-stats-relative-ci-fix
Webpack stats relative ci fix
2 parents cad508d + c86ce89 commit b29e8cd

File tree

5 files changed

+73
-6
lines changed

5 files changed

+73
-6
lines changed

.github/workflows/pr-build.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,13 @@ jobs:
6565
- babel.config.js
6666
6767
# Send webpack stats and build information to RelativeCI
68-
- name: Send bundle stats and build information to RelativeCI
68+
- name: Upload webpack stats
6969
if: ${{ steps.filter.outputs.build-pipeline == 'true' }}
70-
uses: relative-ci/[email protected]
70+
uses: actions/upload-artifact@v4
7171
with:
72-
key: ${{ secrets.RELATIVE_CI_KEY }}
73-
token: ${{ secrets.GITHUB_TOKEN }}
74-
webpackStatsFile: ./webpack-stats.json
72+
name: webpack-stats
73+
path: webpack-stats.json
74+
retention-days: 1
7575

7676
# Deploy a preview version of the server!
7777

.github/workflows/relative-ci.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: RelativeCI
2+
3+
on:
4+
workflow_run:
5+
workflows: ["PR Build"]
6+
types: [completed]
7+
8+
jobs:
9+
upload:
10+
runs-on: ubuntu-latest
11+
if: github.event.workflow_run.conclusion == 'success'
12+
13+
steps:
14+
- name: Check for webpack stats artifact
15+
id: check-artifact
16+
uses: actions/github-script@v7
17+
with:
18+
script: |
19+
const artifacts = await github.rest.actions.listWorkflowRunArtifacts({
20+
owner: context.repo.owner,
21+
repo: context.repo.repo,
22+
run_id: context.payload.workflow_run.id
23+
});
24+
25+
const artifact = artifacts.data.artifacts.find(a => a.name === 'webpack-stats');
26+
27+
if (artifact) {
28+
console.log(`✅ Found webpack-stats artifact (${artifact.size_in_bytes} bytes)`);
29+
core.setOutput('exists', 'true');
30+
} else {
31+
console.log('ℹ️ No webpack-stats artifact found - skipping upload');
32+
core.setOutput('exists', 'false');
33+
}
34+
35+
- name: Download webpack stats
36+
if: steps.check-artifact.outputs.exists == 'true'
37+
uses: actions/download-artifact@v4
38+
with:
39+
name: webpack-stats
40+
run-id: ${{ github.event.workflow_run.id }}
41+
github-token: ${{ secrets.GITHUB_TOKEN }}
42+
43+
- name: Upload to RelativeCI
44+
if: steps.check-artifact.outputs.exists == 'true'
45+
uses: relative-ci/agent-action@v2
46+
with:
47+
key: ${{ secrets.RELATIVE_CI_KEY }}
48+
token: ${{ secrets.GITHUB_TOKEN }}
49+
webpackStatsFile: ./webpack-stats.json

config/webpack.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { InjectManifest } from '@aaroon/workbox-rspack-plugin';
2+
import filterWebpackStats from '@bundle-stats/plugin-webpack-filter';
23
import { type Configuration, rspack } from '@rspack/core';
34
import ReactRefreshPlugin from '@rspack/plugin-react-refresh';
45
import { CleanWebpackPlugin } from 'clean-webpack-plugin';
@@ -548,6 +549,10 @@ export default (env: Env) => {
548549
/\.br$/,
549550
],
550551
},
552+
transform: (webpackStats) => {
553+
const filteredSource = filterWebpackStats(webpackStats);
554+
return JSON.stringify(filteredSource);
555+
},
551556
}),
552557

553558
new SondaWebpackPlugin({

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@
9494
"@babel/register": "^7.28.3",
9595
"@bhollis/css-modules-typescript-loader": "^1.0.1",
9696
"@bhollis/eslint-plugin-css-modules": "^1.0.0",
97+
"@bundle-stats/plugin-webpack-filter": "^4.21.7",
9798
"@eslint-react/eslint-plugin": "^2.3.9",
9899
"@eslint/compat": "^2.0.0",
99100
"@rspack/cli": "^1.6.6",

pnpm-lock.yaml

Lines changed: 13 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)