-
Notifications
You must be signed in to change notification settings - Fork 2
240 lines (238 loc) · 9.16 KB
/
ci_reusable.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
name: Build, Test and Deploy the Marketplace Interface - Reusable workflow
on:
workflow_call:
inputs:
REACT_APP_ENV_NAME:
required: true
type: string
DEPLOY_TO_FLEEK:
required: true
type: boolean
IS_PREVIEW:
required: true
type: boolean
UPDATE_COVERAGE:
required: true
type: boolean
ENV_NAME:
required: true
type: string
REACT_APP_ENABLE_CURATION_LISTS:
required: true
type: boolean
REACT_APP_OFFER_CURATION_LIST:
required: false
type: string
REACT_APP_IPFS_GATEWAY:
required: true
type: string
REACT_APP_IPFS_IMAGE_GATEWAY:
required: false
type: string
REACT_APP_RELEASE_TAG:
required: false
type: string
REACT_APP_RELEASE_NAME:
required: false
type: string
REACT_APP_DAPP_VIEW_MODE:
required: true
type: string
REACT_APP_DR_CENTER_VIEW_MODE:
required: true
type: string
REACT_APP_WIDGETS_URL:
required: true
type: string
REACT_APP_UNISWAP_API_URL:
required: true
type: string
REACT_APP_AWS_API_ENDPOINT:
required: true
type: string
REACT_APP_MOONPAY_API:
required: true
type: string
REACT_APP_MOONPAY_LINK:
required: true
type: string
REACT_APP_MOONPAY_EXTERNAL_LINK:
required: true
type: string
REACT_APP_META_TX_API_KEY_MAP:
required: true
type: string
REACT_APP_META_TX_API_IDS_MAP:
required: true
type: string
REACT_APP_META_TX_RELAYER_URL:
required: false
type: string
secrets:
NPM_TOKEN:
required: true
FLEEK_API_KEY:
required: false
CODECOV_TOKEN:
required: true
REACT_APP_INFURA_IPFS_PROJECT_ID:
required: false
REACT_APP_INFURA_IPFS_PROJECT_SECRET:
required: false
REACT_APP_DEFAULT_RESOLUTION_PERIOD_DAYS:
required: true
REACT_APP_GOOGLE_TAG_ID:
required: false
REACT_APP_WALLET_CONNECT_PROJECT_ID:
required: true
REACT_APP_INFURA_KEY:
required: true
REACT_APP_MOONPAY_API_KEY:
required: true
REACT_APP_MAGIC_API_KEY:
required: true
SENTRY_AUTH_TOKEN:
required: false
FLEEK_TOKEN:
required: false
FLEEK_PROJECT_ID:
required: false
outputs:
JOB_LINT:
value: ${{ jobs.build-test-deploy.outputs.jobLint }}
JOB_BUILD:
value: ${{ jobs.build-test-deploy.outputs.jobBuild }}
JOB_COVERAGE:
value: ${{ jobs.build-test-deploy.outputs.jobCoverage }}
DEPLOY_URL:
value: ${{ jobs.build-test-deploy.outputs.deployUrl }}
jobs:
build-test-deploy:
name: Build, Test and Deploy the Marketplace Interface
runs-on: ubuntu-22.04
env:
REACT_APP_BUYER_SELLER_AGREEMENT_TEMPLATE: "ipfs://QmaUobgQYrMnm2jZ3WowPtwRs4MpMR2TSinp3ChebjnZwe"
REACT_APP_RNFT_LICENSE_TEMPLATE: "ipfs://QmPbzbp7xcSKhQPjT5VacLRMVgM1U6DB4LiF2GVyHhvcA7"
REACT_APP_FAIR_EXCHANGE_POLICY_RULES: "ipfs://QmX8Wnq1eWbf7pRhEDQqdAqWp17YSKXQq8ckZVe4YdqAvt"
REACT_APP_ENV_NAME: ${{ inputs.REACT_APP_ENV_NAME }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
REACT_APP_ENABLE_CURATION_LISTS: ${{ inputs.REACT_APP_ENABLE_CURATION_LISTS }}
REACT_APP_OFFER_CURATION_LIST: ${{ inputs.REACT_APP_OFFER_CURATION_LIST }}
REACT_APP_IPFS_GATEWAY: ${{ inputs.REACT_APP_IPFS_GATEWAY }}
REACT_APP_IPFS_IMAGE_GATEWAY: ${{ inputs.REACT_APP_IPFS_IMAGE_GATEWAY }}
REACT_APP_DEFAULT_RESOLUTION_PERIOD_DAYS: ${{ secrets.REACT_APP_DEFAULT_RESOLUTION_PERIOD_DAYS }}
REACT_APP_INFURA_IPFS_PROJECT_ID: ${{ secrets.REACT_APP_INFURA_IPFS_PROJECT_ID }}
REACT_APP_INFURA_IPFS_PROJECT_SECRET: ${{ secrets.REACT_APP_INFURA_IPFS_PROJECT_SECRET }}
REACT_APP_GOOGLE_TAG_ID: ${{ secrets.REACT_APP_GOOGLE_TAG_ID }}
REACT_APP_META_TX_API_KEY_MAP: ${{ inputs.REACT_APP_META_TX_API_KEY_MAP }}
REACT_APP_META_TX_API_IDS_MAP: ${{ inputs.REACT_APP_META_TX_API_IDS_MAP }}
REACT_APP_META_TX_RELAYER_URL: ${{ inputs.REACT_APP_META_TX_RELAYER_URL }}
REACT_APP_WALLET_CONNECT_PROJECT_ID: ${{ secrets.REACT_APP_WALLET_CONNECT_PROJECT_ID }}
REACT_APP_RELEASE_TAG: ${{ inputs.REACT_APP_RELEASE_TAG }}
REACT_APP_RELEASE_NAME: ${{ inputs.REACT_APP_RELEASE_NAME }}
REACT_APP_VIEW_MODE: "dapp"
REACT_APP_DAPP_VIEW_MODE: ${{ inputs.REACT_APP_DAPP_VIEW_MODE }}
REACT_APP_DR_CENTER_VIEW_MODE: ${{ inputs.REACT_APP_DR_CENTER_VIEW_MODE }}
REACT_APP_WIDGETS_URL: ${{ inputs.REACT_APP_WIDGETS_URL }}
REACT_APP_UNISWAP_API_URL: ${{ inputs.REACT_APP_UNISWAP_API_URL }}
REACT_APP_AWS_API_ENDPOINT: ${{ inputs.REACT_APP_AWS_API_ENDPOINT }}
REACT_APP_MOONPAY_API: ${{ inputs.REACT_APP_MOONPAY_API }}
REACT_APP_MOONPAY_LINK: ${{ inputs.REACT_APP_MOONPAY_LINK }}
REACT_APP_INFURA_KEY: ${{ secrets.REACT_APP_INFURA_KEY }}
REACT_APP_MOONPAY_API_KEY: ${{ secrets.REACT_APP_MOONPAY_API_KEY }}
REACT_APP_MOONPAY_EXTERNAL_LINK: ${{ inputs.REACT_APP_MOONPAY_EXTERNAL_LINK }}
REACT_APP_MAGIC_API_KEY: ${{ secrets.REACT_APP_MAGIC_API_KEY }}
outputs:
jobLint: ${{ steps.lint.outputs.pass }}
jobBuild: ${{ steps.build.outputs.pass }}
jobCoverage: ${{ steps.coverage.outputs.pass }}
deployUrl: ${{ steps.deploy.outputs.deployUrl }}
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: "18"
registry-url: "https://registry.npmjs.org"
cache: "npm"
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ~/.npm
key: npm-${{ hashFiles('package-lock.json') }}
restore-keys: npm-
- name: Create Sentry release
if: ${{ inputs.IS_PREVIEW == false }}
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: "boson-protocol"
SENTRY_PROJECT: "v2-dapp"
with:
environment: ${{ inputs.ENV_NAME }}
version: ${{ inputs.REACT_APP_RELEASE_NAME }}
- run: npm ci
- name: Install Playwright Browsers
run: npx playwright install --with-deps chromium
- run: npm run prettier
- run: npm run tsc
- run: npm run test
- run: npm run lint
- id: lint
run: echo "::set-output name=pass::success"
- run: npm run build
- id: build
run: echo "::set-output name=pass::success"
- name: Run Tests & Generate coverage reports
run: npm run coverage:report
- name: Upload Unit Coverage to Codecov
if: ${{ inputs.UPDATE_COVERAGE }}
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage/coverage-final.json
flags: unittests
- name: Upload E2E Coverage to Codecov
if: ${{ inputs.UPDATE_COVERAGE }}
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./test-results.json
flags: e2etests
- name: (if 'staging' env) Copy contents from .fleek_staging.json to .fleek.json
if: ${{ inputs.ENV_NAME == 'staging' }}
run: mv .fleek_staging.json .fleek.json
- name: (if 'production' env) Copy contents from .fleek_production.json to .fleek.json
if: ${{ inputs.ENV_NAME == 'production' }}
run: mv .fleek_production.json .fleek.json
- name: Deploy via fleek
if: ${{ inputs.DEPLOY_TO_FLEEK }}
id: Deploy
run: npx @fleek-platform/cli sites deploy --config ./.fleek.json
env:
FLEEK_TOKEN: ${{ secrets.FLEEK_TOKEN }}
FLEEK_PROJECT_ID: ${{ secrets.FLEEK_PROJECT_ID }}
- name: Build dapp to show the dr_center only
run: npm run build
if: ${{ inputs.IS_PREVIEW == false && inputs.DEPLOY_TO_FLEEK }}
env:
REACT_APP_VIEW_MODE: "dr_center"
- name: (if DR Center 'testing' env) Copy contents from .fleek_dr_center_testing.json to .fleek_dr_center.json
if: ${{ inputs.ENV_NAME == 'testing' }}
run: mv .fleek_dr_center_testing.json .fleek_dr_center.json
- name: (if DR Center 'staging' env) Copy contents from .fleek_dr_center_staging.json to .fleek_dr_center.json
if: ${{ inputs.ENV_NAME == 'staging' }}
run: mv .fleek_dr_center_staging.json .fleek_dr_center.json
- name: (if DR Center 'production' env) Copy contents from .fleek_dr_center_production.json to .fleek_dr_center.json
if: ${{ inputs.ENV_NAME == 'production' }}
run: mv .fleek_dr_center_production.json .fleek_dr_center.json
- name: Deploy via fleek
if: ${{ inputs.DEPLOY_TO_FLEEK }}
id: deploy_dr_center
run: npx @fleek-platform/cli sites deploy --config ./.fleek_dr_center.json
env:
REACT_APP_VIEW_MODE: "dr_center"
FLEEK_TOKEN: ${{ secrets.FLEEK_TOKEN }}
FLEEK_PROJECT_ID: ${{ secrets.FLEEK_PROJECT_ID }}