9
9
- ' .vscode/**'
10
10
- ' **/*.md'
11
11
12
+ # Automatically cancel in-progress actions on the same branch
13
+ concurrency :
14
+ group : ${{ github.workflow }}-${{ github.event_name == 'pull_request_target' && github.head_ref || github.ref }}
15
+ cancel-in-progress : true
12
16
13
17
defaults :
14
18
run :
@@ -20,10 +24,246 @@ env:
20
24
FORCE_COLOR : true
21
25
ASTRO_TELEMETRY_DISABLED : true
22
26
27
+
23
28
jobs :
24
- debug :
25
- name : Debug
29
+ lint :
30
+ name : Lint
31
+ runs-on : ubuntu-latest
32
+ steps :
33
+ - name : Check out repository
34
+ uses : actions/checkout@v3
35
+
36
+ - name : Setup PNPM
37
+
38
+
39
+ - name : Setup Node
40
+ uses : actions/setup-node@v3
41
+ with :
42
+ node-version : 16
43
+ cache : ' pnpm'
44
+
45
+ - name : Install dependencies
46
+ run : pnpm install
47
+
48
+ - name : Status
49
+ run : git status
50
+
51
+ # Lint autofix cannot run on forks, so just skip those! See https://github.com/wearerequired/lint-action/issues/13
52
+ - name : Lint (External)
53
+ if : ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.owner.login != github.repository_owner }}
54
+ run : pnpm run lint
55
+
56
+ # Otherwise, run lint autofixer
57
+ - name : Lint
58
+ if : ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.owner.login == github.repository_owner }}
59
+ uses :
wearerequired/[email protected]
60
+ env :
61
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
62
+ with :
63
+ eslint : true
64
+ prettier : false
65
+ auto_fix : true
66
+ git_name : github-actions[bot]
67
+ git_email : github-actions[bot]@users.noreply.github.com
68
+ commit_message : ' chore(lint): ${linter} fix'
69
+ github_token : ${{ secrets.GITHUB_TOKEN }}
70
+ neutral_check_on_warning : true
71
+
72
+ # Checks that the formatter runs successfully on all files
73
+ # In the future, we may have this fail PRs on unformatted code
74
+ - name : Format Check
75
+ run : pnpm run format --list
76
+
77
+ # Build primes out build caches for Turbo
78
+ build :
79
+ name : ' Build: ${{ matrix.os }}'
80
+ runs-on : ${{ matrix.os }}
81
+ strategy :
82
+ matrix :
83
+ OS : [ubuntu-latest]
84
+ NODE_VERSION : [14]
85
+ fail-fast : true
86
+ steps :
87
+ - name : Checkout
88
+ uses : actions/checkout@v3
89
+
90
+ - name : Setup PNPM
91
+
92
+
93
+ - name : Setup node@${{ matrix.NODE_VERSION }}
94
+ uses : actions/setup-node@v3
95
+ with :
96
+ node-version : ${{ matrix.NODE_VERSION }}
97
+ cache : ' pnpm'
98
+
99
+ - name : Install dependencies
100
+ run : pnpm install
101
+
102
+ - name : Build Packages
103
+ run : pnpm run build
104
+
105
+ test :
106
+ name : ' Test: ${{ matrix.os }} (node@${{ matrix.NODE_VERSION }})'
107
+ runs-on : ${{ matrix.os }}
108
+ needs : build
109
+ strategy :
110
+ matrix :
111
+ OS : [ubuntu-latest, windows-latest]
112
+ # TODO: Enable node@18!
113
+ NODE_VERSION : [14, 16]
114
+ include :
115
+ - os : macos-latest
116
+ NODE_VERSION : 14
117
+ fail-fast : false
118
+ env :
119
+ NODE_VERSION : ${{ matrix.NODE_VERSION }}
120
+ steps :
121
+ - name : Checkout
122
+ uses : actions/checkout@v3
123
+
124
+ - name : Setup PNPM
125
+
126
+
127
+ - name : Setup node@${{ matrix.NODE_VERSION }}
128
+ uses : actions/setup-node@v3
129
+ with :
130
+ node-version : ${{ matrix.NODE_VERSION }}
131
+ cache : ' pnpm'
132
+
133
+ - name : Use Deno
134
+ uses : denoland/setup-deno@v1
135
+ with :
136
+ deno-version : v1.19.3
137
+
138
+ - name : Install dependencies
139
+ run : pnpm install
140
+
141
+ - name : Build Packages
142
+ run : pnpm run build
143
+
144
+ - name : Test
145
+ run : pnpm run test
146
+
147
+ e2e :
148
+ name : ' Test (E2E): ${{ matrix.os }} (node@${{ matrix.NODE_VERSION }})'
149
+ runs-on : ${{ matrix.os }}
150
+ timeout-minutes : 20
151
+ needs : build
152
+ strategy :
153
+ matrix :
154
+ OS : [ubuntu-latest, windows-latest]
155
+ NODE_VERSION : [14]
156
+ fail-fast : false
157
+ env :
158
+ NODE_VERSION : ${{ matrix.NODE_VERSION }}
159
+ steps :
160
+ - name : Checkout
161
+ uses : actions/checkout@v3
162
+
163
+ - name : Setup PNPM
164
+
165
+
166
+ - name : Setup node@${{ matrix.NODE_VERSION }}
167
+ uses : actions/setup-node@v3
168
+ with :
169
+ node-version : ${{ matrix.NODE_VERSION }}
170
+ cache : ' pnpm'
171
+
172
+ - name : Install dependencies
173
+ run : pnpm install
174
+
175
+ - name : Build Packages
176
+ run : pnpm run build
177
+
178
+ - name : Test
179
+ run : pnpm run test:e2e
180
+
181
+ smoke :
182
+ name : ' Test (Smoke): ${{ matrix.os }} (node@${{ matrix.NODE_VERSION }})'
183
+ runs-on : ${{ matrix.os }}
184
+ needs : build
185
+ strategy :
186
+ matrix :
187
+ OS : [ubuntu-latest, windows-latest]
188
+ NODE_VERSION : [14]
189
+ env :
190
+ NODE_VERSION : ${{ matrix.NODE_VERSION }}
191
+ steps :
192
+ - name : Checkout
193
+ uses : actions/checkout@v3
194
+
195
+ - name : Setup PNPM
196
+
197
+
198
+ - name : Setup node@${{ matrix.NODE_VERSION }}
199
+ uses : actions/setup-node@v3
200
+ with :
201
+ node-version : ${{ matrix.NODE_VERSION }}
202
+ cache : ' pnpm'
203
+
204
+ - name : Checkout docs
205
+ uses : actions/checkout@v3
206
+ with :
207
+ repository : withastro/docs
208
+ path : smoke/docs
209
+
210
+ - name : Install dependencies
211
+ run : pnpm install --no-frozen-lockfile
212
+
213
+ - name : Build Packages
214
+ run : pnpm run build
215
+
216
+ - name : Test
217
+ run : pnpm run test:smoke
218
+
219
+ changelog :
220
+ name : Changelog PR or Release
221
+ if : ${{ (github.ref_name == 'main' || github.head_ref == 'next') && github.repository_owner == 'withastro' }}
26
222
runs-on : ubuntu-latest
223
+ needs : build
27
224
steps :
28
- - name : Debug
29
- run : env
225
+ - uses : actions/checkout@v3
226
+
227
+ - name : Setup PNPM
228
+
229
+
230
+ - name : Setup Node
231
+ uses : actions/setup-node@v3
232
+ with :
233
+ node-version : 16
234
+ cache : ' pnpm'
235
+
236
+ - name : Install dependencies
237
+ run : pnpm install
238
+
239
+ - name : Build Packages
240
+ run : pnpm run build
241
+
242
+ - name : Create Release Pull Request or Publish
243
+ id : changesets
244
+ uses : changesets/action@v1
245
+ with :
246
+ # Note: pnpm install after versioning is necessary to refresh lockfile
247
+ version : pnpm run version
248
+ publish : pnpm exec changeset publish
249
+ commit : ' [ci] release'
250
+ title : ' [ci] release'
251
+ env :
252
+ # Needs access to push to main
253
+ GITHUB_TOKEN : ${{ secrets.FREDKBOT_GITHUB_TOKEN }}
254
+ # Needs access to publish to npm
255
+ NPM_TOKEN : ${{ secrets.NPM_TOKEN }}
256
+
257
+ - name : Generate Notification
258
+ id : notification
259
+ if : steps.changesets.outputs.published == 'true'
260
+ run : message=$(node scripts/notify/index.js '${{ steps.changesets.outputs.publishedPackages }}') && echo ::set-output name=message::${message//$'\n'/'%0A'}
261
+
262
+ - name : Discord Notification
263
+ if : steps.changesets.outputs.published == 'true'
264
+ id : discord-notification
265
+ env :
266
+ DISCORD_WEBHOOK : ${{ secrets.DISCORD_WEBHOOK }}
267
+
268
+ with :
269
+ args : ${{ steps.notification.outputs.message }}
0 commit comments