-
Notifications
You must be signed in to change notification settings - Fork 58
302 lines (233 loc) · 12.1 KB
/
build-rdo-package.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
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
name: Build RDO packages
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
on:
push:
tags:
- v*
workflow_dispatch:
env:
PKGDIR: /home/runner/work/nl-kat-coordination
jobs:
build:
runs-on: ubuntu-22.04
strategy:
matrix:
python_version: ["3.10", "3.11"]
# Generic bits
steps:
- name: Prep Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python_version }}
cache: "pip"
- name: Prep Install requirements
run: sudo apt install gettext -y
- name: Prep Replace version number with release version
run: find . -type f -name 'version.py' -exec sed -ibak "s/__version__ = .*/__version__ = \"${RELEASE_VERSION}\"/" {} \;
- name: Prep Configure git
run: git config --global url."https://github.com/".insteadOf "ssh://[email protected]/"
# Octopoes
- name: Octopoes Create /var/lib/html
run: sudo rm -rfv /var/lib/html; sudo mkdir -p /var/www/html ; sudo chown `id -u`:`id -g` /var/www/html
- name: Octopoes copy project to run location.
run: cp -rv * /var/www/html
working-directory: ./octopoes
- name: Octopoes Build whl package
run: |
python${{ matrix.python_version }} -m pip install build
python${{ matrix.python_version }} -m build
working-directory: ./octopoes
- name: Octopoes Create env
run: python${{ matrix.python_version }} -m venv /var/www/html/.venv
- name: Octopoes Install requirements
run: cd /var/www/html; source .venv/bin/activate; pip install --upgrade pip; pip install --requirement requirements.txt
- name: Octopoes Create venv archive
run: tar -zcvf ${{ env.PKGDIR }}/octopoes_venv_${{ env.RELEASE_VERSION }}_python${{ matrix.python_version }}.tar.gz -C /var/www/html/ .venv
- name: Octopoes Enable production logging config
run: mv prod.logging.yml logging.yml
working-directory: ./octopoes
- name: Octopoes Create Octopoes release
run: tar -cvzf ${{ env.PKGDIR }}/octopoes_${{ env.RELEASE_VERSION }}.tar.gz .
working-directory: ./octopoes
- name: Octopoes Build Octopoes wheel
run: cd octopoes && /usr/bin/python3 setup.py bdist_wheel
- name: Octopoes Cleanup
run: sudo rm -rfv /var/www/html/
# Rocky
- name: Rocky Create /var/lib/html
run: sudo rm -rfv /var/lib/html; sudo mkdir -p /var/www/html ; sudo chown `id -u`:`id -g` /var/www/html
- name: Rocky copy project to run location.
run: cp -rv * /var/www/html
working-directory: ./rocky
- name: Rocky Create env
run: python${{ matrix.python_version }} -m venv /var/www/html/.venv
- name: Rocky Install requirements
run: cd /var/www/html; source .venv/bin/activate; pip install --upgrade pip; grep -v git+https:// requirements.txt | pip install -r /dev/stdin ; grep git+https:// requirements.txt | pip install -r /dev/stdin; pip install ${{ github.workspace }}/octopoes/dist/octopoes*.whl
- name: Rocky Create rocky_venv tarball
run: tar -zcvf ${{ env.PKGDIR }}/rocky_venv_${{ env.RELEASE_VERSION }}_python${{ matrix.python_version }}.tar.gz -C /var/www/html/ .venv
- name: Rocky Run nvm install
run: nvm install v16
shell: bash --login {0}
working-directory: ./rocky
- name: Rocky Run nvm use
run: nvm use
shell: bash --login {0}
working-directory: ./rocky
- name: Rocky Run yarn for rocky
run: yarn
shell: bash --login {0}
working-directory: ./rocky
- name: Rocky Run yarn build for rocky
run: yarn build
shell: bash --login {0}
working-directory: ./rocky
- name: Rocky Compilemessages
run: /var/www/html/.venv/bin/python${{ matrix.python_version }} manage.py collectstatic && /var/www/html/.venv/bin/python${{ matrix.python_version }} manage.py compress && /var/www/html/.venv/bin/python${{ matrix.python_version }} manage.py compilemessages
working-directory: ./rocky
env:
BYTES_API: http://bytes:8000
BYTES_PASSWORD: password
BYTES_USERNAME: username
KATALOGUS_API: http://katalogus:8000
KEIKO_API: http://keiko:8000
OCTOPOES_API: http://octopoes_api:80
SCHEDULER_API: http://scheduler:8000
SECRET_KEY: whatever
- name: Rocky Create rocky release
run: tar -cvzf ${{ env.PKGDIR }}/rocky_${{ env.RELEASE_VERSION }}.tar.gz --exclude node_modules --exclude rocky_venv* --exclude=.git* --exclude .parcel-cache --exclude Dockerfile .
working-directory: ./rocky
# Bytes
- name: Bytes Create /var/lib/html
run: sudo rm -rfv /var/lib/html; sudo mkdir -p /var/www/html ; sudo chown `id -u`:`id -g` /var/www/html
- name: Bytes copy project to run location.
run: cp -rv * /var/www/html
working-directory: ./bytes
- name: Bytes Create env
run: python${{ matrix.python_version }} -m venv /var/www/html/.venv
- name: Bytes Install requirements
run: cd /var/www/html; source .venv/bin/activate; pip install --upgrade pip; pip install --requirement requirements.txt
- name: Bytes Create bytes release
run: tar -cvzf ${{ env.PKGDIR }}/bytes_${{ env.RELEASE_VERSION }}.tar.gz --exclude=./.git* .
working-directory: ./bytes
- name: Bytes Create bytes venv package
run: tar -zcvf ${{ env.PKGDIR }}/bytes_venv_${{ env.RELEASE_VERSION }}_python${{ matrix.python_version }}.tar.gz -C /var/www/html/ .venv
# Mula / Scheduler
- name: Mula Create /var/lib/html
run: sudo rm -rfv /var/lib/html; sudo mkdir -p /var/www/html ; sudo chown `id -u`:`id -g` /var/www/html
- name: Mula copy project to run location.
run: cp -rv * /var/www/html
working-directory: ./mula
- name: Mula Create env
run: python${{ matrix.python_version }} -m venv /var/www/html/.venv
- name: Create scheduler release archive
run: tar -cvzf ${{ env.PKGDIR }}/scheduler_${{ env.RELEASE_VERSION }}.tar.gz --exclude=./.git* --exclude=Makefile --exclude=Dockerfile --exclude=requirements* --exclude=tests .
working-directory: ./mula
- name: Create virtual env
run: python${{ matrix.python_version }} -m venv /var/www/html/.venv
- name: Install requirements
run: source .venv/bin/activate; pip install --upgrade pip; pip install --requirement requirements.txt
working-directory: /var/www/html
- name: Create venv archive
run: tar -zcvf ${{ env.PKGDIR }}/scheduler_venv_${{ env.RELEASE_VERSION }}_python${{ matrix.python_version }}.tar.gz -C /var/www/html/ .venv
# Boefjes
- name: Boefjes Create /var/lib/html
run: sudo rm -rfv /var/lib/html; sudo mkdir -p /var/www/html ; sudo chown `id -u`:`id -g` /var/www/html
- name: Boefjes copy project to run location.
run: cp -rv * /var/www/html
working-directory: ./boefjes
- name: Boefjes Create env
run: python${{ matrix.python_version }} -m venv /var/www/html/.venv
- name: Install requirements
run: source .venv/bin/activate; pip install --upgrade pip; grep -v git+https:// requirements.txt | pip install -r /dev/stdin ; grep git+https:// requirements.txt | pip install -r /dev/stdin; pip install ${{ github.workspace }}/octopoes/dist/octopoes*.whl
working-directory: /var/www/html
- name: Create archive
run: tar -zcvf ${{ env.PKGDIR }}/boefjes_venv_${{ env.RELEASE_VERSION }}_python${{ matrix.python_version }}.tar.gz -C /var/www/html/ .venv
- name: Create boefjes release
run: tar -cvzf ${{ env.PKGDIR }}/boefjes_${{ env.RELEASE_VERSION }}.tar.gz .
working-directory: ./boefjes
# Keiko
- name: Keiko Create /var/lib/html
run: sudo rm -rfv /var/lib/html; sudo mkdir -p /var/www/html ; sudo chown `id -u`:`id -g` /var/www/html
- name: Keiko copy project to run location.
run: cp -rv * /var/www/html
working-directory: ./keiko
- name: Keiko Create env
run: python${{ matrix.python_version }} -m venv /var/www/html/.venv
- name: Keiko Install requirements
run: source .venv/bin/activate; pip install --upgrade pip; find . -name requirements.txt | xargs -L 1 pip install -r
working-directory: /var/www/html
- name: Keiko Create archive
run: tar -zcvf ${{ env.PKGDIR }}/katkeiko_venv_${{ env.RELEASE_VERSION }}_python${{ matrix.python_version }}.tar.gz -C /var/www/html/ .venv
- name: Keiko Create katkeiko release
run: tar -cvzf ${{ env.PKGDIR }}/katkeiko_${{ env.RELEASE_VERSION }}.tar.gz .
working-directory: ./keiko
# Common / Uploads
- name: Octopoes Upload whl package
uses: actions/upload-artifact@v4
with:
name: "octopoes-${{env.RELEASE_VERSION}}"
path: "${{ github.workspace }}/octopoes/dist/octopoes*.whl"
- name: Octopoes Upload venv tar
uses: actions/upload-artifact@v4
with:
name: octopoes_venv_${{ env.RELEASE_VERSION }}_python${{ matrix.python_version }}
path: ${{ env.PKGDIR }}/octopoes_venv_${{ env.RELEASE_VERSION }}_python${{ matrix.python_version }}.tar.gz
- name: Octopoes Upload octopoes tar
uses: actions/upload-artifact@v4
with:
name: octopoes_${{ env.RELEASE_VERSION }}
path: ${{ env.PKGDIR }}/octopoes_${{ env.RELEASE_VERSION }}.tar.gz
- name: Rocky Upload rocky tar
uses: actions/upload-artifact@v4
with:
name: rocky_${{ env.RELEASE_VERSION }}
path: ${{ env.PKGDIR }}/rocky_${{ env.RELEASE_VERSION }}.tar.gz
- name: Rocky Upload venv tar
uses: actions/upload-artifact@v4
with:
name: rocky_venv_${{ env.RELEASE_VERSION }}_python${{ matrix.python_version }}
path: ${{ env.PKGDIR }}/rocky_venv_${{ env.RELEASE_VERSION }}_python${{ matrix.python_version }}.tar.gz
- name: Bytes Upload bytes tar
uses: actions/upload-artifact@v4
with:
name: bytes_${{ env.RELEASE_VERSION }}
path: ${{ env.PKGDIR }}/bytes_${{ env.RELEASE_VERSION }}.tar.gz
- name: Bytes Upload bytes venv tar
uses: actions/upload-artifact@v4
with:
name: bytes_venv_${{ env.RELEASE_VERSION }}_python${{ matrix.python_version }}
path: ${{ env.PKGDIR }}/bytes_venv_${{ env.RELEASE_VERSION }}_python${{ matrix.python_version }}.tar.gz
- name: Upload scheduler release
uses: actions/upload-artifact@v4
with:
name: scheduler_${{ env.RELEASE_VERSION }}
path: ${{ env.PKGDIR }}/scheduler_${{ env.RELEASE_VERSION }}.tar.gz
- name: Upload venv archive
uses: actions/upload-artifact@v4
with:
name: scheduler_venv_${{ env.RELEASE_VERSION }}_python${{ matrix.python_version }}
path: ${{ env.PKGDIR }}/scheduler_venv_${{ env.RELEASE_VERSION }}_python${{ matrix.python_version }}.tar.gz
- name: Upload boefjes tar
uses: actions/upload-artifact@v4
with:
name: boefjes_${{ env.RELEASE_VERSION }}
path: ${{ env.PKGDIR }}/boefjes_${{ env.RELEASE_VERSION }}.tar.gz
- name: Upload venv tar
uses: actions/upload-artifact@v4
with:
name: boefjes_venv_${{ env.RELEASE_VERSION }}_python${{ matrix.python_version }}
path: ${{ env.PKGDIR }}/boefjes_venv_${{ env.RELEASE_VERSION }}_python${{ matrix.python_version }}.tar.gz
- name: Keiko Upload tar
uses: actions/upload-artifact@v4
with:
name: katkeiko_${{ env.RELEASE_VERSION }}
path: ${{ env.PKGDIR }}/katkeiko_${{ env.RELEASE_VERSION }}.tar.gz
- name: Keiko Upload venv tar
uses: actions/upload-artifact@v4
with:
name: katkeiko_venv_${{ env.RELEASE_VERSION }}_python${{ matrix.python_version }}
path: ${{ env.PKGDIR }}/katkeiko_venv_${{ env.RELEASE_VERSION }}_python${{ matrix.python_version }}.tar.gz