-
Notifications
You must be signed in to change notification settings - Fork 7
221 lines (205 loc) · 6 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
name: CI
on:
push:
branches-ignore:
- '**-e2e'
concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress: true
env:
NODE_OPTIONS: '--max-old-space-size=6144'
NODE_ENV: test
jobs:
validate_branch_name:
name: Validate branch name
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Validate branch name
run: packages/devops/scripts/ci/validateBranchName.sh
validate_migration:
name: Validate new migrations
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Validate new migration
run: packages/devops/scripts/ci/validateNewMigrations.sh
validate_tests:
name: Validate tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: yarn
- run: corepack enable yarn
- run: SKIP_BUILD_INTERNAL_DEPENDENCIES=true yarn install
- run: yarn workspace @tupaia/utils build # /scripts/node/validateTests.js uses utils package
- name: Validate unit tests
run: packages/devops/scripts/ci/validateTests.sh
validate_types:
name: Validate types
runs-on: ubuntu-latest
env:
DB_NAME: tupaia_test
DB_PASSWORD: opensesame1
DB_URL: localhost
DB_USER: tupaia
DB_PG_USER: postgres
DB_PG_PASSWORD: opensesame2
DB_MV_USER: mvrefresh
DB_MV_PASSWORD: opensesame3
services:
postgres:
image: postgis/postgis:13-3.2-alpine
env:
POSTGRES_PASSWORD: opensesame2
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps tcp port 5432 on service container to the host
- 5432:5432
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: yarn
- run: corepack enable yarn
- run: SKIP_BUILD_INTERNAL_DEPENDENCIES=true yarn install
- run: yarn build:internal-dependencies
- run: ./packages/devops/scripts/ci/validateTypesAndDbSchemaInSync.sh
run_tests:
name: Run tests
timeout-minutes: 15 # Sometimes Jest doesn’t exit properly for meditrak-app-server tests
runs-on: ubuntu-latest
env:
# common
DB_NAME: tupaia_test
DB_PASSWORD: opensesame1
DB_URL: localhost
DB_USER: tupaia
AGGREGATION_URL_PREFIX: dev-
API_CLIENT_NAME: api-client
API_CLIENT_PASSWORD: api-client
API_CLIENT_SALT: abc132
JWT_SECRET: abc132
TUPAIA_ADMIN_EMAIL_ADDRESS: [email protected]
TUPAIA_FRONT_END_URL: dev.tupaia.org
LESMIS_FRONT_END_URL: dev-lesmis.tupaia.org
DATATRAK_FRONT_END_URL: dev-datatrak.tupaia.org
# test database
DB_PG_USER: postgres
DB_PG_PASSWORD: opensesame2
DB_MV_USER: mvrefresh
DB_MV_PASSWORD: opensesame3
# test data-lake-api
DATA_LAKE_DB_NAME: data_lake_test
DATA_LAKE_DB_PASSWORD: opensesame4
DATA_LAKE_DB_URL: localhost
DATA_LAKE_DB_USER: tupaia
# viz-test-tool
SLACK_BOT_OAUTH_TOKEN: cat1234
# Disable zendesk notifications in tests
ZENDESK_NOTIFICATIONS_DISABLED: 'true'
strategy:
fail-fast: false
matrix:
package:
- admin-panel
- admin-panel-server
- aggregator
- api-client
- auth
- central-server
- data-api
- data-broker
- data-lake-api
- data-table-server
- database
- datatrak-web
- datatrak-web-server
- dhis-api
- entity-server
- expression-parser
- indicators
- kobo-api
- lesmis
- lesmis-server
- meditrak-app-server
- psss
- psss-server
- report-server
- server-boilerplate
- server-utils
- superset-api
- tsutils
- tupaia-web
- tupaia-web-server
- ui-chart-components
- ui-components
- ui-map-components
- utils
- viz-test-tool
- weather-api
- web-config-server
services:
postgres:
image: postgis/postgis:13-3.2-alpine
env:
POSTGRES_PASSWORD: opensesame2
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps tcp port 5432 on service container to the host
- 5432:5432
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: yarn
- run: corepack enable yarn
- run: SKIP_BUILD_INTERNAL_DEPENDENCIES=true yarn install
- run: yarn build:internal-dependencies
- run: yarn workspace @tupaia/${{ matrix.package }} setup-test || echo "No setup needed"
- run: yarn workspace @tupaia/${{ matrix.package }} test
build:
name: Build
runs-on: ubuntu-latest
env:
CI: false # react-scripts build treats warnings as errors if this is true
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: yarn
- run: corepack enable yarn
- run: SKIP_BUILD_INTERNAL_DEPENDENCIES=true yarn install --immutable
- run: yarn build
allgreen:
name: All Green
if: always()
needs:
- validate_branch_name
- validate_migration
- validate_tests
- validate_types
- run_tests
- build
runs-on: ubuntu-latest
steps:
- name: Green if all jobs are green
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}