-
Notifications
You must be signed in to change notification settings - Fork 359
285 lines (257 loc) · 9.37 KB
/
test-deploy-fork.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
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
name: Test and deploy PR from fork
concurrency:
group: ${{ github.workflow }}-${{ github.event.workflow_run.id }}
cancel-in-progress: true
on:
workflow_run:
workflows: ['Build PR From Fork']
types: ['completed']
jobs:
prepare_jobs:
runs-on: ubuntu-latest
if: |
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success'
outputs:
pr_number: '${{ steps.get_pr_number.outputs.pr_number }}'
steps:
- name: Download PR info
uses: dawidd6/action-download-artifact@7847792dd435a50521b8e3bd3576dae7459d1fa8 # v2.22.0
with:
workflow: build-fork.yml
run_id: '${{ github.event.workflow_run.id }}'
workflow_conclusion: success
name: pr
path: ./
- name: Get PR number
shell: sh
id: get_pr_number
run: |
echo "::set-output name=pr_number::$(cat NUM | tr -dc '[:digit:]')"
- name: Link this CI run to PR
uses: actions/github-script@100527700e8b29ca817ac0e0dfbfc5e8ff38edda # v6.1.1
with:
script: |
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: Number('${{ steps.get_pr_number.outputs.pr_number }}'),
body: '🔎 Tests and deployment are running now!\nSee progress at ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}'
});
next_js_analyze:
runs-on: ubuntu-latest
needs: ['prepare_jobs']
env:
PR_NUMBER: ${{ needs.prepare_jobs.outputs.pr_number }}
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
with:
persist-credentials: false
- uses: ./.github/actions/analyze-comment
with:
PULL_REQUEST_NUMBER: '${{ env.PR_NUMBER }}'
cypress_smoke_v2:
runs-on: ubuntu-latest
needs: ['prepare_jobs']
strategy:
fail-fast: false
matrix:
market:
- polygon
- avalanche
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
- name: Run tests
uses: ./.github/actions/cypress
with:
CYPRESS_TENDERLY_ACCOUNT: '${{ secrets.TENDERLY_ACCOUNT }}'
CYPRESS_TENDERLY_KEY: '${{ secrets.TENDERLY_KEY }}'
CYPRESS_TENDERLY_PROJECT: '${{ secrets.TENDERLY_PROJECT }}'
YARN_TEST_COMMAND: npx cypress-repeat run -n 2 --rerun-failed-only --config-file ./cypress/configs/v2-markets/${{ matrix.market }}-v2-smoke.config.ts
cypress_smoke_v3:
runs-on: ubuntu-latest
needs: ['prepare_jobs']
strategy:
fail-fast: false
matrix:
market:
- polygon
- avalanche
- optimism
- ethereum
- base
- gho
- gnosis
- bnb
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
- name: Run tests
uses: ./.github/actions/cypress
with:
CYPRESS_TENDERLY_ACCOUNT: '${{ secrets.TENDERLY_ACCOUNT }}'
CYPRESS_TENDERLY_KEY: '${{ secrets.TENDERLY_KEY }}'
CYPRESS_TENDERLY_PROJECT: '${{ secrets.TENDERLY_PROJECT }}'
YARN_TEST_COMMAND: npx cypress-repeat run -n 2 --rerun-failed-only --config-file ./cypress/configs/v3-markets/${{ matrix.market }}-v3-smoke.config.ts
deploy_fork:
runs-on: ubuntu-latest
needs:
- prepare_jobs
- cypress_smoke_v2
- cypress_smoke_v3
env:
PR_NUMBER: ${{ needs.prepare_jobs.outputs.pr_number }}
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
with:
persist-credentials: false
- name: Download static build
uses: dawidd6/action-download-artifact@7847792dd435a50521b8e3bd3576dae7459d1fa8 # v2.22.0
with:
workflow: build-fork.yml
run_id: ${{ github.event.workflow_run.id }}
workflow_conclusion: success
name: out
path: out
- name: pinata
id: pinata
uses: aave/pinata-action@35662944e92cf082457973f10aa42e48df179b47
with:
PINATA_API_KEY: '${{ secrets.PINATA_API_KEY }}'
PINATA_SECRET_KEY: '${{ secrets.PINATA_SECRET_KEY }}'
PIN_ALIAS: 'pull_request_${{ env.PR_NUMBER }}'
BUILD_LOCATION: './out'
CID_VERSION: 1
- name: Pin to primary IPFS server
id: ipfs-primary
uses: ./.github/actions/dev-ipfs-pin
with:
GCP_SA_KEY: '${{ secrets.GCP_SA_KEY }}'
GKE_CLUSTER: '${{ secrets.GKE_CLUSTER }}'
GKE_CLUSTER_REGION: '${{ secrets.GKE_CLUSTER_REGION }}'
IPFS_SERVER_PORT: '${{ secrets.IPFS_PRIMARY_SERVER_PORT }}'
IPFS_SERVER: '${{ secrets.IPFS_PRIMARY_SERVER }}'
IPFS_SERVER_KEY: '${{ secrets.IPFS_PRIMARY_SERVER_KEY }}'
BUILD_PATH: 'out'
- name: 'Comment on PR'
uses: actions/github-script@100527700e8b29ca817ac0e0dfbfc5e8ff38edda # v6.1.1
with:
script: |
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: ${{ env.PR_NUMBER }},
body: `- Ipfs hash: ${{ steps.pinata.outputs.hash }}\n- Ipfs preview link: ${{ steps.pinata.outputs.uri }}`
});
cypress_full_v2:
runs-on: ubuntu-latest
needs: ['deploy_fork']
strategy:
fail-fast: false
matrix:
market:
- polygon
- avalanche
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
- name: Run tests
uses: ./.github/actions/cypress
with:
CYPRESS_TENDERLY_ACCOUNT: '${{ secrets.TENDERLY_ACCOUNT }}'
CYPRESS_TENDERLY_KEY: '${{ secrets.TENDERLY_KEY }}'
CYPRESS_TENDERLY_PROJECT: '${{ secrets.TENDERLY_PROJECT }}'
YARN_TEST_COMMAND: npx cypress-repeat run -n 2 --rerun-failed-only --config-file ./cypress/configs/v2-markets/${{ matrix.market }}-v2-full.config.ts
cypress_full_v3:
runs-on: ubuntu-latest
needs: ['deploy_fork']
strategy:
fail-fast: false
matrix:
market:
- polygon
- optimism
- ethereum
- gho
- base
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
- name: Run tests
uses: ./.github/actions/cypress
with:
CYPRESS_TENDERLY_ACCOUNT: '${{ secrets.TENDERLY_ACCOUNT }}'
CYPRESS_TENDERLY_KEY: '${{ secrets.TENDERLY_KEY }}'
CYPRESS_TENDERLY_PROJECT: '${{ secrets.TENDERLY_PROJECT }}'
YARN_TEST_COMMAND: npx cypress-repeat run -n 2 --rerun-failed-only --config-file ./cypress/configs/v3-markets/${{ matrix.market }}-v3-full.config.ts
cypress_app_functionality:
runs-on: ubuntu-latest
needs: ['deploy_fork']
strategy:
fail-fast: false
matrix:
scoupe:
- settings
- mobile
- governance-stake
- widgets
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
- name: Run tests
uses: ./.github/actions/cypress
with:
CYPRESS_TENDERLY_ACCOUNT: ${{ secrets.TENDERLY_ACCOUNT }}
CYPRESS_TENDERLY_KEY: ${{ secrets.TENDERLY_KEY }}
CYPRESS_TENDERLY_PROJECT: ${{ secrets.TENDERLY_PROJECT }}
YARN_TEST_COMMAND: npx cypress-repeat run -n 2 --rerun-failed-only --config-file ./cypress/configs/${{ matrix.scoupe }}.config.ts
notify_failure:
runs-on: ubuntu-latest
if: failure()
needs:
- prepare_jobs
- next_js_analyze
- cypress_full_v2
- cypress_full_v3
- cypress_app_functionality
env:
PR_NUMBER: ${{ needs.prepare_jobs.outputs.pr_number }}
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
- name: Comment
uses: ./.github/actions/fork-result-comment
with:
PULL_REQUEST_NUMBER: '${{ env.PR_NUMBER }}'
COMMENT_BODY: |
❌ CI run has failed!
Please see logs at ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}'
- name: Label
uses: ./.github/actions/fork-result-label
continue-on-error: true
with:
SUCCESS: 'false'
PULL_REQUEST_NUMBER: ${{ env.PR_NUMBER }}
TOKEN: ${{ secrets.GITHUB_TOKEN }}
notify_success:
runs-on: ubuntu-latest
if: success()
needs:
- prepare_jobs
- next_js_analyze
- cypress_full_v2
- cypress_full_v3
- cypress_app_functionality
env:
PR_NUMBER: ${{ needs.prepare_jobs.outputs.pr_number }}
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
- name: Comment
uses: ./.github/actions/fork-result-comment
with:
PULL_REQUEST_NUMBER: '${{ env.PR_NUMBER }}'
COMMENT_BODY: |
✅ CI run has succeded!
You can find tests and deployment logs at ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}'
- name: Label
uses: ./.github/actions/fork-result-label
continue-on-error: true
with:
SUCCESS: 'true'
PULL_REQUEST_NUMBER: ${{ env.PR_NUMBER }}
TOKEN: ${{ secrets.GITHUB_TOKEN }}