-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
367 lines (314 loc) · 12.3 KB
/
ci.yml
File metadata and controls
367 lines (314 loc) · 12.3 KB
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
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
name: CI
on:
workflow_dispatch:
push:
branches:
- main
merge_group:
pull_request:
paths-ignore:
- ".vscode/**"
- "**/*.md"
- ".github/ISSUE_TEMPLATE/**"
# Automatically cancel older in-progress jobs on the same branch
concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request_target' && github.head_ref || github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
FORCE_COLOR: true
ASTRO_TELEMETRY_DISABLED: true
# 7 GiB by default on GitHub, setting to 6 GiB
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
NODE_OPTIONS: --max-old-space-size=6144
jobs:
changes:
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
language-tools: ${{ steps.filter.outputs.language-tools }}
astro-types: ${{ steps.filter.outputs.astro-types }}
ci: ${{ steps.filter.outputs.ci }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: filter
with:
# When updating filters here, make sure to also add or remove them from the outputs block above.
filters: |
language-tools:
- 'packages/language-tools/**'
astro-types:
- 'packages/astro/types/**'
- 'packages/astro/astro-jsx.d.ts'
ci:
- '.github/workflows/ci.yml'
# Build primes out Turbo build cache and pnpm cache
build:
name: "Build: ${{ matrix.os }}"
runs-on: ${{ matrix.os }}
timeout-minutes: 5
strategy:
matrix:
# windows-latest is still windows-2022 for some reason, even though the windows-2025 image is GA
OS: [ubuntu-latest, windows-2025]
NODE_VERSION: [22]
fail-fast: true
steps:
# Disable crlf so all OS can share the same Turbo cache
# https://github.com/actions/checkout/issues/135
- name: Disable git crlf
run: git config --global core.autocrlf false
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup PNPM
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
- name: Setup node@${{ matrix.NODE_VERSION }}
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
with:
node-version: ${{ matrix.NODE_VERSION }}
cache: "pnpm"
- name: Install dependencies
run: pnpm install
# Only build in ubuntu as windows can share the build cache.
# Also only build in core repo as forks don't have access to the Turbo cache.
- name: Build Packages
if: ${{ matrix.os == 'ubuntu-latest' && github.repository_owner == 'withastro' }}
run: pnpm run build
biome-lint:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Setup Biome
uses: biomejs/setup-biome@29711cbb52afee00eb13aeb30636592f9edc0088 # v2.7.0
- name: Run Biome
run: biome ci --formatter-enabled=false --enforce-assist=false --reporter=default --reporter=github
lint:
name: Lint
runs-on: ubuntu-latest
timeout-minutes: 5
needs:
- biome-lint
steps:
- name: Disable git crlf
run: git config --global core.autocrlf false
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup PNPM
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
- name: Setup Node
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
with:
node-version: 24.13.1
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Build Packages
# The cache doesn't contain prebuild files and causes knip to fail
run: pnpm run build --force
- name: Lint source code
run: pnpm run lint:ci
- name: Lint publish code
run: pnpm run publint
test:
name: 'Test (${{ matrix.TEST_SUITE.name }}): ${{ matrix.os }} (node@${{ matrix.NODE_VERSION }})'
runs-on: ${{ matrix.os }}
timeout-minutes: 30
needs: build
strategy:
matrix:
OS: [ubuntu-latest, macos-14, windows-2025]
NODE_VERSION: [22, 24]
TEST_SUITE:
- { name: astro, script: 'pnpm run test:astro' }
- { name: integrations, script: 'pnpm run test:integrations' }
# We only test Node 22 on macOS and Windows to reduce CI usage.
# This exclude config tells GitHub to skip the items in the matrix that run on macOS or
# Windows and use one of the older Node versions.
exclude:
- os: macos-14
NODE_VERSION: 22
- os: windows-2025
NODE_VERSION: 22
fail-fast: false
env:
NODE_VERSION: ${{ matrix.NODE_VERSION }}
steps:
- name: Disable git crlf
run: git config --global core.autocrlf false
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup PNPM
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
- name: Setup node@${{ matrix.NODE_VERSION }}
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
with:
node-version: ${{ matrix.NODE_VERSION }}
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Build Packages
run: pnpm run build
- name: Test ${{ matrix.TEST_SUITE.name }}
run: ${{ matrix.TEST_SUITE.script }}
env:
# By default, Turborepo groups the logs in CI environments to prevent
# the logs from being interleaved. We don't have log interleaving
# issues here because we already passed the `--concurrency=auto` flag
# to `turbo`.
#
# We want to force Turborepo to print the logs ASAP since it will help us
# debug tests that time out, where we can know which step is stuck.
#
# https://github.com/vercel/turborepo/blob/v2.7.6/docs/site/content/docs/reference/run.mdx?plain=1#L361-L378
# https://github.com/vercel/turborepo/blob/v2.7.6/docs/site/content/docs/reference/options-overview.mdx?plain=1#L63
TURBO_LOG_ORDER: stream
test-language-tools:
runs-on: ${{ matrix.os }}
timeout-minutes: 30
needs:
- changes
- build
if: needs.changes.outputs.language-tools == 'true' || needs.changes.outputs.astro-types == 'true' || needs.changes.outputs.ci == 'true'
strategy:
matrix:
os: [ubuntu-latest]
# VS Code 1.90 (minimum supported version) ships with Node 20.9.0
node_version: [20.9.0, 22]
include:
- os: windows-latest
node_version: 20.9.0
- os: macos-latest
node_version: 20.9.0
fail-fast: false
name: 'Test (language-tools): node-${{ matrix.node_version }}, ${{ matrix.os }}'
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup PNPM
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
- name: Setup node@${{ matrix.node_version }}
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
with:
node-version: ${{ matrix.node_version }}
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Build the packages
run: pnpm build
- name: Test (Linux)
if: runner.os == 'Linux'
# On Linux, VS Code tests require a GUI environment, so we need to run tests using Xvfb
run: |
pnpm run test:language-tools:no-vs
cd packages/language-tools/vscode
xvfb-run -a pnpm test
# TODO: Figure out why the vscode tests are fine, but the ts-plugin ones are super flaky
# cd ../ts-plugin
# xvfb-run -a pnpm test
- name: Test
if: runner.os != 'Linux'
run: pnpm test:language-tools
e2e:
name: "Test (E2E): ${{ matrix.os }} (node@${{ matrix.NODE_VERSION }})"
runs-on: ${{ matrix.os }}
timeout-minutes: 30
needs: build
strategy:
matrix:
OS: [ubuntu-latest, windows-2025]
NODE_VERSION: [22]
fail-fast: false
env:
NODE_VERSION: ${{ matrix.NODE_VERSION }}
steps:
- name: Disable git crlf
run: git config --global core.autocrlf false
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup PNPM
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
- name: Setup node@${{ matrix.NODE_VERSION }}
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
with:
node-version: ${{ matrix.NODE_VERSION }}
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Build Packages
run: pnpm run build
- name: Test
run: pnpm run test:e2e
smoke:
name: "Test (Smoke): ${{ matrix.os }} (node@${{ matrix.NODE_VERSION }})"
runs-on: ${{ matrix.os }}
timeout-minutes: 30
needs: build
strategy:
matrix:
OS: [ubuntu-latest, windows-2025]
NODE_VERSION: [22]
env:
NODE_VERSION: ${{ matrix.NODE_VERSION }}
steps:
- name: Disable git crlf
run: git config --global core.autocrlf false
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup PNPM
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
- name: Setup node@${{ matrix.NODE_VERSION }}
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
with:
node-version: ${{ matrix.NODE_VERSION }}
cache: "pnpm"
- name: Checkout docs
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
repository: withastro/docs
path: smoke/docs
# For a commit event on the `next` branch (`ref_name`), use the `v6` branch.
# For a pull_request event merging into the `next` branch (`base_ref`), use the `v6` branch.
# NOTE: For a pull_request event, the `ref_name` is something like `<pr-number>/merge` than the branch name.
# NOTE: Perhaps docs repo should use a consistent `next` branch in the future.
ref: ${{ (github.ref_name == 'next' || github.base_ref == 'next') && 'v6' || 'main' }}
- name: Install dependencies
run: pnpm install --no-frozen-lockfile
# Reset lockfile changes so that Turbo can reuse the old build cache
- name: Reset lockfile changes
run: git reset --hard
- name: Build Packages
run: pnpm run build
- name: Remove docs translations except for English and Korean
run: find smoke/docs/src/content/docs ! -name 'en' ! -name 'ko' -type d -mindepth 1 -maxdepth 1 -exec rm -rf {} +
- name: Check if docs changed
id: changes
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
with:
filters: |
docs:
- 'packages/integrations/*/README.md'
- "packages/astro/src/types/public/**"
- 'packages/astro/src/core/errors/errors-data.ts'
- name: Build autogenerated docs pages from current astro branch
if: ${{ steps.changes.outputs.docs == 'true' }}
run: cd smoke/docs && pnpm docgen && pnpm docgen:errors
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SOURCE_REPO: ${{ github.event.pull_request.head.repo.full_name || github.event.repository.full_name }}
SOURCE_BRANCH: ${{ github.head_ref || github.ref_name }}
- name: Test
run: pnpm run test:smoke
env:
SKIP_OG: true
PUBLIC_TWO_LANG: true