forked from cardstack/boxel
-
Notifications
You must be signed in to change notification settings - Fork 1
270 lines (246 loc) · 8.67 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
name: CI
on:
push:
branches: [main]
pull_request:
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-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
matrix-client-test:
name: Matrix Client Tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
shardIndex: [1, 2, 3, 4, 5, 6]
shardTotal: [6]
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-ui
run: pnpm build
working-directory: packages/boxel-ui/addon
- name: Build boxel-motion
run: pnpm build
working-directory: packages/boxel-motion/addon
- name: Build host dist/ for fastboot
run: pnpm build
env:
NODE_OPTIONS: --max_old_space_size=4096
working-directory: packages/host
- name: Start realm servers
run: pnpm start:without-matrix &
working-directory: packages/realm-server
- name: Run Playwright tests
run: pnpm test:group ${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
working-directory: packages/matrix
- 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
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-ui
run: pnpm build
working-directory: packages/boxel-ui/addon
- name: Build host dist/ for fastboot
run: pnpm build
env:
NODE_OPTIONS: --max_old_space_size=4096
working-directory: packages/host
- name: Start realm servers
run: pnpm start:all &
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: realm server DOM tests
run: pnpm test:dom
working-directory: packages/realm-server
change-check:
name: Check which packages changed
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
outputs:
boxel: ${{ steps.filter.outputs.boxel }}
ai-bot: ${{ steps.filter.outputs.ai-bot }}
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/base/**'
- 'packages/boxel-ui/**'
- 'packages/host/**'
- 'packages/realm-server/**'
- 'packages/runtime-common/**'
- 'pnpm-lock.yaml'
ai-bot:
- '.github/workflows/manual-ai-bot.yml'
- '.github/workflows/ci.yaml'
- 'packages/runtime-common/**'
- 'packages/ai-bot/**'
- 'pnpm-lock.yaml'
deploy:
name: Deploy boxel to staging
if: ${{ needs.change-check.outputs.boxel == 'true' }}
needs:
- change-check
- boxel-ui-test
- realm-server-test
uses: ./.github/workflows/manual-deploy.yml
secrets: inherit
with:
environment: "staging"
deploy-ai-bot:
needs:
- ai-bot-test
- change-check
if: ${{ needs.change-check.outputs.ai-bot == 'true' }}
uses: ./.github/workflows/manual-ai-bot.yml
secrets: inherit
with:
environment: "staging"