Skip to content

Commit 6433f0b

Browse files
committed
ci: use artifact to share output
1 parent 92a3818 commit 6433f0b

File tree

1 file changed

+51
-58
lines changed

1 file changed

+51
-58
lines changed

.github/workflows/ci.yml

Lines changed: 51 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -11,40 +11,43 @@ on:
1111
branches:
1212
- '**'
1313
jobs:
14-
# build:
15-
# runs-on: ubuntu-latest
16-
# name: Build the package
17-
# steps:
18-
# - uses: actions/checkout@v4
19-
# - uses: pnpm/action-setup@v3
20-
# - uses: actions/setup-node@v4
21-
# with:
22-
# node-version: 22
23-
# cache: 'pnpm'
24-
# - run: pnpm install
25-
# env:
26-
# CYPRESS_INSTALL_BINARY: 0
27-
# CHROMEDRIVER_SKIP_DOWNLOAD: true
28-
# - run: pnpm build
29-
# - run: pnpm test:unit
30-
31-
# - run: pnpm snapshot
32-
# # Use cache to share the output across different jobs
33-
# # No need to cache node_modules because they are all bundled
34-
# - uses: actions/cache/save@v4
35-
# id: cache
36-
# with:
37-
# path: |
38-
# outfile.cjs
39-
# playground
40-
# key: ${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }}
14+
build:
15+
runs-on: ubuntu-latest
16+
name: Build the package
17+
steps:
18+
- uses: actions/checkout@v4
19+
with:
20+
submodules: true
21+
- uses: pnpm/action-setup@v4
22+
- uses: actions/setup-node@v4
23+
with:
24+
node-version: 22
25+
cache: 'pnpm'
26+
- run: pnpm install
27+
env:
28+
CYPRESS_INSTALL_BINARY: 0
29+
CHROMEDRIVER_SKIP_DOWNLOAD: true
30+
- run: pnpm build
31+
- run: pnpm test:unit
32+
33+
- run: pnpm snapshot
34+
35+
# Use artifact to share the output across different jobs
36+
# No need to save node_modules because they are all bundled
37+
- uses: actions/upload-artifact@v2
38+
with:
39+
name: build-output
40+
path: |
41+
outfile.cjs
42+
playground
43+
retention-days: 3
4144

4245
test-build:
43-
# needs: build
46+
needs: build
4447
strategy:
4548
matrix:
4649
node-version: [22]
47-
os: [ubuntu-latest]
50+
os: [ubuntu-latest, windows-latest, macos-latest]
4851
runs-on: ${{ matrix.os }}
4952
continue-on-error: ${{ matrix.os == 'windows-latest' }}
5053
env:
@@ -54,33 +57,27 @@ jobs:
5457
- uses: actions/checkout@v4
5558
with:
5659
submodules: true
57-
- uses: pnpm/action-setup@v3
58-
with:
59-
standalone: true
60+
- uses: pnpm/action-setup@v4
6061
- uses: actions/setup-node@v4
6162
with:
6263
node-version: ${{ matrix.node-version }}
6364
cache: 'pnpm'
6465

65-
# - uses: actions/cache/restore@v4
66-
# id: cache-restore
67-
# with:
68-
# path: |
69-
# outfile.cjs
70-
# playground
71-
# key: ${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }}
72-
- name: Build the package
73-
run: pnpm install && pnpm build && pnpm snapshot
74-
- run: echo "{}" > playground/package.json
75-
- run: mv playground playground-tmp
66+
# use artifacts to share the playground across different jobs
67+
- uses: actions/download-artifact@v2
68+
with:
69+
name: build-output
70+
7671
- name: Install dependencies in playground
77-
run: pnpm -C ./playground-tmp install --no-frozen-lockfile
72+
working-directory: ./playground
73+
run: pnpm install --no-frozen-lockfile
7874

7975
- name: Run build script in playground
80-
run: pnpm -C ./playground-tmp --filter "*" build
76+
working-directory: ./playground
77+
run: pnpm --filter "*" build
8178

8279
# test-vitest:
83-
# needs: build
80+
# # needs: build
8481
# strategy:
8582
# matrix:
8683
# node-version: [22]
@@ -92,25 +89,21 @@ jobs:
9289
# CHROMEDRIVER_SKIP_DOWNLOAD: true
9390
# steps:
9491
# - uses: actions/checkout@v4
95-
# - uses: pnpm/action-setup@v3
92+
# with:
93+
# submodules: true
94+
# - uses: pnpm/action-setup@v4
9695
# - uses: actions/setup-node@v4
9796
# with:
9897
# node-version: ${{ matrix.node-version }}
9998
# cache: 'pnpm'
10099

101-
# - uses: actions/cache/restore@v4
102-
# id: cache-restore
103-
# with:
104-
# path: outfile.cjs
105-
# key: ${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }}
106-
# - name: Build the package on cache miss
107-
# if: steps.cache-restore.outputs.cache-hit != 'true'
108-
# run: pnpm install && pnpm build
109-
# - name: Snapshot
110-
# run: pnpm snapshot && echo "{}" > playground/package.json && mv playground ../playground
100+
# # FIXME: use artifacts to share the playground across different jobs
101+
# - name: Build the package
102+
# run: pnpm install && pnpm build && pnpm snapshot
111103
# - name: Install dependencies in playground
112-
# working-directory: ../playground
104+
# working-directory: ./playground
113105
# run: pnpm install --no-frozen-lockfile
106+
114107
# - name: Run test:unit script in vitest projects
115108
# working-directory: ../playground
116109
# run: pnpm --filter "{*vitest*}" test:unit

0 commit comments

Comments
 (0)