-
Notifications
You must be signed in to change notification settings - Fork 8
248 lines (217 loc) · 9.54 KB
/
build.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
name: Build
on:
workflow_run:
workflows: Tests
types: completed
branches:
- main
- '!develop'
jobs:
build:
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 }}
if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.head_branch == 'main' }}
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: Build dist (Linux)
if: ${{ runner.os == 'Linux' }}
uses: coactions/setup-xvfb@6b00cf1889f4e1d5a48635647013c0508128ee1a
with:
run: |
poetry add pytest-xvfb
poetry run poe build-linux
- name: Build dist (MacOS)
if: ${{ runner.os == 'macOS' }}
env:
DYLD_LIBRARY_PATH: ${{ steps.setup-macos.outputs.dyld-path }}
run: poetry run poe build-macos
- name: Build dist (Windows)
if: ${{ runner.os == 'Windows' }}
env:
KIVY_GL_BACKEND: 'angle_sdl2'
run: poetry run poe build-win
- 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