@@ -42,12 +42,19 @@ jobs:
4242 playground
4343 retention-days : 3
4444
45- verify-build :
45+ verify-scripts :
4646 needs : build
4747 strategy :
4848 matrix :
49- node-version : [22]
49+ node-version : [18, 20, 22]
5050 os : [ubuntu-latest, windows-latest, macos-latest]
51+ verification-script :
52+ - pnpm --filter "\!*typescript*" build
53+ - pnpm --filter "*typescript*" build
54+ - pnpm --filter "*vitest*" test:unit
55+ # FIXME: it's failing now
56+ # - pnpm --filter "*with-tests*" test:unit
57+ # TODO: lint
5158 runs-on : ${{ matrix.os }}
5259 continue-on-error : ${{ matrix.os == 'windows-latest' }}
5360 env :
@@ -76,129 +83,88 @@ jobs:
7683
7784 - name : Run build script in playground
7885 working-directory : ./playground
79- run : pnpm --filter "\!*typescript*" build
80-
81- # verify-vitest:
82- # # needs: build
83- # strategy:
84- # matrix:
85- # node-version: [22]
86- # os: [ubuntu-latest, windows-latest, macos-latest]
87- # runs-on: ${{ matrix.os }}
88- # continue-on-error: ${{ matrix.os == 'windows-latest' }}
89- # env:
90- # CYPRESS_INSTALL_BINARY: 0
91- # CHROMEDRIVER_SKIP_DOWNLOAD: true
92- # steps:
93- # - uses: actions/checkout@v4
94- # with:
95- # submodules: true
96- # - uses: pnpm/action-setup@v4
97- # - uses: actions/setup-node@v4
98- # with:
99- # node-version: ${{ matrix.node-version }}
100- # cache: 'pnpm'
101-
102- # # FIXME: use artifacts to share the playground across different jobs
103- # - name: Build the package
104- # run: pnpm install && pnpm build && pnpm snapshot
105- # - name: Install dependencies in playground
106- # working-directory: ./playground
107- # run: pnpm install --no-frozen-lockfile
108-
109- # - name: Run test:unit script in vitest projects
110- # working-directory: ../playground
111- # run: pnpm --filter "{*vitest*}" test:unit
112-
113- # # FIXME: it's failing now
114- # # - name: Run test:unit script in with-tests projects
115- # # working-directory: ../playground
116- # # run: pnpm --filter "{*with-tests*}" test:unit
117-
118- # verify-e2e:
119- # needs: build
120- # strategy:
121- # matrix:
122- # e2e-framework: ['cypress', 'playwright']
123- # node-version: [22]
124- # os: [ubuntu-latest, windows-latest, macos-latest]
125- # runs-on: ${{ matrix.os }}
126- # continue-on-error: ${{ matrix.os == 'windows-latest' }}
127- # env:
128- # # Sometimes the Linux runner can't verify Cypress in 30s
129- # CYPRESS_VERIFY_TIMEOUT: 60000
130- # steps:
131- # - uses: actions/checkout@v4
132- # - uses: pnpm/action-setup@v3
133- # - uses: actions/setup-node@v4
134- # with:
135- # node-version: ${{ matrix.node-version }}
136- # cache: 'pnpm'
137-
138- # - uses: actions/cache/restore@v4
139- # id: cache-restore
140- # with:
141- # path: outfile.cjs
142- # key: ${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }}
143- # - name: Build the package on cache miss
144- # if: steps.cache-restore.outputs.cache-hit != 'true'
145- # run: pnpm install && pnpm build
146- # - name: Snapshot
147- # run: pnpm snapshot && echo "{}" > playground/package.json && mv playground ../playground
148- # - name: Install dependencies in playground
149- # working-directory: ../playground
150- # run: pnpm install --no-frozen-lockfile
151-
152- # # https://github.com/vitejs/vite/blob/main/.github/workflows/ci.yml#L62
153- # # Install playwright's binary under custom directory to cache
154- # - name: Set Playwright & Cypress path
155- # run: |
156- # echo "PLAYWRIGHT_BROWSERS_PATH=$HOME/.cache/playwright-bin" >> $GITHUB_ENV
157- # echo "CYPRESS_CACHE_FOLDER=$HOME/.cache/cypress-bin" >> $GITHUB_ENV
158- # - name: Set Playwright & Cypress path (windows)
159- # if: runner.os == 'Windows'
160- # run: |
161- # echo "PLAYWRIGHT_BROWSERS_PATH=$HOME\.cache\playwright-bin" >> $env:GITHUB_ENV
162- # echo "CYPRESS_CACHE_FOLDER=$HOME\.cache\cypress-bin" >> $env:GITHUB_ENV
163-
164- # - if: ${{ contains(matrix.e2e-framework, 'cypress') }}
165- # name: Cache Cypress binaries
166- # id: cache-cypress
167- # uses: actions/cache@v4
168- # with:
169- # # TODO: avoid snowballing by adding version
170- # key: ${{ runner.os }}-cypress-bin
171- # path: ${{ env.CYPRESS_CACHE_FOLDER }}
172-
173- # - if: ${{ contains(matrix.e2e-framework, 'playwright') }}
174- # name: Cache Playwright's binary
175- # uses: actions/cache@v4
176- # with:
177- # # Playwright removes unused browsers automatically
178- # # So does not need to add playwright version to key
179- # key: ${{ runner.os }}-playwright-bin-v1
180- # path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }}
181-
182- # - name: Download Cypress
183- # if: ${{ contains(matrix.e2e-framework, 'cypress') }}
184- # working-directory: ../playground
185- # run: |
186- # pnpm --filter "{cypress}" exec cypress cache list
187- # pnpm --filter "{cypress}" exec cypress install
188-
189- # - if: ${{ contains(matrix.e2e-framework, 'playwright') }}
190- # name: Install Playwright dependencies
191- # working-directory: ../playground
192- # run: pnpm --filter "{playwright}" exec playwright install --with-deps
193-
194- # # Run `test:e2e` in project folders contain `matrix.e2e-framework`
195- # - name: Run e2e test script
196- # working-directory: ../playground
197- # run: pnpm --filter "{*${{ matrix.e2e-framework }}*}" test:e2e
198-
199- # # FIXME: `--with-tests` folders
200- # # FIXME: Cypress component testing for projects without Vitest
86+ run : ${{ matrix.verification-script }}
87+
88+ verify-e2e :
89+ needs : build
90+ strategy :
91+ matrix :
92+ e2e-framework : ['cypress', 'playwright']
93+ node-version : [22]
94+ os : [ubuntu-latest, windows-latest, macos-latest]
95+ runs-on : ${{ matrix.os }}
96+ continue-on-error : ${{ matrix.os == 'windows-latest' }}
97+ env :
98+ # Sometimes the Linux runner can't verify Cypress in 30s
99+ CYPRESS_VERIFY_TIMEOUT : 60000
100+ steps :
101+ - uses : actions/checkout@v4
102+ - uses : pnpm/action-setup@v3
103+ - uses : actions/setup-node@v4
104+ with :
105+ node-version : ${{ matrix.node-version }}
106+ cache : ' pnpm'
201107
108+ - uses : actions/cache/restore@v4
109+ id : cache-restore
110+ with :
111+ path : outfile.cjs
112+ key : ${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }}
113+ - name : Build the package on cache miss
114+ if : steps.cache-restore.outputs.cache-hit != 'true'
115+ run : pnpm install && pnpm build
116+ - name : Snapshot
117+ run : pnpm snapshot && echo "{}" > playground/package.json && mv playground ../playground
118+ - name : Install dependencies in playground
119+ working-directory : ../playground
120+ run : pnpm install --no-frozen-lockfile
121+
122+ # https://github.com/vitejs/vite/blob/main/.github/workflows/ci.yml#L62
123+ # Install playwright's binary under custom directory to cache
124+ - name : Set Playwright & Cypress path
125+ run : |
126+ echo "PLAYWRIGHT_BROWSERS_PATH=$HOME/.cache/playwright-bin" >> $GITHUB_ENV
127+ echo "CYPRESS_CACHE_FOLDER=$HOME/.cache/cypress-bin" >> $GITHUB_ENV
128+ - name : Set Playwright & Cypress path (windows)
129+ if : runner.os == 'Windows'
130+ run : |
131+ echo "PLAYWRIGHT_BROWSERS_PATH=$HOME\.cache\playwright-bin" >> $env:GITHUB_ENV
132+ echo "CYPRESS_CACHE_FOLDER=$HOME\.cache\cypress-bin" >> $env:GITHUB_ENV
133+
134+ - if : ${{ contains(matrix.e2e-framework, 'cypress') }}
135+ name : Cache Cypress binaries
136+ id : cache-cypress
137+ uses : actions/cache@v4
138+ with :
139+ # TODO: avoid snowballing by adding version
140+ key : ${{ runner.os }}-cypress-bin
141+ path : ${{ env.CYPRESS_CACHE_FOLDER }}
202142
203- # # FIXME: verify-lint
204- # # `pnpm lint --no-fix --max-warnings=0`
143+ - if : ${{ contains(matrix.e2e-framework, 'playwright') }}
144+ name : Cache Playwright's binary
145+ uses : actions/cache@v4
146+ with :
147+ # Playwright removes unused browsers automatically
148+ # So does not need to add playwright version to key
149+ key : ${{ runner.os }}-playwright-bin-v1
150+ path : ${{ env.PLAYWRIGHT_BROWSERS_PATH }}
151+
152+ - name : Download Cypress
153+ if : ${{ contains(matrix.e2e-framework, 'cypress') }}
154+ working-directory : ../playground
155+ run : |
156+ pnpm --filter "{cypress}" exec cypress cache list
157+ pnpm --filter "{cypress}" exec cypress install
158+
159+ - if : ${{ contains(matrix.e2e-framework, 'playwright') }}
160+ name : Install Playwright dependencies
161+ working-directory : ../playground
162+ run : pnpm --filter "{playwright}" exec playwright install --with-deps
163+
164+ # Run `test:e2e` in project folders contain `matrix.e2e-framework`
165+ - name : Run e2e test script
166+ working-directory : ../playground
167+ run : pnpm --filter "{*${{ matrix.e2e-framework }}*}" test:e2e
168+
169+ # FIXME: `--with-tests` folders
170+ # FIXME: Cypress component testing for projects without Vitest
0 commit comments