-
Notifications
You must be signed in to change notification settings - Fork 7
340 lines (314 loc) · 11.3 KB
/
ci.yaml
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
name: CI
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
permissions:
checks: write
contents: read
id-token: write
pull-requests: write
jobs:
ai-bot-test:
name: AI bot Tests
runs-on: ubuntu-latest
concurrency:
group: ai-bot-test-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/init
- name: AI Bot test suite
run: pnpm test
working-directory: packages/ai-bot
boxel-motion-test:
name: Boxel Motion Tests
runs-on: ubuntu-latest
concurrency:
group: boxel-motion-test-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/init
- name: Build boxel-motion
run: pnpm build
working-directory: packages/boxel-motion/addon
- name: Run test suite
run: pnpm test
working-directory: packages/boxel-motion/test-app
boxel-ui-test:
name: Boxel UI Tests
runs-on: ubuntu-latest
concurrency:
group: boxel-ui-test-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/init
- name: Build boxel-icons
run: pnpm build
working-directory: packages/boxel-icons
- name: Build boxel-ui
run: pnpm build
working-directory: packages/boxel-ui/addon
- name: Run test suite
run: pnpm test
working-directory: packages/boxel-ui/test-app
boxel-ui-raw-icon-changes-only:
name: Boxel UI ensure raw icon changes only
runs-on: ubuntu-latest
concurrency:
group: boxel-ui-raw-icon-changes-only-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/init
- name: Rebuild boxel-ui icons
run: pnpm rebuild:icons
working-directory: packages/boxel-ui/addon
- name: Fail if generated icons have been changed without underlying raw icon changing
run: git diff --exit-code
boxel-icons-raw-icon-changes-only:
name: Boxel Icons ensure raw icon changes only
runs-on: ubuntu-latest
concurrency:
group: boxel-icons-raw-icon-changes-only-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/init
- name: Rebuild boxel-icons icons
run: pnpm rebuild:all
working-directory: packages/boxel-icons
- name: Fail if generated icons have been changed without underlying raw icon changing
run: git diff --exit-code
matrix-client-test:
name: Matrix Client Tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
shardIndex: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
shardTotal: [12]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/init
- name: Install Playwright Browsers
run: pnpm exec playwright install --with-deps
working-directory: packages/matrix
- name: Build boxel-icons
run: pnpm build
working-directory: packages/boxel-icons
- name: Serve boxel-icons
run: pnpm serve &
working-directory: packages/boxel-icons
- name: Build boxel-ui
run: pnpm build
working-directory: packages/boxel-ui/addon
- name: Build boxel-motion
run: pnpm build
working-directory: packages/boxel-motion/addon
- name: Start host to serve assets for fastboot
run: pnpm start &
env:
NODE_OPTIONS: --max_old_space_size=4096
working-directory: packages/host
- name: Wait for ember-cli to be ready
run: pnpm npx wait-for-localhost 4200
working-directory: packages/host
- name: Start realm servers
run: MATRIX_REGISTRATION_SHARED_SECRET='xxxx' pnpm start:services-for-matrix-tests &> /tmp/server.log &
working-directory: packages/realm-server
- name: Run Playwright tests
run: pnpm test:group ${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
working-directory: packages/matrix
- name: Upload realm server log
uses: actions/upload-artifact@v4
if: always()
with:
name: realm-server-log-${{ matrix.shardIndex }}
path: /tmp/server.log
retention-days: 30
- name: Upload blob report to GitHub Actions Artifacts
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: blob-report-${{ matrix.shardIndex }}
path: packages/matrix/blob-report
retention-days: 1
- name: Upload Playwright traces
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: playwright-traces-${{ matrix.shardIndex }}
path: packages/matrix/test-results/**/trace.zip
retention-days: 30
if-no-files-found: ignore
matrix-client-merge-reports-and-publish:
name: Merge Matrix reports and publish
if: always()
needs: matrix-client-test
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
checks: write
statuses: write
outputs:
timestamp: ${{ steps.timestampid.outputs.timestamp }}
steps:
- name: Create a timestamp as a directory to store reports in
id: timestampid
run: echo "timestamp=$(date --utc +%Y%m%d_%H%M%SZ)" >> "$GITHUB_OUTPUT"
- uses: actions/checkout@v4
- uses: ./.github/actions/init
- name: Download blob reports from GitHub Actions Artifacts
uses: actions/download-artifact@v4
with:
path: all-blob-reports
pattern: blob-report-*
merge-multiple: true
- name: Merge blobs into one single report
run: pnpm exec playwright merge-reports --reporter html ./all-blob-reports
- name: Upload HTML report
uses: actions/upload-artifact@v4
with:
name: html-report--attempt-${{ github.run_attempt }}
path: playwright-report
retention-days: 14
- name: Set up env
env:
INPUT_ENVIRONMENT: ${{ inputs.environment }}
run: |
echo "AWS_REGION=us-east-1" >> $GITHUB_ENV
echo "AWS_ROLE_ARN=arn:aws:iam::680542703984:role/boxel-matrix-playwright-reports" >> $GITHUB_ENV
echo "AWS_S3_BUCKET=cardstack-boxel-matrix-playwright-reports-staging" >> $GITHUB_ENV
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ env.AWS_ROLE_ARN }}
aws-region: us-east-1
- name: Publish consolidated report to S3
run: aws s3 sync ./playwright-report s3://cardstack-boxel-matrix-playwright-reports-staging/${{ github.head_ref || github.ref_name }}/${{ steps.timestampid.outputs.timestamp }}
- name: Store Playwright report URL
shell: bash
run: echo "PLAYWRIGHT_REPORT_URL=https://boxel-matrix-playwright-reports.stack.cards/${{ github.head_ref || github.ref_name }}/${{ steps.timestampid.outputs.timestamp }}/index.html" >> $GITHUB_ENV
- name: Add status with link to Playwright report
shell: bash
env:
GITHUB_TOKEN: ${{ github.token }}
REPOSITORY: ${{ github.repository }}
HEAD_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
run: |
curl \
-X POST \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/$REPOSITORY/statuses/$HEAD_SHA \
-d '{"context":"Matrix Playwright tests report","description":"","target_url":"'"$PLAYWRIGHT_REPORT_URL"'","state":"success"}'
realm-server-test:
name: Realm Server Tests
runs-on: ubuntu-latest
concurrency:
group: realm-server-test-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/init
- name: Build boxel-icons
run: pnpm build
working-directory: packages/boxel-icons
- name: Serve boxel-icons
run: pnpm serve &
working-directory: packages/boxel-icons
- name: Build boxel-ui
run: pnpm build
working-directory: packages/boxel-ui/addon
- name: Start host to serve assets for fastboot
run: pnpm start &
env:
NODE_OPTIONS: --max_old_space_size=4096
working-directory: packages/host
- name: Wait for ember-cli to be ready
run: pnpm npx wait-for-localhost 4200
working-directory: packages/realm-server
- name: Start realm servers
run: pnpm start:all &> /tmp/server.log &
working-directory: packages/realm-server
- name: create realm users
run: pnpm register-realm-users
working-directory: packages/matrix
- name: realm server test suite
run: pnpm test:wait-for-servers
working-directory: packages/realm-server
- name: Upload realm server log
uses: actions/upload-artifact@v4
if: always()
with:
name: realm-server-log
path: /tmp/server.log
retention-days: 30
vscode-boxel-tools-package:
name: Boxel Tools VS Code Extension package
runs-on: ubuntu-latest
concurrency:
group: vscode-boxel-tools-test-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/init
- name: Build boxel-icons
run: pnpm build
working-directory: packages/boxel-icons
- name: Build boxel-ui
run: pnpm build
working-directory: packages/boxel-ui/addon
- name: Prepublish
run: pnpm vscode:prepublish
working-directory: packages/vscode-boxel-tools
- name: Package
run: pnpm vscode:package
working-directory: packages/vscode-boxel-tools
- name: Upload
uses: actions/upload-artifact@v4
with:
name: vscode-boxel-tools
path: packages/vscode-boxel-tools/boxel-tools*vsix
change-check:
name: Check which packages changed
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
outputs:
boxel: ${{ steps.filter.outputs.boxel }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
boxel:
- '.github/workflows/build-host.yml'
- '.github/workflows/deploy-host.yml'
- '.github/workflows/manual-deploy.yml'
- '.github/workflows/ci.yaml'
- 'packages/ai-bot/**'
- 'packages/base/**'
- 'packages/boxel-ui/**'
- 'packages/boxel-icons/**'
- 'packages/host/**'
- 'packages/realm-server/**'
- 'packages/runtime-common/**'
- 'pnpm-lock.yaml'
deploy:
name: Deploy boxel to staging
if: ${{ needs.change-check.outputs.boxel == 'true' }}
needs:
- change-check
- ai-bot-test
- boxel-ui-test
- realm-server-test
uses: ./.github/workflows/manual-deploy.yml
secrets: inherit
with:
environment: "staging"