@@ -16,113 +16,112 @@ jobs:
16
16
name : Build the package
17
17
steps :
18
18
- uses : actions/checkout@v4
19
- - uses : pnpm/action-setup@v3
19
+ with :
20
+ submodules : true
21
+ - uses : pnpm/action-setup@v4
20
22
- uses : actions/setup-node@v4
21
23
with :
22
24
node-version : 22
23
25
cache : ' pnpm'
24
26
- run : pnpm install
25
27
env :
26
28
CYPRESS_INSTALL_BINARY : 0
29
+ CHROMEDRIVER_SKIP_DOWNLOAD : true
27
30
- run : pnpm build
28
31
- run : pnpm test:unit
29
32
30
- # Use cache to share the output across different jobs
31
- # No need to cache node_modules because they are all bundled
32
- - uses : actions/cache/save@v4
33
- id : cache
34
- with :
35
- path : outfile.cjs
36
- key : ${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }}
33
+ - run : pnpm snapshot
37
34
38
- test :
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@v4
38
+ with :
39
+ name : build-output
40
+ path : |
41
+ outfile.cjs
42
+ playground
43
+ retention-days : 3
44
+
45
+ verify-scripts :
46
+ needs : build
47
+ strategy :
48
+ matrix :
49
+ node-version : [18, 20, 22]
50
+ 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
+ - pnpm --filter "*eslint*" lint --no-fix --max-warnings=0
56
+ - pnpm --filter "*prettier*" format --write --check
57
+ # FIXME: it's failing now
58
+ # - pnpm --filter "*with-tests*" test:unit
59
+ runs-on : ${{ matrix.os }}
60
+ continue-on-error : ${{ matrix.os == 'windows-latest' }}
61
+ env :
62
+ CYPRESS_INSTALL_BINARY : 0
63
+ CHROMEDRIVER_SKIP_DOWNLOAD : true
64
+ steps :
65
+ - uses : actions/checkout@v4
66
+ with :
67
+ submodules : true
68
+ - uses : pnpm/action-setup@v4
69
+ - uses : actions/setup-node@v4
70
+ with :
71
+ node-version : ${{ matrix.node-version }}
72
+ cache : ' pnpm'
73
+
74
+ # use artifacts to share the playground across different jobs
75
+ - uses : actions/download-artifact@v4
76
+ with :
77
+ name : build-output
78
+
79
+ - name : Install dependencies to avoid tsconfig warnings
80
+ run : pnpm install
81
+ - name : Install dependencies in playground
82
+ working-directory : ./playground
83
+ run : pnpm install --no-frozen-lockfile
84
+
85
+ - name : Run build script in playground
86
+ working-directory : ./playground
87
+ run : ${{ matrix.verification-script }}
88
+
89
+ verify-e2e :
39
90
needs : build
40
91
strategy :
41
92
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']
47
-
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']
52
-
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
55
-
93
+ e2e-framework : ['cypress', 'playwright']
56
94
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'
95
+ os : [ubuntu-latest, windows-latest, macos-latest]
100
96
runs-on : ${{ matrix.os }}
101
97
continue-on-error : ${{ matrix.os == 'windows-latest' }}
102
98
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}}
104
99
# Sometimes the Linux runner can't verify Cypress in 30s
105
100
CYPRESS_VERIFY_TIMEOUT : 60000
106
101
steps :
107
102
- uses : actions/checkout@v4
108
- - uses : pnpm/action-setup@v3
103
+ with :
104
+ submodules : true
105
+ - uses : pnpm/action-setup@v4
109
106
- uses : actions/setup-node@v4
110
107
with :
111
108
node-version : ${{ matrix.node-version }}
112
109
cache : ' pnpm'
113
- - uses : actions/cache/restore@v4
114
- id : cache-restore
110
+
111
+ # use artifacts to share the playground across different jobs
112
+ - uses : actions/download-artifact@v4
115
113
with :
116
- path : outfile.cjs
117
- key : ${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }}
118
- - name : Build the package on cache miss
119
- if : steps.cache-restore.outputs.cache-hit != 'true'
120
- run : pnpm install && pnpm build
114
+ name : build-output
115
+
116
+ - name : Install dependencies to avoid tsconfig warnings
117
+ run : pnpm install
118
+ - name : Install dependencies in playground
119
+ working-directory : ./playground
120
+ run : pnpm install --no-frozen-lockfile
121
121
122
122
# https://github.com/vitejs/vite/blob/main/.github/workflows/ci.yml#L62
123
123
# Install playwright's binary under custom directory to cache
124
124
- name : Set Playwright & Cypress path
125
- if : runner.os != 'Windows'
126
125
run : |
127
126
echo "PLAYWRIGHT_BROWSERS_PATH=$HOME/.cache/playwright-bin" >> $GITHUB_ENV
128
127
echo "CYPRESS_CACHE_FOLDER=$HOME/.cache/cypress-bin" >> $GITHUB_ENV
@@ -132,7 +131,7 @@ jobs:
132
131
echo "PLAYWRIGHT_BROWSERS_PATH=$HOME\.cache\playwright-bin" >> $env:GITHUB_ENV
133
132
echo "CYPRESS_CACHE_FOLDER=$HOME\.cache\cypress-bin" >> $env:GITHUB_ENV
134
133
135
- - if : ${{ contains(matrix.flag-for- e2e, '-- cypress') }}
134
+ - if : ${{ contains(matrix.e2e-framework , 'cypress') }}
136
135
name : Cache Cypress binaries
137
136
id : cache-cypress
138
137
uses : actions/cache@v4
@@ -141,7 +140,7 @@ jobs:
141
140
key : ${{ runner.os }}-cypress-bin
142
141
path : ${{ env.CYPRESS_CACHE_FOLDER }}
143
142
144
- - if : ${{ contains(matrix.flag-for- e2e, '-- playwright') }}
143
+ - if : ${{ contains(matrix.e2e-framework , 'playwright') }}
145
144
name : Cache Playwright's binary
146
145
uses : actions/cache@v4
147
146
with :
@@ -150,47 +149,28 @@ jobs:
150
149
key : ${{ runner.os }}-playwright-bin-v1
151
150
path : ${{ env.PLAYWRIGHT_BROWSERS_PATH }}
152
151
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
-
176
152
- name : Download Cypress
177
- if : ${{ contains(matrix.flag-for- e2e, '-- cypress') }}
178
- working-directory : ../sample-project
153
+ if : ${{ contains(matrix.e2e-framework , 'cypress') }}
154
+ working-directory : ./playground/cypress
179
155
run : |
180
156
pnpm exec cypress cache list
181
157
pnpm exec cypress install
182
158
183
- - if : ${{ contains(matrix.flag-for- e2e, '-- playwright') }}
159
+ - if : ${{ contains(matrix.e2e-framework , 'playwright') }}
184
160
name : Install Playwright dependencies
185
- working-directory : ../sample-project
186
- run : npx playwright install --with-deps
187
-
188
- - if : ${{ contains(matrix.flag-for-e2e, '--') }}
189
- name : Run e2e test script
190
- working-directory : ../sample-project
191
- run : pnpm test:e2e
192
-
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
161
+ working-directory : ./playground/playwright
162
+ run : pnpm exec playwright install --with-deps
163
+
164
+ - name : Run build script
165
+ working-directory : ./playground
166
+ run : pnpm --filter "*${{ matrix.e2e-framework }}*" build
167
+
168
+ - name : Run e2e test script
169
+ working-directory : ./playground
170
+ run : pnpm --filter "*${{ matrix.e2e-framework }}*" --workspace-concurrency 1 test:e2e
171
+
172
+ - name : Cypress component testing for projects without Vitest
173
+ if : ${{ contains(matrix.e2e-framework, 'cypress') }}
174
+ run : pnpm --filter '*cypress*' --filter '!*vitest*' --workspace-concurrency 1 test:unit
175
+
176
+ # FIXME: `--with-tests` folders. It's failing now.
0 commit comments