-
Notifications
You must be signed in to change notification settings - Fork 64
249 lines (237 loc) · 8.22 KB
/
push-main.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
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
name: CI [main]
on:
push:
branches: [main]
permissions:
contents: read
issues: read
checks: write
pull-requests: write
id-token: write
jobs:
update-cache:
name: Update node_modules cache
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/init
lint:
name: Lint All
needs: update-cache
runs-on: ubuntu-latest
env:
# we are running into heap out of memory issues with the linting--so
# increasing the heap size to 8GB
NODE_OPTIONS: --max-old-space-size=8192
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/init
- run: yarn lint
test_node_packages:
needs: lint
runs-on: ubuntu-latest
env:
CARDBOT_TOKEN: ${{ secrets.CARDBOT_TOKEN }}
CORDE_BOT_TOKEN: ${{ secrets.CORDE_BOT_TOKEN }}
services:
postgres:
image: postgres:13
env:
POSTGRES_DB: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
ports:
- 5432:5432
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
-v /var/run/postgresql/:/var/run/postgresql
steps:
- name: Create database
run: sudo -u postgres createdb hub_test
- uses: actions/checkout@v3
- uses: ./.github/actions/init
- run: yarn db:test-init
working-directory: packages/hub
- run: yarn run npm-run-all --aggregate-output --continue-on-error --parallel test:did-resolver test:hub
test_ember_apps:
name: Ember apps Build/Lint/Test
needs: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/init
- name: Run boxel tests
env:
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN_BOXEL }}
run: yarn test:boxel:percy
- name: Run ember-helper tests
run: yarn test:ember-shared
# using yarn to install @percy/cli suddenly started causing V8 out of
# memory errors. According to https://stackoverflow.com/a/56568741 likely
# there is a dependency cycle that yarn can't see through. However, npm
# has the ability to collapse these cycles. So we are using npm to install
# percy
- run: npm install -g @percy/cli
- name: Run web client tests
env:
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN_WEB_CLIENT }}
run: yarn test:web-client:percy
- name: Run ssr-web tests
env:
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN_SSR_WEB }}
run: yarn test:ssr-web:percy
- name: Run safe-tools-client tests
env:
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN_SAFE_TOOLS_CLIENT }}
run: yarn test:safe-tools-client:percy
- name: Publish web-client test results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
check_name: "web-client test results"
files: ci-xml-test-results/web-client.xml
- name: Publish ssr-web test results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
check_name: "ssr-web test results"
files: ci-xml-test-results/ssr-web.xml
change_check:
name: Check which packages changed
needs: [test_node_packages, test_ember_apps]
runs-on: ubuntu-latest
outputs:
hub: ${{ steps.filter.outputs.hub }}
web_client: ${{ steps.filter.outputs.web_client }}
boxel: ${{ steps.filter.outputs.boxel }}
ember-shared: ${{ steps.filter.outputs.ember-shared }}
ssr_web: ${{ steps.filter.outputs.ssr_web }}
safe-tools-client: ${{ steps.filter.outputs.safe-tools-client }}
steps:
- uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
hub:
- 'packages/hub/**'
- 'packages/did-resolver/**'
- 'packages/discord-bot/**'
- 'packages/cardpay-sdk/**'
- 'packages/did-resolver/**'
- '.github/workflows/push-main.yml'
- '.github/actions/deploy-hub/**'
- 'yarn.lock'
web_client:
- 'packages/web-client/**'
- 'packages/boxel/**'
- 'packages/ember-shared/**'
- 'packages/cardpay-sdk/**'
- 'packages/did-resolver/**'
- '.github/workflows/push-main.yml'
- '.github/actions/deploy-web-client/**'
- 'yarn.lock'
boxel:
- 'packages/boxel/**'
- '.github/workflows/push-main.yml'
- 'yarn.lock'
ssr_web:
- 'packages/ssr-web/**'
- 'packages/boxel/**'
- 'packages/cardpay-sdk/**'
- 'packages/did-resolver/**'
- '.github/workflows/push-main.yml'
- '.github/workflows/manual-ssr-web.yml'
- 'yarn.lock'
safe-tools-client:
- 'packages/safe-tools-client/**'
- 'packages/boxel/**'
- 'packages/ember-shared/**'
- '.github/workflows/push-main.yml'
- '.github/actions/deploy-safe-tools-client/**'
- 'yarn.lock'
deploy-hub:
name: Deploy hub to staging
needs: change_check
if: ${{ needs.change_check.outputs.hub == 'true' }}
uses: ./.github/workflows/manual-hub.yml
secrets: inherit
with:
environment: "staging"
deploy-web-client-staging:
name: Deploy web-client to S3 staging bucket
needs: change_check
if: ${{ needs.change_check.outputs.web_client == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/init
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2.0.0
with:
role-to-assume: arn:aws:iam::680542703984:role/web-client
aws-region: us-east-1
- name: Deploy web-client
uses: ./.github/actions/deploy-web-client
env:
HUB_URL: https://hub-staging.stack.cards
SENTRY_AUTH_TOKEN: ${{ secrets.WEB_CLIENT_SENTRY_AUTH_TOKEN }}
SENTRY_DSN: ${{ secrets.WEB_CLIENT_SENTRY_DSN }}
with:
environment: staging
discord_webhook: ${{ secrets.DISCORD_WEBHOOK }}
deploy-ssr-web:
name: Deploy ssr-web
needs: change_check
if: ${{ needs.change_check.outputs.ssr_web == 'true' }}
uses: ./.github/workflows/manual-ssr-web.yml
secrets: inherit
with:
environment: "staging"
deploy-boxel:
name: Deploy boxel to S3 bucket
needs: change_check
if: ${{ needs.change_check.outputs.boxel == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/init
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2.0.0
with:
role-to-assume: arn:aws:iam::680542703984:role/boxel
aws-region: us-east-1
- name: Deploy preview
run: yarn deploy:boxel
env:
S3_PREVIEW_INDEX_BUCKET_NAME: boxel-preview.cardstack.com
S3_PREVIEW_ASSET_BUCKET_NAME: boxel-preview-assets.cardstack.com
S3_PREVIEW_ASSET_BUCKET_ENDPOINT: https://s3.us-east-1.amazonaws.com/boxel-preview-assets.cardstack.com
S3_PREVIEW_REGION: us-east-1
- name: Send notification to Discord
if: ${{ always() }}
uses: ./.github/actions/discord-notification-deploy
with:
app: boxel
status: ${{ job.status }}
environment: staging
webhook: ${{ secrets.DISCORD_WEBHOOK }}
deploy-safe-tools-client:
needs: change_check
if: ${{ needs.change_check.outputs.safe-tools-client == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/init
- name: Deploy safe-tools-client
uses: ./.github/actions/deploy-safe-tools-client
with:
environment: staging
discord_webhook: ${{ secrets.DISCORD_WEBHOOK }}
env:
SENTRY_DSN: ${{ secrets.SAFE_TOOLS_CLIENT_SENTRY_DSN }}
HUB_URL: https://hub-staging.stack.cards