-
Notifications
You must be signed in to change notification settings - Fork 446
205 lines (187 loc) · 7.08 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
name: 'ci'
on:
push:
branches:
- '**'
- '!renovate/**'
paths-ignore:
- README.md
- CONTRIBUTING.md
pull_request:
branches:
- '**'
jobs:
build:
runs-on: ubuntu-latest
name: Build the package
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v3
- uses: actions/setup-node@v4
with:
node-version: 22
cache: 'pnpm'
- run: pnpm install
env:
CYPRESS_INSTALL_BINARY: 0
CHROMEDRIVER_SKIP_DOWNLOAD: true
- run: pnpm build
- run: pnpm test:unit
- run: pnpm snapshot
# Use cache to share the output across different jobs
# No need to cache node_modules because they are all bundled
- uses: actions/cache/save@v4
id: cache
with:
path: |
outfile.cjs
playground
key: ${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }}
test-build:
needs: build
strategy:
matrix:
node-version: [22]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.os == 'windows-latest' }}
env:
CYPRESS_INSTALL_BINARY: 0
CHROMEDRIVER_SKIP_DOWNLOAD: true
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v3
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- uses: actions/cache/restore@v4
id: cache-restore
with:
path: |
outfile.cjs
playground
key: ${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }}
- name: Build the package on cache miss
run: pnpm install && pnpm build && pnpm snapshot
- name: Move playground to work around weird working-directory issue
run: rm playgroun/pnpm-lock.yaml && mv playground ../playground
- name: Install dependencies in playground
run: pnpm -C ../playground install --no-frozen-lockfile
- name: Run build script in playground
run: pnpm -C ../playground --filter "*" build
# test-vitest:
# needs: build
# strategy:
# matrix:
# node-version: [22]
# os: [ubuntu-latest, windows-latest, macos-latest]
# runs-on: ${{ matrix.os }}
# continue-on-error: ${{ matrix.os == 'windows-latest' }}
# env:
# CYPRESS_INSTALL_BINARY: 0
# CHROMEDRIVER_SKIP_DOWNLOAD: true
# steps:
# - uses: actions/checkout@v4
# - uses: pnpm/action-setup@v3
# - uses: actions/setup-node@v4
# with:
# node-version: ${{ matrix.node-version }}
# cache: 'pnpm'
# - uses: actions/cache/restore@v4
# id: cache-restore
# with:
# path: outfile.cjs
# key: ${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }}
# - name: Build the package on cache miss
# if: steps.cache-restore.outputs.cache-hit != 'true'
# run: pnpm install && pnpm build
# - name: Snapshot
# run: pnpm snapshot && echo "{}" > playground/package.json && mv playground ../playground
# - name: Install dependencies in playground
# working-directory: ../playground
# run: pnpm install --no-frozen-lockfile
# - name: Run test:unit script in vitest projects
# working-directory: ../playground
# run: pnpm --filter "{*vitest*}" test:unit
# # FIXME: it's failing now
# # - name: Run test:unit script in with-tests projects
# # working-directory: ../playground
# # run: pnpm --filter "{*with-tests*}" test:unit
# test-e2e:
# needs: build
# strategy:
# matrix:
# e2e-framework: ['cypress', 'playwright']
# node-version: [22]
# os: [ubuntu-latest, windows-latest, macos-latest]
# runs-on: ${{ matrix.os }}
# continue-on-error: ${{ matrix.os == 'windows-latest' }}
# env:
# # Sometimes the Linux runner can't verify Cypress in 30s
# CYPRESS_VERIFY_TIMEOUT: 60000
# steps:
# - uses: actions/checkout@v4
# - uses: pnpm/action-setup@v3
# - uses: actions/setup-node@v4
# with:
# node-version: ${{ matrix.node-version }}
# cache: 'pnpm'
# - uses: actions/cache/restore@v4
# id: cache-restore
# with:
# path: outfile.cjs
# key: ${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }}
# - name: Build the package on cache miss
# if: steps.cache-restore.outputs.cache-hit != 'true'
# run: pnpm install && pnpm build
# - name: Snapshot
# run: pnpm snapshot && echo "{}" > playground/package.json && mv playground ../playground
# - name: Install dependencies in playground
# working-directory: ../playground
# run: pnpm install --no-frozen-lockfile
# # https://github.com/vitejs/vite/blob/main/.github/workflows/ci.yml#L62
# # Install playwright's binary under custom directory to cache
# - name: Set Playwright & Cypress path
# run: |
# echo "PLAYWRIGHT_BROWSERS_PATH=$HOME/.cache/playwright-bin" >> $GITHUB_ENV
# echo "CYPRESS_CACHE_FOLDER=$HOME/.cache/cypress-bin" >> $GITHUB_ENV
# - name: Set Playwright & Cypress path (windows)
# if: runner.os == 'Windows'
# run: |
# echo "PLAYWRIGHT_BROWSERS_PATH=$HOME\.cache\playwright-bin" >> $env:GITHUB_ENV
# echo "CYPRESS_CACHE_FOLDER=$HOME\.cache\cypress-bin" >> $env:GITHUB_ENV
# - if: ${{ contains(matrix.e2e-framework, 'cypress') }}
# name: Cache Cypress binaries
# id: cache-cypress
# uses: actions/cache@v4
# with:
# # TODO: avoid snowballing by adding version
# key: ${{ runner.os }}-cypress-bin
# path: ${{ env.CYPRESS_CACHE_FOLDER }}
# - if: ${{ contains(matrix.e2e-framework, 'playwright') }}
# name: Cache Playwright's binary
# uses: actions/cache@v4
# with:
# # Playwright removes unused browsers automatically
# # So does not need to add playwright version to key
# key: ${{ runner.os }}-playwright-bin-v1
# path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }}
# - name: Download Cypress
# if: ${{ contains(matrix.e2e-framework, 'cypress') }}
# working-directory: ../playground
# run: |
# pnpm --filter "{cypress}" exec cypress cache list
# pnpm --filter "{cypress}" exec cypress install
# - if: ${{ contains(matrix.e2e-framework, 'playwright') }}
# name: Install Playwright dependencies
# working-directory: ../playground
# run: pnpm --filter "{playwright}" exec playwright install --with-deps
# # Run `test:e2e` in project folders contain `matrix.e2e-framework`
# - name: Run e2e test script
# working-directory: ../playground
# run: pnpm --filter "{*${{ matrix.e2e-framework }}*}" test:e2e
# # FIXME: `--with-tests` folders
# # FIXME: Cypress component testing for projects without Vitest
# # FIXME: test-lint
# # `pnpm lint --no-fix --max-warnings=0`