Skip to content

Commit 346834f

Browse files
ci: enhance CI workflow to upload and download build artifacts for downstream jobs
1 parent 656bce9 commit 346834f

2 files changed

Lines changed: 21 additions & 3 deletions

File tree

.github/workflows/test.yml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,15 @@ jobs:
3737
with:
3838
node: ${{ env.NODE_VERSION }}
3939

40+
# Let downstream jobs consume the build instead of rebuilding.
41+
- name: Upload build output
42+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
43+
with:
44+
name: dist
45+
path: dist
46+
if-no-files-found: error
47+
retention-days: 1
48+
4049
unit:
4150
needs: build # Require build to complete before running tests
4251

@@ -65,6 +74,8 @@ jobs:
6574
token: ${{ secrets.CODECOV_TOKEN }}
6675

6776
rsc-directive:
77+
needs: build # Reuse its build output
78+
6879
name: Verify 'use client' directive
6980
runs-on: ubuntu-latest
7081

@@ -81,7 +92,13 @@ jobs:
8192
- name: Install dependencies
8293
run: npm ci
8394

84-
- name: Build bundles and assert 'use client' directive
85-
run: npm run test:dist
95+
- name: Download build output
96+
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
97+
with:
98+
name: dist
99+
path: dist
100+
101+
- name: Assert 'use client' directive
102+
run: npm run test:dist:only
86103
env:
87104
ASSERT_USE_CLIENT: '1'

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
"lint": "eslint --ext=tsx ./src ./__tests__",
2525
"start": "rollup -cw",
2626
"test": "jest --coverage",
27-
"test:dist": "npm run build && jest use-client-directive",
27+
"test:dist": "npm run build && npm run test:dist:only",
28+
"test:dist:only": "jest use-client-directive",
2829
"prepack": "npm run build",
2930
"docs": "typedoc --options typedoc.js src",
3031
"install:examples": "npm i --prefix=examples/cra-react-router --no-package-lock --legacy-peer-deps && npm i --prefix=examples/gatsby-app --no-package-lock --legacy-peer-deps && npm i --prefix=examples/nextjs-app --no-package-lock --legacy-peer-deps && npm ci --prefix=examples/users-api",

0 commit comments

Comments
 (0)