-
Notifications
You must be signed in to change notification settings - Fork 4
278 lines (265 loc) · 10.8 KB
/
ocwa.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
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
name: "OCWA"
on:
push:
branches:
- '**'
pull_request:
types:
- opened
release:
types: ['created']
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
QUAYIO_PASSWORD: ${{ secrets.QUAYIO_PASSWORD }}
QUAYIO_USERNAME: ${{ secrets.QUAYIO_USERNAME }}
MONGODB: 4.1.1
HELM_TGZ: helm-v2.4.1-linux-amd64.tar.gz
HELM_URL: https://get.helm.sh
YAMLLINT_VERSION: 1.8.1
jobs:
project_api:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
working-directory: microservices/projectApi
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
with:
node-version: 11.15.0
cache: 'npm'
cache-dependency-path: microservices/projectApi/package-lock.json
- name: install dependencies
run: npm ci
- name: test
run: |
cp config/test.json.example config/test.json
cp config/default.json.example config/default.json
wget -q http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-${MONGODB}.tgz
export PWD=$(pwd)
tar xzf mongodb-linux-x86_64-${MONGODB}.tgz
mkdir ${PWD}/mongodb-linux-x86_64-${MONGODB}/data
${PWD}/mongodb-linux-x86_64-${MONGODB}/bin/mongod --dbpath ${PWD}/mongodb-linux-x86_64-${MONGODB}/data --logpath ${PWD}/mongodb-linux-x86_64-${MONGODB}/mongodb.log --fork
${PWD}/mongodb-linux-x86_64-${MONGODB}/bin/mongo projectDb --eval 'db.createUser({user:"projectUser", pwd:"projectPass", roles:["readWrite"]});'
npm test
- name: helm
run: |
wget -q ${HELM_URL}/${HELM_TGZ}
tar xzfv ${HELM_TGZ}
PATH=`pwd`/linux-amd64/:$PATH
sudo pip install yamllint=="${YAMLLINT_VERSION}"
helm lint ./helm/projectApi
- name: quayio_push
run: |
export BRANCH=${GITHUB_REF##*/}
bash docker_quayio_push ocwa_project_api
- name: deploy
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/main' || (github.event_name == 'release' && github.event.action == 'created')
run: |
export BRANCH=${GITHUB_REF##*/}
bash docker_push ocwa_project_api
request_api:
runs-on: ubuntu-latest
timeout-minutes: 10
defaults:
run:
shell: bash
working-directory: microservices/requestApi
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
with:
node-version: 11.15.0
cache: 'npm'
cache-dependency-path: microservices/requestApi/package-lock.json
- name: install dependencies
run: npm ci
- name: test
run: |
wget -q https://dl.minio.io/server/minio/release/linux-amd64/minio
chmod +x minio
export MINIO_ACCESS_KEY="accesskey"
export MINIO_SECRET_KEY="secretkey"
mkdir ./tmp
./minio server ./tmp &
cp config/test.json.example config/test.json
cp config/default.json.example config/default.json
wget -q http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-${MONGODB}.tgz
export PWD=$(pwd)
tar xzf mongodb-linux-x86_64-${MONGODB}.tgz
mkdir ${PWD}/mongodb-linux-x86_64-${MONGODB}/data
${PWD}/mongodb-linux-x86_64-${MONGODB}/bin/mongod --dbpath ${PWD}/mongodb-linux-x86_64-${MONGODB}/data --logpath ${PWD}/mongodb-linux-x86_64-${MONGODB}/mongodb.log --fork
${PWD}/mongodb-linux-x86_64-${MONGODB}/bin/mongo forumDb --eval 'db.createUser({user:"forumUser", pwd:"forumPass", roles:["dbAdmin", "readWrite"]});'
cd ../shared/js
npm ci
cd ../../formio
wget -q https://fastdl.mongodb.org/tools/db/mongodb-database-tools-ubuntu2204-x86_64-100.8.0.tgz
tar xzf mongodb-database-tools-ubuntu2204-x86_64-100.8.0.tgz
./mongodb-database-tools-ubuntu2204-x86_64-100.8.0/bin/mongorestore -u forumUser -p forumPass -d forumDb db
git clone -b v1.90.15 https://github.com/formio/formio.git
cd formio
npm ci
cp ../default.json ./config/default.json
cp ../prompt.txt ./prompt.txt
npm start < prompt.txt &
cd ../..
git clone https://github.com/bcgov/forum-api.git
cd forum-api
cp config/default.json.example config/default.json
cp config/test.json.example config/test.json
npm ci
NODE_ENV=test npm run serve &
cd ../validateApi
cp config/default.json.template config/default.json
pip3 install --upgrade -r requirements.txt
pip3 install -e .
python3.5 wsgi.py &
cd ../policyApi
cp config/default.json.template config/default.json
pip3 install --upgrade -r requirements.txt
pip3 install -e .
python3.5 wsgi.py &
cd ../requestApi
NODE_ENV=test npm start &
NODE_ENV=test npm test
- name: helm
run: |
wget -q ${HELM_URL}/${HELM_TGZ}
tar xzfv ${HELM_TGZ}
PATH=`pwd`/linux-amd64/:$PATH
sudo pip install yamllint=="${YAMLLINT_VERSION}"
helm lint ./helm/requestApi
- name: quayio_push
run: |
export BRANCH=${GITHUB_REF##*/}
bash docker_quayio_push ocwa_request_api
- name: deploy
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/main' || (github.event_name == 'release' && github.event.action == 'created')
run: |
export BRANCH=${GITHUB_REF##*/}
bash docker_push ocwa_request_api
policy_api:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
working-directory: microservices/policyApi
steps:
- uses: actions/checkout@v2
- name: install dependencies
run: pip3 install --upgrade pip setuptools==58.0.0
- name: test
run: |
wget -q http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-${MONGODB}.tgz
export PWD=$(pwd)
tar xzf mongodb-linux-x86_64-${MONGODB}.tgz
mkdir ${PWD}/mongodb-linux-x86_64-${MONGODB}/data
${PWD}/mongodb-linux-x86_64-${MONGODB}/bin/mongod --dbpath ${PWD}/mongodb-linux-x86_64-${MONGODB}/data --logpath ${PWD}/mongodb-linux-x86_64-${MONGODB}/mongodb.log --fork
${PWD}/mongodb-linux-x86_64-${MONGODB}/bin/mongo projectDb --eval 'db.createUser({user:"projectUser", pwd:"projectPass", roles:["readWrite"]});'
${PWD}/mongodb-linux-x86_64-${MONGODB}/bin/mongo forumDb --eval 'db.createUser({user:"forumUser", pwd:"forumPass", roles:["dbAdmin", "readWrite"]});'
cp ./config/default.json.template ./config/default.json
pip3 install -r requirements.txt
pip3 install -e .
coverage run --branch --source=db,v1 -m pytest
coverage xml
- name: helm
run: |
wget -q ${HELM_URL}/${HELM_TGZ}
tar xzfv ${HELM_TGZ}
PATH=`pwd`/linux-amd64/:$PATH
sudo pip install yamllint=="${YAMLLINT_VERSION}"
helm lint ./helm/policyApi
- name: quayio_push
run: |
export BRANCH=${GITHUB_REF##*/}
bash docker_quayio_push ocwa_policy_api
- name: deploy
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/main' || (github.event_name == 'release' && github.event.action == 'created')
run: |
export BRANCH=${GITHUB_REF##*/}
bash docker_push ocwa_policy_api
validation_api:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
working-directory: microservices/validateApi
steps:
- uses: actions/checkout@v2
- name: install dependencies
run: pip3 install --upgrade pip setuptools==58.0.0
- name: test
run: |
cd ../policyApi
pip3 install -r requirements.txt
pip3 install -e .
cp config/default.json.template config/default.json
python3 wsgi.py &
cd ../validateApi
wget -q http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-${MONGODB}.tgz
export PWD=$(pwd)
tar xzf mongodb-linux-x86_64-${MONGODB}.tgz
mkdir ${PWD}/mongodb-linux-x86_64-${MONGODB}/data
${PWD}/mongodb-linux-x86_64-${MONGODB}/bin/mongod --dbpath ${PWD}/mongodb-linux-x86_64-${MONGODB}/data --logpath ${PWD}/mongodb-linux-x86_64-${MONGODB}/mongodb.log --fork
${PWD}/mongodb-linux-x86_64-${MONGODB}/bin/mongo projectDb --eval 'db.createUser({user:"projectUser", pwd:"projectPass", roles:["readWrite"]});'
${PWD}/mongodb-linux-x86_64-${MONGODB}/bin/mongo forumDb --eval 'db.createUser({user:"forumUser", pwd:"forumPass", roles:["dbAdmin", "readWrite"]});'
cp config/default.json.template config/default.json
pip3 install --upgrade -r requirements.txt
pip3 install -e .
coverage run --branch --source=db,v1 -m pytest
coverage xml
- name: helm
run: |
wget -q ${HELM_URL}/${HELM_TGZ}
tar xzfv ${HELM_TGZ}
PATH=`pwd`/linux-amd64/:$PATH
sudo pip install yamllint=="${YAMLLINT_VERSION}"
helm lint ./helm/validate-api
- name: quayio_push
run: |
export BRANCH=${GITHUB_REF##*/}
bash docker_quayio_push ocwa_validate_api
- name: deploy
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/main' || (github.event_name == 'release' && github.event.action == 'created')
run: |
export BRANCH=${GITHUB_REF##*/}
bash docker_push ocwa_validate_api
frontend:
needs: ["project_api", "request_api", "policy_api", "validation_api"]
runs-on: ubuntu-latest
defaults:
run:
shell: bash
working-directory: frontend
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
with:
node-version: 11.15.0
cache: 'npm'
cache-dependency-path: frontend/package-lock.json
- name: install dependencies
run: npm ci
- name: test
run: |
cp config/default.json.example config/default.json
cp config/test.json.example config/test.json
npm test
- name: helm
run: |
wget -q ${HELM_URL}/${HELM_TGZ}
tar xzfv ${HELM_TGZ}
PATH=`pwd`/linux-amd64/:$PATH
sudo pip install yamllint=="${YAMLLINT_VERSION}"
helm lint ./helm/frontend
- name: quayio_push
run: |
export BRANCH=${GITHUB_REF##*/}
bash docker_quayio_push ocwa_frontend
- name: deploy
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/main' || (github.event_name == 'release' && github.event.action == 'created')
run: |
export BRANCH=${GITHUB_REF##*/}
bash docker_push ocwa_frontend