2424 - run : pnpm install
2525 env :
2626 CYPRESS_INSTALL_BINARY : 0
27+ CHROMEDRIVER_SKIP_DOWNLOAD : true
2728 - run : pnpm build
2829 - run : pnpm test:unit
2930
@@ -35,72 +36,88 @@ jobs:
3536 path : outfile.cjs
3637 key : ${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }}
3738
38- test :
39+ test-build :
40+ needs : build
41+ strategy :
42+ matrix :
43+ node-version : [22]
44+ os : [ubuntu-latest, windows-latest, macos-latest]
45+ runs-on : ${{ matrix.os }}
46+ continue-on-error : ${{ matrix.os == 'windows-latest' }}
47+ env :
48+ # Sometimes the Linux runner can't verify Cypress in 30s
49+ CYPRESS_VERIFY_TIMEOUT : 60000
50+ steps :
51+ - uses : actions/checkout@v4
52+ - uses : pnpm/action-setup@v3
53+ - uses : actions/setup-node@v4
54+ with :
55+ node-version : ${{ matrix.node-version }}
56+ cache : ' pnpm'
57+
58+ - uses : actions/cache/restore@v4
59+ id : cache-restore
60+ with :
61+ path : |
62+ outfile.cjs
63+ playground
64+ key : ${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }}
65+ - name : Build the package on cache miss
66+ if : steps.cache-restore.outputs.cache-hit != 'true'
67+ run : pnpm install && pnpm build && pnpm snapshot && cd playground && pnpm install --no-frozen-lockfile
68+
69+ - name : Run build script in playground
70+ working-directory : ./playground
71+ run : pnpm --filter "*" build
72+
73+ test-vitest :
3974 needs : build
4075 strategy :
4176 matrix :
42- flag-for-ts : ['', '--typescript']
43- flag-for-jsx : ['', '--jsx']
44- flag-for-router : ['', '--router']
45- flag-for-pinia : ['', '--pinia']
46- flag-for-vitest : ['', '--vitest']
77+ node-version : [22]
78+ os : [ubuntu-latest, windows-latest, macos-latest]
79+ runs-on : ${{ matrix.os }}
80+ continue-on-error : ${{ matrix.os == 'windows-latest' }}
81+ env :
82+ CYPRESS_INSTALL_BINARY : 0
83+ CHROMEDRIVER_SKIP_DOWNLOAD : true
84+ steps :
85+ - uses : actions/checkout@v4
86+ - uses : pnpm/action-setup@v3
87+ - uses : actions/setup-node@v4
88+ with :
89+ node-version : ${{ matrix.node-version }}
90+ cache : ' pnpm'
4791
48- # It's quite costly to install Cypress & Playwright even with cache.
49- # Maybe we can split them into another job so that all the projects
50- # can share the same binary installation.
51- flag-for-e2e : ['', '--cypress', '--playwright']
92+ - uses : actions/cache/restore@v4
93+ id : cache-restore
94+ with :
95+ path : |
96+ outfile.cjs
97+ playground
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 && pnpm snapshot && cd playground && pnpm install --no-frozen-lockfile
102+ - name : Run test:unit script in vitest projects
103+ working-directory : ./playground
104+ run : pnpm --filter "{*vitest*}" test:unit
52105
53- # Skip ESLint/Prettier tests as we've reached the limit of job numbers
54- # TODO: Find a way to test them without adding new jobs
106+ # FIXME: it's failing now
107+ # - name: Run test:unit script in with-tests projects
108+ # working-directory: ./playground
109+ # run: pnpm --filter "{*with-tests*}" test:unit
55110
111+ test-e2e :
112+ needs : build
113+ strategy :
114+ matrix :
115+ e2e-framework : ['cypress', 'playwright']
56116 node-version : [22]
57- os : [ubuntu-latest]
58-
59- # Run a few tests on other systems and Node.js versions
60- include :
61- - node-version : 22
62- os : windows-latest
63- flag-for-ts : ' --typescript'
64- flag-for-jsx : ' --jsx'
65- flag-for-router : ' --router'
66- flag-for-pinia : ' --pinia'
67- flag-for-vitest : ' --vitest'
68- flag-for-e2e : ' --cypress'
69- flag-for-eslint : ' --eslint'
70-
71- - node-version : 22
72- os : macos-latest
73- flag-for-ts : ' --typescript'
74- flag-for-jsx : ' --jsx'
75- flag-for-router : ' --router'
76- flag-for-pinia : ' --pinia'
77- flag-for-vitest : ' --vitest'
78- flag-for-e2e : ' --cypress'
79- flag-for-eslint : ' --eslint'
80-
81- - node-version : 18
82- os : ubuntu-latest
83- flag-for-ts : ' --typescript'
84- flag-for-jsx : ' --jsx'
85- flag-for-router : ' --router'
86- flag-for-pinia : ' --pinia'
87- flag-for-vitest : ' --vitest'
88- flag-for-e2e : ' --cypress'
89- flag-for-eslint : ' --eslint'
90-
91- - node-version : 20
92- os : ubuntu-latest
93- flag-for-ts : ' --typescript'
94- flag-for-jsx : ' --jsx'
95- flag-for-router : ' --router'
96- flag-for-pinia : ' --pinia'
97- flag-for-vitest : ' --vitest'
98- flag-for-e2e : ' --cypress'
99- flag-for-eslint : ' --eslint'
117+ os : [ubuntu-latest, windows-latest, macos-latest]
100118 runs-on : ${{ matrix.os }}
101119 continue-on-error : ${{ matrix.os == 'windows-latest' }}
102120 env :
103- FEATURE_FLAGS : ${{ matrix.flag-for-ts }} ${{ matrix.flag-for-jsx }} ${{ matrix.flag-for-router }} ${{ matrix.flag-for-pinia }} ${{ matrix.flag-for-vitest }} ${{ matrix.flag-for-e2e }} ${{matrix.flag-for-eslint}}
104121 # Sometimes the Linux runner can't verify Cypress in 30s
105122 CYPRESS_VERIFY_TIMEOUT : 60000
106123 steps :
@@ -110,19 +127,20 @@ jobs:
110127 with :
111128 node-version : ${{ matrix.node-version }}
112129 cache : ' pnpm'
130+
113131 - uses : actions/cache/restore@v4
114132 id : cache-restore
115133 with :
116- path : outfile.cjs
134+ path : |
135+ outfile.cjs
136+ playground
117137 key : ${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }}
118138 - name : Build the package on cache miss
119139 if : steps.cache-restore.outputs.cache-hit != 'true'
120- run : pnpm install && pnpm build
121-
140+ run : pnpm install && pnpm build && pnpm snapshot && cd playground && pnpm install --no-frozen-lockfile
122141 # https://github.com/vitejs/vite/blob/main/.github/workflows/ci.yml#L62
123142 # Install playwright's binary under custom directory to cache
124143 - name : Set Playwright & Cypress path
125- if : runner.os != 'Windows'
126144 run : |
127145 echo "PLAYWRIGHT_BROWSERS_PATH=$HOME/.cache/playwright-bin" >> $GITHUB_ENV
128146 echo "CYPRESS_CACHE_FOLDER=$HOME/.cache/cypress-bin" >> $GITHUB_ENV
@@ -132,7 +150,7 @@ jobs:
132150 echo "PLAYWRIGHT_BROWSERS_PATH=$HOME\.cache\playwright-bin" >> $env:GITHUB_ENV
133151 echo "CYPRESS_CACHE_FOLDER=$HOME\.cache\cypress-bin" >> $env:GITHUB_ENV
134152
135- - if : ${{ contains(matrix.flag-for- e2e, '-- cypress') }}
153+ - if : ${{ contains(matrix.e2e-framework , 'cypress') }}
136154 name : Cache Cypress binaries
137155 id : cache-cypress
138156 uses : actions/cache@v4
@@ -141,7 +159,7 @@ jobs:
141159 key : ${{ runner.os }}-cypress-bin
142160 path : ${{ env.CYPRESS_CACHE_FOLDER }}
143161
144- - if : ${{ contains(matrix.flag-for- e2e, '-- playwright') }}
162+ - if : ${{ contains(matrix.e2e-framework , 'playwright') }}
145163 name : Cache Playwright's binary
146164 uses : actions/cache@v4
147165 with :
@@ -150,47 +168,26 @@ jobs:
150168 key : ${{ runner.os }}-playwright-bin-v1
151169 path : ${{ env.PLAYWRIGHT_BROWSERS_PATH }}
152170
153- - if : ${{ (contains(env.FEATURE_FLAGS, '--')) }}
154- name : Create the sample project with feature flags
155- working-directory : ../
156- run : node ./create-vue/outfile.cjs sample-project ${{ env.FEATURE_FLAGS }}
157-
158- - if : ${{ !(contains(env.FEATURE_FLAGS, '--')) }}
159- name : Create the sample project with default options
160- working-directory : ../
161- run : node ./create-vue/outfile.cjs sample-project --default
162-
163- - name : Install dependencies in the sample project
164- working-directory : ../sample-project
165- run : pnpm install
166-
167- - if : ${{ contains(matrix.flag-for-vitest, '--') }}
168- name : Run unit test script
169- working-directory : ../sample-project
170- run : pnpm test:unit
171-
172- - name : Run build script
173- working-directory : ../sample-project
174- run : pnpm build
175-
176171 - name : Download Cypress
177- if : ${{ contains(matrix.flag-for- e2e, '-- cypress') }}
178- working-directory : ../sample-project
172+ if : ${{ contains(matrix.e2e-framework , 'cypress') }}
173+ working-directory : ./playground
179174 run : |
180175 pnpm exec cypress cache list
181176 pnpm exec cypress install
182177
183- - if : ${{ contains(matrix.flag-for- e2e, '-- playwright') }}
178+ - if : ${{ contains(matrix.e2e-framework , 'playwright') }}
184179 name : Install Playwright dependencies
185- working-directory : ../sample-project
180+ working-directory : ./playground
186181 run : npx playwright install --with-deps
187182
188- - if : ${{ contains(matrix.flag-for-e2e, '--') }}
189- name : Run e2e test script
190- working-directory : ../sample-project
191- run : pnpm test:e2e
183+ # Run `test:e2e` in project folders contain `matrix.e2e-framework`
184+ - name : Run e2e test script
185+ working-directory : ./playground
186+ run : pnpm --filter "{*${{ matrix.e2e-framework }}*}" test:e2e
187+
188+ # FIXME: `--with-tests` folders
189+ # FIXME: Cypress component testing for projects without Vitest
190+
192191
193- - if : ${{ contains(matrix.flag-for-eslint, '--') }}
194- name : Run lint script
195- working-directory : ../sample-project
196- run : pnpm lint --no-fix --max-warnings=0
192+ # FIXME: test-lint
193+ # `pnpm lint --no-fix --max-warnings=0`
0 commit comments