This repository was archived by the owner on Oct 13, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 9
205 lines (204 loc) · 7.79 KB
/
workflow.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
# DO NOT EDIT MANUALLY. THIS FILE IS AUTOMATICALLY GENERATED.
# Edit the source files in `.github/workflows-src/`
name: CI / CD
'on':
pull_request:
branches:
- main
push:
branches:
- main
release:
types:
- published
jobs:
test:
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }}
name: Run tests
runs-on: ubuntu-latest
strategy:
matrix:
node-version:
- 10.x
- 12.x
- 14.x
steps:
- name: '[SETUP] Print event info'
uses: hmarr/debug-action@v2
- name: '[SETUP] Clone repository'
uses: actions/checkout@v2
- name: '[SETUP] Set NodeJS version to ${{ matrix.node-version }}'
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: '[SETUP] Get yarn cache path'
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- name: '[SETUP] (Re)store yarn cache'
uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: '[SETUP] Install dependencies'
run: yarn
- name: Run linters
run: yarn lint
- name: 'Build: i18n resource bundles'
run: yarn workspace gluco-check-common run build
- name: 'Test: Core package'
run: yarn workspace gluco-check-core run test:cov
- name: 'Build: Core package'
run: yarn workspace gluco-check-core run build
- name: 'Build: Webhooks'
run: yarn workspace gluco-check-webhooks run build
- name: 'Test: Frontend'
run: yarn workspace gluco-check-frontend run test:ci
- name: Upload test coverage results
if: ${{ matrix.node-version == '14.x' }}
uses: codecov/codecov-action@v2
- name: Tar workspace
if: ${{ matrix.node-version == '14.x' }}
run: tar -czf ${{ runner.temp }}/workspace.tar ./
- name: Upload workspace
if: ${{ matrix.node-version == '14.x' }}
uses: actions/upload-artifact@master
with:
name: ${{ github.run_id }}
path: ${{ runner.temp }}/workspace.tar
deploy-nightly-webhooks:
name: Deploy webhooks (Nightly)
environment:
name: Nightly
url: https://nightly.glucocheck.app/
if: ${{ github.event_name == 'push' }}
needs: test
runs-on: ubuntu-latest
steps:
- name: Set NodeJS version to ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: 14.x
- uses: actions/download-artifact@master
name: Download workspace
with:
name: ${{ github.run_id }}
- name: Untar workspace
run: tar -xf workspace.tar ./
- name: 'Deploy: Webhooks'
uses: w9jds/firebase-action@master
with:
args: deploy --only functions
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
PROJECT_PATH: ./gluco-check-webhooks
PROJECT_ID: ${{ secrets.REACT_APP_FIREBASE_PROJECT_ID }}
deploy-nightly-frontend:
name: Deploy frontend (Nightly)
environment:
name: Nightly
url: https://nightly.glucocheck.app
if: ${{ github.event_name == 'push' }}
needs: test
runs-on: ubuntu-latest
steps:
- name: Set NodeJS version to ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: 14.x
- uses: actions/download-artifact@master
name: Download workspace
with:
name: ${{ github.run_id }}
- name: Untar workspace
run: tar -xf workspace.tar ./
- name: 'Build: Frontend'
env:
REACT_APP_FIREBASE_API_KEY: ${{ secrets.REACT_APP_FIREBASE_API_KEY }}
REACT_APP_FIREBASE_AUTH_DOMAIN: ${{ secrets.REACT_APP_FIREBASE_AUTH_DOMAIN }}
REACT_APP_FIREBASE_DB_URL: ${{ secrets.REACT_APP_FIREBASE_DB_URL }}
REACT_APP_FIREBASE_PROJECT_ID: ${{ secrets.REACT_APP_FIREBASE_PROJECT_ID }}
REACT_APP_FIREBASE_STORAGE_BUCKET: ${{ secrets.REACT_APP_FIREBASE_STORAGE_BUCKET }}
REACT_APP_FIREBASE_MESSAGING_SENDER_ID: ${{ secrets.REACT_APP_FIREBASE_MESSAGING_SENDER_ID }}
REACT_APP_FIREBASE_APP_ID: ${{ secrets.REACT_APP_FIREBASE_APP_ID }}
REACT_APP_I18N_DEBUG: ${{ secrets.REACT_APP_I18N_DEBUG }}
REACT_APP_NIGHTSCOUT_VALIDATION_ENDPOINT_URL: ${{ secrets.REACT_APP_NIGHTSCOUT_VALIDATION_ENDPOINT_URL }}
REACT_APP_DEBUG: ${{ secrets.REACT_APP_DEBUG }}
run: yarn workspace gluco-check-frontend run build
- name: 'Deploy: Frontend'
uses: w9jds/firebase-action@master
with:
args: deploy --only hosting
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
PROJECT_PATH: ./gluco-check-frontend
PROJECT_ID: ${{ secrets.REACT_APP_FIREBASE_PROJECT_ID }}
deploy-production-webhooks:
name: Deploy webhooks (Prod)
environment:
name: Production
url: https://glucocheck.app/
if: ${{ github.event.action == 'published' && github.event.release.target_commitish == 'main' }}
needs: test
runs-on: ubuntu-latest
steps:
- name: Set NodeJS version to ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: 14.x
- uses: actions/download-artifact@master
name: Download workspace
with:
name: ${{ github.run_id }}
- name: Untar workspace
run: tar -xf workspace.tar ./
# - name: 'Deploy: Webhooks'
# uses: w9jds/firebase-action@master
# with:
# args: deploy --only functions
# env:
# FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
# PROJECT_PATH: ./gluco-check-webhooks
# PROJECT_ID: ${{ secrets.REACT_APP_FIREBASE_PROJECT_ID }}
deploy-production-frontend:
name: Deploy frontend (Prod)
environment:
name: Production
url: https://glucocheck.app
if: ${{ github.event.action == 'published' && github.event.release.target_commitish == 'main' }}
needs: test
runs-on: ubuntu-latest
steps:
- name: Set NodeJS version to ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: 14.x
- uses: actions/download-artifact@master
name: Download workspace
with:
name: ${{ github.run_id }}
- name: Untar workspace
run: tar -xf workspace.tar ./
- name: 'Build: Frontend'
env:
REACT_APP_FIREBASE_API_KEY: ${{ secrets.REACT_APP_FIREBASE_API_KEY }}
REACT_APP_FIREBASE_AUTH_DOMAIN: ${{ secrets.REACT_APP_FIREBASE_AUTH_DOMAIN }}
REACT_APP_FIREBASE_DB_URL: ${{ secrets.REACT_APP_FIREBASE_DB_URL }}
REACT_APP_FIREBASE_PROJECT_ID: ${{ secrets.REACT_APP_FIREBASE_PROJECT_ID }}
REACT_APP_FIREBASE_STORAGE_BUCKET: ${{ secrets.REACT_APP_FIREBASE_STORAGE_BUCKET }}
REACT_APP_FIREBASE_MESSAGING_SENDER_ID: ${{ secrets.REACT_APP_FIREBASE_MESSAGING_SENDER_ID }}
REACT_APP_FIREBASE_APP_ID: ${{ secrets.REACT_APP_FIREBASE_APP_ID }}
REACT_APP_I18N_DEBUG: ${{ secrets.REACT_APP_I18N_DEBUG }}
REACT_APP_NIGHTSCOUT_VALIDATION_ENDPOINT_URL: ${{ secrets.REACT_APP_NIGHTSCOUT_VALIDATION_ENDPOINT_URL }}
REACT_APP_DEBUG: ${{ secrets.REACT_APP_DEBUG }}
run: yarn workspace gluco-check-frontend run build
- name: 'Deploy: Frontend'
uses: w9jds/firebase-action@master
with:
args: deploy --only hosting
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
PROJECT_PATH: ./gluco-check-frontend
PROJECT_ID: ${{ secrets.REACT_APP_FIREBASE_PROJECT_ID }}