-
Notifications
You must be signed in to change notification settings - Fork 8
405 lines (335 loc) · 14 KB
/
tests.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
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
name: Tests
on:
push:
branches:
- main
pull_request:
jobs:
black:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry
- uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'poetry'
cache-dependency-path: './poetry.lock'
architecture: x64
- name: Install poetry dependencies
run: poetry install
- name: Check format/
run: |
poetry run poe format-src --check --verbose
poetry run poe format-tests --check --verbose
poetry run poe format-e2e --check --verbose
poetry run poe format-installer --check --verbose
pylint:
needs: black
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install poetry
run: pipx install poetry
- uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'poetry'
cache-dependency-path: './poetry.lock'
architecture: x64
- name: Install poetry dependencies
run: poetry install
- name: Lint src/
run: poetry run poe lint
# from xPsycHoWasPx in discord chat:
# "running macOS in none gpu accelerated mode, and that means no OpenGL,
# no OpenGL no kivy window…. if u need to use vm, you also need a dedicated
# seperate supported GPU passed through to the osx VM .."
#
# TODO: find how to install properly libs for M1/M2 Macs
# they raise exceptions that numpy and others libs
# arent compiled for arm64 (macos-14 and macos-xlarge-*)
pytest:
needs: pylint
strategy:
matrix:
include:
- os: ubuntu-latest
arch: x64
- os: windows-latest
arch: x64
- os: macos-13
arch: x64
- os: macos-14
arch: arm64
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install poetry
run: pipx install poetry
- uses: actions/setup-python@v5
if: ${{ matrix.arch != 'arm64' }}
with:
python-version: '3.12'
cache: 'poetry'
cache-dependency-path: './poetry.lock'
architecture: ${{ matrix.arch }}
- uses: actions/setup-python@v5
if: ${{ matrix.arch == 'arm64' }}
with:
python-version: '3.12'
- name: Install project and its dependencies
run: poetry install
- name: Run tests with coverage (Linux)
if: ${{ runner.os == 'Linux' }}
uses: coactions/setup-xvfb@6b00cf1889f4e1d5a48635647013c0508128ee1a
with:
run: |
poetry add pytest-xvfb
poetry run poe coverage
- name: Upload coverage reports to Codecov with GitHub Action
uses: codecov/codecov-action@v4
if: ${{ runner.os == 'Linux' }}
with:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
- name: Run tests (MacOS)
if: ${{ runner.os == 'macOS' }}
run: poetry run poe test-unit
- name: Run tests (Windows)
if: ${{ runner.os == 'Windows' }}
env:
KIVY_GL_BACKEND: 'angle_sdl2'
run: poetry run poe test
#- name: Run tests (MacOS)
# if: ${{ runner.os == 'macOS' }}
# env:
# KIVY_GL_DEBUG: 1
# KIVY_GL_BACKEND: 'gl'
# run: poetry run poe test
build:
needs: pytest
strategy:
matrix:
include:
- os: ubuntu-latest
arch: x64
- os: windows-latest
arch: x64
- os: macos-13
arch: x64
- os: macos-14
arch: arm64
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install poetry
run: pipx install poetry
- uses: actions/setup-python@v5
if: ${{ matrix.arch != 'arm64' }}
with:
python-version: '3.12'
cache: 'poetry'
cache-dependency-path: './poetry.lock'
architecture: ${{ matrix.arch }}
- uses: actions/setup-python@v5
if: ${{ matrix.arch == 'arm64' }}
with:
python-version: '3.12'
- name: Setup (Linux)
if: ${{ runner.os == 'Linux' }}
id: setup-linux
run: |
sudo apt-get install tree rpm
mkdir -p ./release
NAME="$(poetry run python -c 'from src.utils.constants import get_name; print(get_name())')"
VERSION="$(poetry run python -c 'from src.utils.constants import get_version; print(get_version())')"
DESCRIPTION="$(poetry run python -c 'from src.utils.constants import get_description; print(get_description())')"
echo "name=${NAME}" >> $GITHUB_OUTPUT
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "description=${DESCRIPTION}" >> $GITHUB_OUTPUT
- name: Setup (MacOS)
if: ${{ runner.os == 'macOS' }}
id: setup-macos
run: |
brew install create-dmg
brew reinstall openssl@3
brew unlink openssl@3 && brew link openssl@3
#OPENSSL_MAJOR_VERSION=`$(which openssl) -version | awk '{ print $2}' | cut -d . -f1`
OPENSSL_FULL_VERSION=`$(which openssl) -version | awk '{ print $2}'`
OPENSSL_PATH="/opt/homebrew/Cellar/openssl@3/${OPENSSL_FULL_VERSION}"
echo "dyld-path=${OPENSSL_PATH}/lib" >> $GITHUB_OUTPUT
- name: Install project and its dependencies
run: poetry install
- name: Patch pyinstaller_hook for kivy in Unix
if: ${{ runner.os == 'Linux' || runner.os == 'macOS' }}
run: poetry run poe patch-nix
- name: Patch pyinstaller_hook for kivy in Windows
if: ${{ runner.os == 'Windows' }}
run: poetry run poe patch-win
- name: Build dist (Linux)
if: ${{ runner.os == 'Linux' }}
uses: coactions/setup-xvfb@90473c3ebc69533a1a6e0505c36511b69c8c3135
with:
run: |
poetry add pytest-xvfb
poetry run python .ci/create-spec.py
poetry run python -m PyInstaller krux-installer.spec
- name: Build dist (MacOS)
if: ${{ runner.os == 'macOS' }}
env:
DYLD_LIBRARY_PATH: ${{ steps.setup-macos.outputs.dyld-path }}
run: |
poetry run poe clean-mac
poetry run python .ci/create-spec.py
poetry run python -m PyInstaller krux-installer.spec
- name: Build dist (Windows)
if: ${{ runner.os == 'Windows' }}
env:
KIVY_GL_BACKEND: 'angle_sdl2'
run: |
poetry run python .ci/create-spec.py
.\.ci\edit-spec.ps1
poetry run python -m PyInstaller krux-installer.spec
- name: Build release deb (Linux)
if: ${{ runner.os == 'Linux' }}
id: release-deb
env:
NAME: ${{ steps.setup-linux.outputs.name }}
VERSION: ${{ steps.setup-linux.outputs.version }}
DESCRIPTION: ${{ steps.setup-linux.outputs.description }}
run: |
sh .ci/create-deb.sh \
-a "${NAME}" \
-o ./release \
-v $VERSION \
-A amd64 \
-m qlrd \
-e [email protected] \
-d "${DESCRIPTION}" \
-b "./dist/${NAME}" \
-i ./assets/icon.png
tree ./release
echo "build-path=$(pwd)/release" >> $GITHUB_OUTPUT
echo "pkg=${NAME}_${VERSION}_amd64.deb" >> $GITHUB_OUTPUT
- name: Build release rpm (Linux)
if: ${{ runner.os == 'Linux' }}
id: release-rpm
env:
NAME: ${{ steps.setup-linux.outputs.name }}
VERSION: ${{ steps.setup-linux.outputs.version }}
DESCRIPTION: ${{ steps.setup-linux.outputs.description }}
run: |
RPM_VERSION=$(sed -e 's/-/_/g' <<< $VERSION)
sh .ci/create-rpm.sh \
-a "${NAME}" \
-v $RPM_VERSION \
-m qlrd \
-e [email protected] \
-d "${DESCRIPTION}" \
-c ./CHANGELOG.md \
-r ./README.md \
-b "./dist/${NAME}" \
-i ./assets/icon.png
tree ./release
rpmbuild -vv -bb --define "_bindir /usr/local/bin" $HOME/rpmbuild/SPECS/$NAME.spec
cp $HOME/rpmbuild/RPMS/x86_64/${NAME}-${RPM_VERSION}-1.x86_64.rpm ./release/${NAME}-${RPM_VERSION}-1.x86_64.rpm4
echo "build-path=${HOME}/rpmbuild/RPMS/x86_64" >> $GITHUB_OUTPUT
echo "pkg=${NAME}-${RPM_VERSION}-1.x86_64.rpm" >> $GITHUB_OUTPUT
- name: Build release dmg (MacOS)
if: ${{ runner.os == 'macOS' }}
id: release-macos
run: |
NAME="$(poetry run python -c 'from src.utils.constants import get_name; print(get_name())')"
VER="$(poetry run python -c 'from src.utils.constants import get_version; print(get_version())')"
ARCH="$(uname -m)"
mkdir -p ./release
create-dmg --volname "${NAME}" --volicon ./assets/icon.icns --window-pos 200 120 --window-size 800 400 --icon-size 100 --icon "${NAME}.app" 200 190 --app-drop-link 600 185 "./release/${NAME}_${VER}_${ARCH}.dmg" "./dist/${NAME}.app"
echo "build-path=$(pwd)/release" >> $GITHUB_OUTPUT
echo "pkg=${NAME}_${VER}_${ARCH}.dmg" >> $GITHUB_OUTPUT
- name: Build release NSIS (Windows)
if: ${{ runner.os == 'Windows' }}
id: release-windows
shell: pwsh
run: |
choco --yes install nsis
New-Item ".\release" -Type Directory
$name = poetry run python -c 'from src.utils.constants import get_name; print(get_name())'
$version = poetry run python -c 'from src.utils.constants import get_version; print(get_version())'
$description = poetry run python -c 'from src.utils.constants import get_description; print(get_description())'
poetry run python .ci/create-nsis.py -a $name -b .\dist\krux-installer.exe -o selfcustody -V $version -d "$description" -l .\LICENSE -i .\assets\icon.ico -O .
makensis.exe .\krux-installer.nsi
Move-Item -Path ".\krux-installer Setup.exe" -Destination ".\release\krux-installer_v$version Setup.exe"
echo "build-path=$pwd\release" | Out-File -FilePath $Env:GITHUB_OUTPUT -Encoding utf8 -Append
echo "pkg=krux-installer_v$version Setup.exe" | Out-File -FilePath $Env:GITHUB_OUTPUT -Encoding utf8 -Append
- name: Hash (Linux deb)
if: ${{ runner.os == 'Linux' }}
uses: qlrd/sha256sum-action@v3
id: hash-deb
with:
working-directory: ${{ steps.release-deb.outputs.build-path }}
file: ${{ steps.release-deb.outputs.pkg }}
ext: 'sha256.txt'
- name: Hash (Linux rpm)
if: ${{ runner.os == 'Linux' }}
uses: qlrd/sha256sum-action@v3
id: hash-rpm
with:
working-directory: ${{ steps.release-rpm.outputs.build-path }}
file: ${{ steps.release-rpm.outputs.pkg }}
ext: 'sha256.txt'
- name: Hash (MacOS)
if: ${{ runner.os == 'macOS' }}
uses: qlrd/sha256sum-action@v3
id: hash-macos
with:
working-directory: ${{ steps.release-macos.outputs.build-path }}
file: ${{ steps.release-macos.outputs.pkg }}
ext: 'sha256.txt'
- name: Hash (Windows)
if: ${{ runner.os == 'Windows' }}
uses: qlrd/sha256sum-action@v3
id: hash-win
with:
working-directory: ${{ steps.release-windows.outputs.build-path }}
file: ${{ steps.release-windows.outputs.pkg }}
ext: 'sha256.txt'
- name: Upload artifact deb (Linux)
if: ${{ runner.os == 'Linux' }}
uses: actions/upload-artifact@v4
with:
name: ${{ steps.release-deb.outputs.pkg }}
path: |
${{ steps.release-deb.outputs.build-path}}/${{ steps.release-deb.outputs.pkg }}
${{ steps.release-deb.outputs.build-path}}/${{ steps.release-deb.outputs.pkg }}.sha256.txt
- name: Upload artifact rpm (Linux)
if: ${{ runner.os == 'Linux' }}
uses: actions/upload-artifact@v4
with:
name: ${{ steps.release-rpm.outputs.pkg }}
path: |
${{ steps.release-rpm.outputs.build-path}}/${{ steps.release-rpm.outputs.pkg }}
${{ steps.release-rpm.outputs.build-path}}/${{ steps.release-rpm.outputs.pkg }}.sha256.txt
- name: Upload artifacts (MacOS)
if: ${{ runner.os == 'macOS' }}
uses: actions/upload-artifact@v4
with:
name: ${{ steps.release-macos.outputs.pkg }}
path: |
${{ steps.release-macos.outputs.build-path}}/${{ steps.release-macos.outputs.pkg }}
${{ steps.release-macos.outputs.build-path}}/${{ steps.release-macos.outputs.pkg }}.sha256.txt
- name: Upload artifacts (Windows)
if: ${{ runner.os == 'Windows' }}
uses: actions/upload-artifact@v4
with:
name: ${{ steps.release-windows.outputs.pkg }}
path: |
${{ steps.release-windows.outputs.build-path}}/${{ steps.release-windows.outputs.pkg }}
${{ steps.release-windows.outputs.build-path}}/${{ steps.release-windows.outputs.pkg }}.sha256.txt