-
Notifications
You must be signed in to change notification settings - Fork 58
276 lines (226 loc) · 11.7 KB
/
test_debian_packages_on_ubuntu.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
name: Test installing the debian packages
on:
push:
tags:
- v*
branches:
- "release**"
- "main"
pull_request:
branches:
- "release**"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build-packages:
strategy:
matrix:
dist: [ubuntu]
package: [bytes, boefjes, rocky, keiko, octopoes, mula]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get version from release tag or generate one
run: |
if [ ${GITHUB_REF_TYPE} = "tag" ]; then
echo "RELEASE_VERSION=${GITHUB_REF#refs/*/v}" >> $GITHUB_ENV
else
pip install setuptools-scm==7.1.0
echo "RELEASE_VERSION=$(python -m setuptools_scm)" >> $GITHUB_ENV
fi
- name: Run debian package build
uses: addnab/docker-run-action@v3
with:
run: packaging/scripts/build-debian-package.sh
registry: ghcr.io
image: ghcr.io/minvws/nl-kat-${{ matrix.dist }}-build-image:latest
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
options: -v ${{ github.workspace }}/${{ matrix.package }}:/app
-v ${{ github.workspace }}/octopoes:/octopoes
-e REPOSITORY=${{ github.repository }}
-e RELEASE_VERSION=${{ env.RELEASE_VERSION }}
-e RELEASE_TAG=${{ env.RELEASE_TAG }}
-e PKG_NAME=kat-${{ matrix.package }}
--workdir /app
- name: Upload .deb to artifacts
uses: actions/upload-artifact@v4
with:
name: kat-${{ matrix.package }}_${{ env.RELEASE_VERSION }}_${{ matrix.dist }}.deb
path: ${{ matrix.package }}/build/kat-${{ matrix.package }}_${{ env.RELEASE_VERSION }}_amd64.deb
test-deb-install:
needs: build-packages
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
env:
PGPASSWORD: postgres # No password prompt
steps:
- uses: actions/checkout@v4
- name: Get version from release tag or generate one
run: |
if [ ${GITHUB_REF_TYPE} = "tag" ]; then
echo "RELEASE_VERSION=${GITHUB_REF#refs/*/v}" >> $GITHUB_ENV
else
pip install setuptools-scm==7.1.0
echo "RELEASE_VERSION=$(python -m setuptools_scm)" >> $GITHUB_ENV
fi
- name: Install dependencies Docker and rabbitmq
run: sudo apt-get update && sudo apt-get install -y docker.io containerd runc rabbitmq-server postgresql
- name: Start postgresql
run: |
sudo systemctl start postgresql.service
- name: Prepare rabbitmq configurations
run: |
echo "export ERL_EPMD_ADDRESS=127.0.0.1" | sudo tee -a /etc/rabbitmq/rabbitmq-env.conf
echo "export NODENAME=rabbit@localhost" | sudo tee -a /etc/rabbitmq/rabbitmq-env.conf
sudo systemctl stop rabbitmq-server
sudo epmd -kill
echo "listeners.tcp.local = 127.0.0.1:5672" | sudo tee -a /etc/rabbitmq/rabbitmq.conf
echo "[{kernel,[ {inet_dist_use_interface,{127,0,0,1}}]}]." | sudo tee -a /etc/rabbitmq/advanced.config
- name: Start rabbitmq
run: |
sudo systemctl start rabbitmq-server
- name: Wait until postgresql is healthy
run: |
for i in {1..10}; do pg_isready -h localhost && break || sleep 1 ; done
- name: Prepare postgres service Rocky
run: |
sudo -u postgres createdb rocky_db
sudo -u postgres createuser rocky
sudo -u postgres psql -c "GRANT ALL ON DATABASE rocky_db TO rocky;"
sudo -u postgres psql -c "ALTER USER rocky WITH PASSWORD 'postgres';"
- name: Prepare postgres service Katalogus
run: |
sudo -u postgres createdb katalogus_db
sudo -u postgres createuser katalogus
sudo -u postgres psql -c "GRANT ALL ON DATABASE katalogus_db TO katalogus;"
sudo -u postgres psql -c "ALTER USER katalogus WITH PASSWORD 'postgres';"
- name: Prepare postgres service Bytes
run: |
sudo -u postgres createdb bytes_db
sudo -u postgres createuser bytes
sudo -u postgres psql -c "GRANT ALL ON DATABASE bytes_db TO bytes;"
sudo -u postgres psql -c "ALTER USER bytes WITH PASSWORD 'postgres';"
- name: Prepare postgres service Mula
run: |
sudo -u postgres createdb mula_db
sudo -u postgres createuser mula
sudo -u postgres psql -c "GRANT ALL ON DATABASE mula_db TO mula;"
sudo -u postgres psql -c "ALTER USER mula WITH PASSWORD 'postgres';"
- name: Wait until rabbitmq is healthy
run: |
for i in {1..10}; do sudo rabbitmq-diagnostics -q ping && break || sleep 1 ; done
- name: Create kat vhost in rabbitmq
run: |
sudo rabbitmqctl add_user kat rabbit
sudo rabbitmqctl add_vhost kat
sudo rabbitmqctl set_permissions -p "kat" "kat" ".*" ".*" ".*"
- name: Download Bytes artifact
uses: actions/download-artifact@v4
with:
name: kat-bytes_${{ env.RELEASE_VERSION }}_ubuntu.deb
- name: Download Boefjes artifact
uses: actions/download-artifact@v4
with:
name: kat-boefjes_${{ env.RELEASE_VERSION }}_ubuntu.deb
- name: Download Rocky artifact
uses: actions/download-artifact@v4
with:
name: kat-rocky_${{ env.RELEASE_VERSION }}_ubuntu.deb
- name: Download Mula artifact
uses: actions/download-artifact@v4
with:
name: kat-mula_${{ env.RELEASE_VERSION }}_ubuntu.deb
- name: Download Keiko artifact
uses: actions/download-artifact@v4
with:
name: kat-keiko_${{ env.RELEASE_VERSION }}_ubuntu.deb
- name: Download Octopoes artifact
uses: actions/download-artifact@v4
with:
name: kat-octopoes_${{ env.RELEASE_VERSION }}_ubuntu.deb
- name: Get the OpenKAT artifacts
run: |
curl -Ls https://github.com/dekkers/xtdb-http-multinode/releases/download/v1.0.6/xtdb-http-multinode_1.0.6_all.deb --output xtdb-http-multinode_1.0.6_all.deb;
- name: Install the artifacts
run: |
sudo apt install ./kat-*.deb ./xtdb-http-multinode_*_all.deb
- name: Update configs for rabbitmq
run: |
sudo sed -i "s/QUEUE_URI=/QUEUE_URI=amqp:\/\/kat:rabbit@localhost:5672\/kat/g" /etc/kat/mula.conf
sudo sed -i "s/QUEUE_URI=/QUEUE_URI=amqp:\/\/kat:rabbit@localhost:5672\/kat/g" /etc/kat/bytes.conf
sudo sed -i "s/QUEUE_URI=/QUEUE_URI=amqp:\/\/kat:rabbit@localhost:5672\/kat/g" /etc/kat/boefjes.conf
sudo sed -i "s/QUEUE_URI=/QUEUE_URI=amqp:\/\/kat:rabbit@localhost:5672\/kat/g" /etc/kat/octopoes.conf
- name: Migrations for Rocky
run: |
sudo sed -i "s/ROCKY_DB_PASSWORD=/ROCKY_DB_PASSWORD=postgres/g" /etc/kat/rocky.conf
sudo -u kat rocky-cli migrate
sudo -u kat rocky-cli loaddata /usr/share/kat-rocky/OOI_database_seed.json
- name: Migrations for Katalogus
run: |
sudo sed -i "s/KATALOGUS_DB_URI=/KATALOGUS_DB_URI=postgresql:\/\/katalogus:postgres@localhost\/katalogus_db/g" /etc/kat/boefjes.conf
sudo -u kat update-katalogus-db
- name: Migrations for Bytes
run: |
sudo sed -i "s/BYTES_DB_URI=/BYTES_DB_URI=postgresql:\/\/bytes:postgres@localhost\/bytes_db/g" /etc/kat/bytes.conf
sudo -u kat update-bytes-db
- name: Migrations for Mula
run: |
sudo sed -i "s/SCHEDULER_DB_URI=/SCHEDULER_DB_URI=postgresql:\/\/mula:postgres@localhost\/mula_db/g" /etc/kat/mula.conf
sudo -u kat update-mula-db
- name: Setup Bytes credentials
run: |
sudo sed -i "s/BYTES_PASSWORD=\$/BYTES_PASSWORD=$(sudo grep BYTES_PASSWORD /etc/kat/bytes.conf | awk -F'=' '{ print $2 }')/" /etc/kat/rocky.conf
sudo sed -i "s/BYTES_PASSWORD=\$/BYTES_PASSWORD=$(sudo grep BYTES_PASSWORD /etc/kat/bytes.conf | awk -F'=' '{ print $2 }')/" /etc/kat/boefjes.conf
sudo sed -i "s/BYTES_PASSWORD=\$/BYTES_PASSWORD=$(sudo grep BYTES_PASSWORD /etc/kat/bytes.conf | awk -F'=' '{ print $2 }')/" /etc/kat/mula.conf
- name: Restart KAT
run: sudo systemctl restart kat-rocky kat-rocky-worker kat-mula kat-bytes kat-boefjes kat-normalizers kat-katalogus kat-keiko kat-octopoes kat-octopoes-worker
- name: Setup accounts in Rocky
run: |
DJANGO_SUPERUSER_PASSWORD=robotpassword sudo -E -u kat rocky-cli createsuperuser --noinput --email robot@localhost --full_name "Mr. Robot"
sudo -u kat rocky-cli setup_dev_account
- name: Check Keiko API health or print response and logs
run: |
for i in {1..15}; do curl -s http://localhost:8005/health | jq .healthy | grep true -q && s=0 && break || s=$? && sleep 1 ; done
if [ $s != 0 ]; then echo $(curl -v http://localhost:8005/health) || true && journalctl --no-pager -u kat-keiko.service && exit $s ; fi
- name: Check Bytes API health or print response and logs
run: |
for i in {1..15}; do curl -s http://localhost:8002/health | jq .healthy | grep true -q && s=0 && break || s=$? && sleep 1 ; done
if [ $s != 0 ]; then echo $(curl -v http://localhost:8002/health) || true && journalctl --no-pager -u kat-bytes.service && exit $s ; fi
- name: Check Katalogus API health or print response and logs
run: |
for i in {1..15}; do curl -s http://localhost:8003/health | jq .healthy | grep true -q && s=0 && break || s=$? && sleep 1 ; done
if [ $s != 0 ]; then echo $(curl -v http://localhost:8003/health) || true && journalctl --no-pager -u kat-katalogus.service && exit $s ; fi
- name: Check Scheduler API health or print response and logs
run: |
for i in {1..15}; do curl -s http://localhost:8004/health | jq .healthy | grep true -q && s=0 && break || s=$? && sleep 1 ; done
if [ $s != 0 ]; then echo $(curl -v http://localhost:8004/health) || true && journalctl --no-pager -u kat-mula.service && exit $s ; fi
- name: Check XTDB health or print response and logs
run: |
for i in {1..30}; do curl -s -H "Accept: application/edn" http://localhost:3000/_dev/_xtdb/test/status && s=0 && break || s=$? && sleep 1 ; done
if [ $s != 0 ]; then echo $(curl -s -H "Accept: application/edn" http://localhost:3000/_dev/_xtdb/test/status) || true && journalctl --no-pager -u xtdb-http-multinode.service && exit $s ; fi
- name: Create _dev node in Octopoes
run: curl -s -X POST http://localhost:8001/_dev/node
- name: Check Octopoes API health or print response and logs
run: |
for i in {1..15}; do curl -s http://localhost:8001/_dev/health | jq .healthy | grep true -q && s=0 && break || s=$? && sleep 1 ; done
if [ $s != 0 ]; then echo $(curl -v http://localhost:8001/_dev/health) || true && journalctl --no-pager -u kat-octopoes.service && exit $s ; fi
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: pip
- name: Install Robot Framework
run: pip3 install robotframework robotframework-browser robotframework-debuglibrary robotframework-otp robotframework-postgresqldb pyotp
- name: Initialize rfbrowser
run: rfbrowser init
- name: Run Robot Full Onboarding Flow
run: robot -d rocky/tests/robot/results-ci -v headless:true rocky/tests/robot/ci
- name: Upload Robot Framework reports
uses: actions/upload-artifact@v4
if: always()
with:
name: rf-results-ci
path: /home/runner/work/nl-kat-coordination/nl-kat-coordination/rocky/tests/robot/results*