@@ -28,12 +28,15 @@ jobs:
2828 - run : pnpm build
2929 - run : pnpm test:unit
3030
31+ - run : pnpm snapshot
3132 # Use cache to share the output across different jobs
3233 # No need to cache node_modules because they are all bundled
3334 - uses : actions/cache/save@v4
3435 id : cache
3536 with :
36- path : outfile.cjs
37+ path : |
38+ outfile.cjs
39+ playground
3740 key : ${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }}
3841
3942 test-build :
6164 path : outfile.cjs
6265 key : ${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }}
6366 - name : Build the package on cache miss
64- run : pnpm install && pnpm build
65- - name : Snapshot
66- run : pnpm snapshot && echo "{}" > playground/package.json && mv playground ../playground
67+ run : pnpm install && pnpm build && pnpm snapshot
68+ - name : Move playground
69+ run : echo "{}" > playground/package.json && mv playground ../playground
6770 - name : Install dependencies in playground
6871 working-directory : ../playground
6972 run : pnpm install --no-frozen-lockfile
@@ -72,131 +75,131 @@ jobs:
7275 working-directory : ../playground
7376 run : pnpm --filter "*" build
7477
75- test-vitest :
76- needs : build
77- strategy :
78- matrix :
79- node-version : [22]
80- os : [ubuntu-latest, windows-latest, macos-latest]
81- runs-on : ${{ matrix.os }}
82- continue-on-error : ${{ matrix.os == 'windows-latest' }}
83- env :
84- CYPRESS_INSTALL_BINARY : 0
85- CHROMEDRIVER_SKIP_DOWNLOAD : true
86- steps :
87- - uses : actions/checkout@v4
88- - uses : pnpm/action-setup@v3
89- - uses : actions/setup-node@v4
90- with :
91- node-version : ${{ matrix.node-version }}
92- cache : ' pnpm'
93-
94- - uses : actions/cache/restore@v4
95- id : cache-restore
96- with :
97- path : outfile.cjs
98- key : ${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }}
99- - name : Build the package on cache miss
100- if : steps.cache-restore.outputs.cache-hit != 'true'
101- run : pnpm install && pnpm build
102- - name : Snapshot
103- run : pnpm snapshot && echo "{}" > playground/package.json && mv playground ../playground
104- - name : Install dependencies in playground
105- working-directory : ../playground
106- run : pnpm install --no-frozen-lockfile
107- - name : Run test:unit script in vitest projects
108- working-directory : ../playground
109- run : pnpm --filter "{*vitest*}" test:unit
110-
111- # FIXME: it's failing now
112- # - name: Run test:unit script in with-tests projects
113- # working-directory: ../playground
114- # run: pnpm --filter "{*with-tests*}" test:unit
115-
116- test-e2e :
117- needs : build
118- strategy :
119- matrix :
120- e2e-framework : ['cypress', 'playwright']
121- node-version : [22]
122- os : [ubuntu-latest, windows-latest, macos-latest]
123- runs-on : ${{ matrix.os }}
124- continue-on-error : ${{ matrix.os == 'windows-latest' }}
125- env :
126- # Sometimes the Linux runner can't verify Cypress in 30s
127- CYPRESS_VERIFY_TIMEOUT : 60000
128- steps :
129- - uses : actions/checkout@v4
130- - uses : pnpm/action-setup@v3
131- - uses : actions/setup-node@v4
132- with :
133- node-version : ${{ matrix.node-version }}
134- cache : ' pnpm'
135-
136- - uses : actions/cache/restore@v4
137- id : cache-restore
138- with :
139- path : outfile.cjs
140- key : ${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }}
141- - name : Build the package on cache miss
142- if : steps.cache-restore.outputs.cache-hit != 'true'
143- run : pnpm install && pnpm build
144- - name : Snapshot
145- run : pnpm snapshot && echo "{}" > playground/package.json && mv playground ../playground
146- - name : Install dependencies in playground
147- working-directory : ../playground
148- run : pnpm install --no-frozen-lockfile
149-
150- # https://github.com/vitejs/vite/blob/main/.github/workflows/ci.yml#L62
151- # Install playwright's binary under custom directory to cache
152- - name : Set Playwright & Cypress path
153- run : |
154- echo "PLAYWRIGHT_BROWSERS_PATH=$HOME/.cache/playwright-bin" >> $GITHUB_ENV
155- echo "CYPRESS_CACHE_FOLDER=$HOME/.cache/cypress-bin" >> $GITHUB_ENV
156- - name : Set Playwright & Cypress path (windows)
157- if : runner.os == 'Windows'
158- run : |
159- echo "PLAYWRIGHT_BROWSERS_PATH=$HOME\.cache\playwright-bin" >> $env:GITHUB_ENV
160- echo "CYPRESS_CACHE_FOLDER=$HOME\.cache\cypress-bin" >> $env:GITHUB_ENV
161-
162- - if : ${{ contains(matrix.e2e-framework, 'cypress') }}
163- name : Cache Cypress binaries
164- id : cache-cypress
165- uses : actions/cache@v4
166- with :
167- # TODO: avoid snowballing by adding version
168- key : ${{ runner.os }}-cypress-bin
169- path : ${{ env.CYPRESS_CACHE_FOLDER }}
170-
171- - if : ${{ contains(matrix.e2e-framework, 'playwright') }}
172- name : Cache Playwright's binary
173- uses : actions/cache@v4
174- with :
175- # Playwright removes unused browsers automatically
176- # So does not need to add playwright version to key
177- key : ${{ runner.os }}-playwright-bin-v1
178- path : ${{ env.PLAYWRIGHT_BROWSERS_PATH }}
179-
180- - name : Download Cypress
181- if : ${{ contains(matrix.e2e-framework, 'cypress') }}
182- working-directory : ../playground
183- run : |
184- pnpm --filter "{cypress}" exec cypress cache list
185- pnpm --filter "{cypress}" exec cypress install
186-
187- - if : ${{ contains(matrix.e2e-framework, 'playwright') }}
188- name : Install Playwright dependencies
189- working-directory : ../playground
190- run : pnpm --filter "{playwright}" exec playwright install --with-deps
191-
192- # Run `test:e2e` in project folders contain `matrix.e2e-framework`
193- - name : Run e2e test script
194- working-directory : ../playground
195- run : pnpm --filter "{*${{ matrix.e2e-framework }}*}" test:e2e
196-
197- # FIXME: `--with-tests` folders
198- # FIXME: Cypress component testing for projects without Vitest
199-
200-
201- # FIXME: test-lint
202- # `pnpm lint --no-fix --max-warnings=0`
78+ # test-vitest:
79+ # needs: build
80+ # strategy:
81+ # matrix:
82+ # node-version: [22]
83+ # os: [ubuntu-latest, windows-latest, macos-latest]
84+ # runs-on: ${{ matrix.os }}
85+ # continue-on-error: ${{ matrix.os == 'windows-latest' }}
86+ # env:
87+ # CYPRESS_INSTALL_BINARY: 0
88+ # CHROMEDRIVER_SKIP_DOWNLOAD: true
89+ # steps:
90+ # - uses: actions/checkout@v4
91+ # - uses: pnpm/action-setup@v3
92+ # - uses: actions/setup-node@v4
93+ # with:
94+ # node-version: ${{ matrix.node-version }}
95+ # cache: 'pnpm'
96+
97+ # - uses: actions/cache/restore@v4
98+ # id: cache-restore
99+ # with:
100+ # path: outfile.cjs
101+ # key: ${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }}
102+ # - name: Build the package on cache miss
103+ # if: steps.cache-restore.outputs.cache-hit != 'true'
104+ # run: pnpm install && pnpm build
105+ # - name: Snapshot
106+ # run: pnpm snapshot && echo "{}" > playground/package.json && mv playground ../playground
107+ # - name: Install dependencies in playground
108+ # working-directory: ../playground
109+ # run: pnpm install --no-frozen-lockfile
110+ # - name: Run test:unit script in vitest projects
111+ # working-directory: ../playground
112+ # run: pnpm --filter "{*vitest*}" test:unit
113+
114+ # # FIXME: it's failing now
115+ # # - name: Run test:unit script in with-tests projects
116+ # # working-directory: ../playground
117+ # # run: pnpm --filter "{*with-tests*}" test:unit
118+
119+ # test-e2e:
120+ # needs: build
121+ # strategy:
122+ # matrix:
123+ # e2e-framework: ['cypress', 'playwright']
124+ # node-version: [22]
125+ # os: [ubuntu-latest, windows-latest, macos-latest]
126+ # runs-on: ${{ matrix.os }}
127+ # continue-on-error: ${{ matrix.os == 'windows-latest' }}
128+ # env:
129+ # # Sometimes the Linux runner can't verify Cypress in 30s
130+ # CYPRESS_VERIFY_TIMEOUT: 60000
131+ # steps:
132+ # - uses: actions/checkout@v4
133+ # - uses: pnpm/action-setup@v3
134+ # - uses: actions/setup-node@v4
135+ # with:
136+ # node-version: ${{ matrix.node-version }}
137+ # cache: 'pnpm'
138+
139+ # - uses: actions/cache/restore@v4
140+ # id: cache-restore
141+ # with:
142+ # path: outfile.cjs
143+ # key: ${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }}
144+ # - name: Build the package on cache miss
145+ # if: steps.cache-restore.outputs.cache-hit != 'true'
146+ # run: pnpm install && pnpm build
147+ # - name: Snapshot
148+ # run: pnpm snapshot && echo "{}" > playground/package.json && mv playground ../playground
149+ # - name: Install dependencies in playground
150+ # working-directory: ../playground
151+ # run: pnpm install --no-frozen-lockfile
152+
153+ # # https://github.com/vitejs/vite/blob/main/.github/workflows/ci.yml#L62
154+ # # Install playwright's binary under custom directory to cache
155+ # - name: Set Playwright & Cypress path
156+ # run: |
157+ # echo "PLAYWRIGHT_BROWSERS_PATH=$HOME/.cache/playwright-bin" >> $GITHUB_ENV
158+ # echo "CYPRESS_CACHE_FOLDER=$HOME/.cache/cypress-bin" >> $GITHUB_ENV
159+ # - name: Set Playwright & Cypress path (windows)
160+ # if: runner.os == 'Windows'
161+ # run: |
162+ # echo "PLAYWRIGHT_BROWSERS_PATH=$HOME\.cache\playwright-bin" >> $env:GITHUB_ENV
163+ # echo "CYPRESS_CACHE_FOLDER=$HOME\.cache\cypress-bin" >> $env:GITHUB_ENV
164+
165+ # - if: ${{ contains(matrix.e2e-framework, 'cypress') }}
166+ # name: Cache Cypress binaries
167+ # id: cache-cypress
168+ # uses: actions/cache@v4
169+ # with:
170+ # # TODO: avoid snowballing by adding version
171+ # key: ${{ runner.os }}-cypress-bin
172+ # path: ${{ env.CYPRESS_CACHE_FOLDER }}
173+
174+ # - if: ${{ contains(matrix.e2e-framework, 'playwright') }}
175+ # name: Cache Playwright's binary
176+ # uses: actions/cache@v4
177+ # with:
178+ # # Playwright removes unused browsers automatically
179+ # # So does not need to add playwright version to key
180+ # key: ${{ runner.os }}-playwright-bin-v1
181+ # path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }}
182+
183+ # - name: Download Cypress
184+ # if: ${{ contains(matrix.e2e-framework, 'cypress') }}
185+ # working-directory: ../playground
186+ # run: |
187+ # pnpm --filter "{cypress}" exec cypress cache list
188+ # pnpm --filter "{cypress}" exec cypress install
189+
190+ # - if: ${{ contains(matrix.e2e-framework, 'playwright') }}
191+ # name: Install Playwright dependencies
192+ # working-directory: ../playground
193+ # run: pnpm --filter "{playwright}" exec playwright install --with-deps
194+
195+ # # Run `test:e2e` in project folders contain `matrix.e2e-framework`
196+ # - name: Run e2e test script
197+ # working-directory: ../playground
198+ # run: pnpm --filter "{*${{ matrix.e2e-framework }}*}" test:e2e
199+
200+ # # FIXME: `--with-tests` folders
201+ # # FIXME: Cypress component testing for projects without Vitest
202+
203+
204+ # # FIXME: test-lint
205+ # # `pnpm lint --no-fix --max-warnings=0`
0 commit comments