-
Notifications
You must be signed in to change notification settings - Fork 135
606 lines (523 loc) · 21.7 KB
/
main.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
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
#
# Copyright (C) 2024 Badabing2005
# SPDX-License-Identifier: AGPL-3.0-or-later
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option) any
# later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
# for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
# Also add information on how to contact you by electronic and paper mail.
#
# If your software can interact with users remotely through a computer network,
# you should also make sure that it provides a way for users to get its source.
# For example, if your program is a web application, its interface could
# display a "Source" link that leads users to an archive of the code. There are
# many ways you could offer source, and different solutions will be better for
# different programs; see section 13 for the specific requirements.
#
# You should also get your employer (if you work as a programmer) or school, if
# any, to sign a "copyright disclaimer" for the program, if necessary. For more
# information on this, and how to apply and follow the GNU AGPL, see
# <https://www.gnu.org/licenses/>.
name: Build for All platforms
env:
ACTIONS_RUNTIME_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Controls when the workflow will run
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
inputs:
tags:
description: 'Build tags'
jobs:
# ---------------------------------------------------------------------------
# build_windows
# ---------------------------------------------------------------------------
build_windows:
if: github.actor == 'badabing2005'
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Create virtual environment
run: python -m venv myenv
shell: powershell
- name: Activate virtual environment
run: .\myenv\Scripts\Activate.ps1
shell: powershell
- name: Install wxPython and build
run: |
python --version
pip install -U six wheel setuptools
pip install -U -f https://extras.wxpython.org/wxPython4/extras/4.2.2 wxPython
shell: powershell
- name: Install requirements
run: pip install -r requirements.txt
- name: List modules and their versions
run: pip freeze
- name: Build application
run: .\build.bat
- name: List contents of dist directory
run: ls dist
- name: Sign Windows Executable
uses: skymatic/code-sign-action@v3
with:
certificate: '${{ secrets.CERTIFICATE }}'
password: '${{ secrets.CERT_PASSWORD }}'
certificatesha1: '${{ secrets.CERTHASH }}'
certificatename: '${{ secrets.CERTNAME }}'
description: 'PixelFlasher'
timestampUrl: 'http://timestamp.digicert.com'
folder: 'dist'
recursive: false
- name: Get sha256
run: |
certutil -hashfile dist/PixelFlasher.exe SHA256 > dist/PixelFlasher.exe.sha256
cat dist/PixelFlasher.exe.sha256
- name: List contents of dist directory again
run: ls dist
# Upload artifacts Windows
- name: Upload Windows Artifact
uses: actions/upload-artifact@v4
id: upload_artifacts_windows
with:
name: PixelFlasher.exe Artifacts
path: |
dist/PixelFlasher.exe
dist/PixelFlasher.exe.sha256
# ---------------------------------------------------------------------------
# build_windows_2019
# ---------------------------------------------------------------------------
build_windows_2019:
if: github.actor == 'badabing2005'
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners
runs-on: windows-2019
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.8'
- name: Create virtual environment
run: python -m venv myenv
shell: powershell
- name: Activate virtual environment
run: .\myenv\Scripts\Activate.ps1
shell: powershell
- name: Install wxPython and build
run: |
python --version
pip install -U six wheel setuptools
pip install -U -f https://extras.wxpython.org/wxPython4/extras/4.2.2 wxPython
shell: powershell
- name: Install requirements
run: pip install -r requirements.txt
- name: List modules and their versions
run: pip freeze
- name: Build application
run: .\build.bat
- name: Rename the file
run: mv dist/PixelFlasher.exe dist/PixelFlasher_Win_2019.exe
- name: List contents of dist directory
run: ls dist
- name: Sign Windows Executable
uses: skymatic/code-sign-action@v3
with:
certificate: '${{ secrets.CERTIFICATE }}'
password: '${{ secrets.CERT_PASSWORD }}'
certificatesha1: '${{ secrets.CERTHASH }}'
certificatename: '${{ secrets.CERTNAME }}'
description: 'PixelFlasher'
timestampUrl: 'http://timestamp.digicert.com'
folder: 'dist'
recursive: false
- name: Get sha256
run: |
certutil -hashfile dist/PixelFlasher_Win_2019.exe SHA256 > dist/PixelFlasher_Win_2019.exe.sha256
cat dist/PixelFlasher_Win_2019.exe.sha256
- name: List contents of dist directory again
run: ls dist
# Upload artifacts Windows 2019
- name: Upload Windows 2019 Artifact
uses: actions/upload-artifact@v4
id: upload_artifacts_windows_2019
with:
name: PixelFlasher_Win_2019.exe Artifacts
path: |
dist/PixelFlasher_Win_2019.exe
dist/PixelFlasher_Win_2019.exe.sha256
# ---------------------------------------------------------------------------
# build_ubuntu_20_04
# ---------------------------------------------------------------------------
build_ubuntu_20_04:
if: github.actor == 'badabing2005'
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
run: |
sudo apt update
sudo apt install software-properties-common -y
sudo add-apt-repository ppa:deadsnakes/ppa -y
sudo apt update
sudo apt install -y python3.13
sudo apt install -y python3.13-venv
sudo apt install -y python3-pip
python3.13 --version
- name: Install wxPython prerequisites
run: |
sudo apt-get update
sudo apt-get install -y python3.13-dev
sudo apt-get install -y libgtk-3-dev
sudo apt-get install -y libunwind-dev
sudo apt-get install -y libgstreamer1.0-dev
sudo apt-get install -y gstreamer1.0-plugins-base
sudo apt-get install -y freeglut3-dev
sudo apt-get install -y libwebkit2gtk-4.0-dev
sudo apt-get install -y libjpeg-dev
sudo apt-get install -y libpng-dev
sudo apt-get install -y libtiff-dev
sudo apt-get install -y libsdl2-dev
sudo apt-get install -y libnotify-dev
sudo apt-get install -y libsm-dev
- name: Create virtual environment, install dependencies, and build
run: |
python3.13 -m venv myenv
. myenv/bin/activate
python --version
pip install -U pip
pip install -U six wheel setuptools
# Try wxPython 4.2.2 wheel, then 4.2.1 wheel, finally fallback to source if both fail
pip install --only-binary wxPython -U -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-20.04 wxPython==4.2.2 || \
pip install --only-binary wxPython -U -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-20.04 wxPython==4.2.1 || \
pip install -U -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-20.04 wxPython
pip install -r requirements.txt
python --version && pip freeze
./build.sh
mv dist/PixelFlasher dist/PixelFlasher_Ubuntu_20_04
sha256sum dist/PixelFlasher_Ubuntu_20_04 > dist/PixelFlasher_Ubuntu_20_04.sha256
cat dist/PixelFlasher_Ubuntu_20_04.sha256
ls dist
shell: bash
# Upload artifacts Ubuntu 20.04
- name: Upload Ubuntu 20.04 Artifact
uses: actions/upload-artifact@v4
id: upload_artifacts_ubuntu_20_04
with:
name: PixelFlasher_Ubuntu_20_04 Artifacts
path: |
dist/PixelFlasher_Ubuntu_20_04
dist/PixelFlasher_Ubuntu_20_04.sha256
# ---------------------------------------------------------------------------
# build_ubuntu_22_04
# ---------------------------------------------------------------------------
build_ubuntu_22_04:
if: github.actor == 'badabing2005'
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
run: |
sudo apt update
sudo apt install software-properties-common -y
sudo add-apt-repository ppa:deadsnakes/ppa -y
sudo apt update
sudo apt install -y python3.13
sudo apt install -y python3.13-venv
sudo apt install -y python3-pip
python3.13 --version
- name: Install wxPython prerequisites
run: |
sudo apt-get update
sudo apt-get install -y python3.13-dev
sudo apt-get install -y libgtk-3-dev
sudo apt-get install -y libunwind-dev
sudo apt-get install -y libgstreamer1.0-dev
sudo apt-get install -y gstreamer1.0-plugins-base
sudo apt-get install -y freeglut3-dev
sudo apt-get install -y libwebkit2gtk-4.0-dev
sudo apt-get install -y libjpeg-dev
sudo apt-get install -y libpng-dev
sudo apt-get install -y libtiff-dev
sudo apt-get install -y libsdl2-dev
sudo apt-get install -y libnotify-dev
sudo apt-get install -y libsm-dev
- name: Create virtual environment, install dependencies, and build
run: |
python3.13 -m venv myenv
. myenv/bin/activate
python --version
pip install -U pip
pip install -U six wheel setuptools
# Try wxPython 4.2.2 wheel, then 4.2.1 wheel, finally fallback to source if both fail
pip install --only-binary wxPython -U -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-22.04 wxPython==4.2.2 || \
pip install --only-binary wxPython -U -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-22.04 wxPython==4.2.1 || \
pip install -U -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-22.04 wxPython
pip install -r requirements.txt
python --version && pip freeze
./build.sh
mv dist/PixelFlasher dist/PixelFlasher_Ubuntu_22_04
sha256sum dist/PixelFlasher_Ubuntu_22_04 > dist/PixelFlasher_Ubuntu_22_04.sha256
cat dist/PixelFlasher_Ubuntu_22_04.sha256
ls dist
shell: bash
# Upload artifacts Ubuntu 22.04
- name: Upload Ubuntu 22.04 Artifact
uses: actions/upload-artifact@v4
id: upload_artifacts_ubuntu_22_04
with:
name: PixelFlasher_Ubuntu_22_04 Artifacts
path: |
dist/PixelFlasher_Ubuntu_22_04
dist/PixelFlasher_Ubuntu_22_04.sha256
# ---------------------------------------------------------------------------
# build_ubuntu_24_04
# ---------------------------------------------------------------------------
build_ubuntu_24_04:
if: github.actor == 'badabing2005'
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
run: |
sudo apt update
sudo apt install software-properties-common -y
sudo add-apt-repository ppa:deadsnakes/ppa -y
sudo apt update
sudo apt install -y python3.13
sudo apt install -y python3.13-venv
sudo apt install -y python3-pip
python3.13 --version
- name: Install wxPython prerequisites
run: |
sudo apt-get update
sudo apt-get install -y python3.13-dev
sudo apt-get install -y libgtk-3-dev
sudo apt-get install -y libunwind-dev
sudo apt-get install -y libgstreamer1.0-dev
sudo apt-get install -y gstreamer1.0-plugins-base
sudo apt-get install -y freeglut3-dev
sudo apt-get install -y libjpeg-dev
sudo apt-get install -y libpng-dev
sudo apt-get install -y libtiff-dev
sudo apt-get install -y libsdl2-dev
sudo apt-get install -y libnotify-dev
sudo apt-get install -y libsm-dev
sudo add-apt-repository universe
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev
- name: Create virtual environment, install dependencies, and build
run: |
python3.13 -m venv myenv
. myenv/bin/activate
python --version
pip install -U pip
pip install -U six wheel setuptools
# Try wxPython 4.2.2 wheel, then 4.2.1 wheel, finally fallback to source if both fail
pip install --only-binary wxPython -U -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-24.04 wxPython==4.2.2 || \
pip install --only-binary wxPython -U -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-24.04 wxPython==4.2.1 || \
pip install -U -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-24.04 wxPython
pip install -r requirements.txt
python --version && pip freeze
./build.sh
mv dist/PixelFlasher dist/PixelFlasher_Ubuntu_24_04
sha256sum dist/PixelFlasher_Ubuntu_24_04 > dist/PixelFlasher_Ubuntu_24_04.sha256
cat dist/PixelFlasher_Ubuntu_24_04.sha256
ls dist
shell: bash
# Upload artifacts Ubuntu 24.04 to Actions
- name: Upload Ubuntu 24.04 Artifact
uses: actions/upload-artifact@v4
id: upload_artifacts_ubuntu_24_04
with:
name: PixelFlasher_Ubuntu_24_04 Artifacts
path: |
dist/PixelFlasher_Ubuntu_24_04
dist/PixelFlasher_Ubuntu_24_04.sha256
# ---------------------------------------------------------------------------
# build_mac_13
# ---------------------------------------------------------------------------
build_mac_13:
if: github.actor == 'badabing2005'
# runs-on: macos-latest
runs-on: macos-13
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: List Cellar directory
run: |
ls /usr/local/Cellar
- name: Set up Python 3.13
uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Install wxPython
# run: brew install wxpython
run: pip install wxPython
- name: Install node
run: |
brew install node
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
# - name: Install GraphicsMagick
# run: |
# brew install graphicsmagick
- name: Install ImageMagick
run: |
curl -O https://imagemagick.org/archive/binaries/ImageMagick-x86_64-apple-darwin20.1.0.tar.gz
tar -xzf ImageMagick-x86_64-apple-darwin20.1.0.tar.gz
echo "MAGICK_HOME=$(pwd)/ImageMagick-7.0.10" >> $GITHUB_ENV
echo "DYLD_LIBRARY_PATH=$(pwd)/ImageMagick-7.0.10/lib/" >> $GITHUB_ENV
echo "PATH=$(pwd)/ImageMagick-7.0.10/bin:$PATH" >> $GITHUB_ENV
echo "MAGICK_HOME = ${{env.MAGICK_HOME}}"
echo "DYLD_LIBRARY_PATH = ${{env.DYLD_LIBRARY_PATH}}"
echo "PATH = ${{env.PATH}}"
ls -l ${{env.MAGICK_HOME}}/bin/
- name: Install wxPython
# run: brew install wxpython
run: pip install wxPython
- name: Install create-dmg
run: |
npm cache clean --force
npm install --global create-dmg
# Check if 'util.isDate' is patched
if grep -q "util.isDate" "$(npm root -g)/create-dmg/node_modules/macos-alias/lib/encode.js"; then
echo "Patching util.isDate..."
sed -i.bak "s/util.isDate/((val) => Object.prototype.toString.call(val) === '[object Date]')/g" \
"$(npm root -g)/create-dmg/node_modules/macos-alias/lib/encode.js"
fi
- name: Add Python 3.13 to PATH
run: export PATH=/usr/local/Cellar/[email protected]/bin:$PATH
- name: Create virtual environment
run: python3.13 -m venv myenv
shell: bash
- name: Activate virtual environment
run: source myenv/bin/activate
shell: bash
- name: Install requirements
run: python3.13 -m pip install -r requirements.txt
- name: List modules and their versions
run: python3.13 -m pip freeze
- name: Build application
id: build_app
run: ./build.sh
- name: Upload PixelFlasher.app as artifact
uses: actions/upload-artifact@v4
with:
name: PixelFlasher.app
path: dist/PixelFlasher.app
- name: Get sha256
run: |
shasum -a 256 dist/PixelFlasher.dmg > dist/PixelFlasher.dmg.sha256
cat dist/PixelFlasher.dmg.sha256
- name: List contents of dist directory
run: ls ./ dist/
# Upload artifacts Mac-OS 13
- name: Upload Mac-OS 13 Artifact
uses: actions/upload-artifact@v4
id: upload_artifact_macos_13
with:
name: PixelFlasher.dmg Artifacts
path: |
dist/PixelFlasher.dmg
dist/PixelFlasher.dmg.sha256
# ---------------------------------------------------------------------------
# deploy
# ---------------------------------------------------------------------------
deploy:
if: github.actor == 'badabing2005'
needs: [build_windows, build_windows_2019, build_ubuntu_20_04, build_ubuntu_22_04, build_ubuntu_24_04, build_mac_13]
runs-on: ubuntu-latest
steps:
# Get version
- name: Get version from tag
id: get_version
run: |
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
version=${GITHUB_REF#refs/tags/v}
else
version=0.0.0.${GITHUB_REF#refs/heads/}
fi
echo "version=${version}" >> "${GITHUB_OUTPUT}"
# Download the Windows artifact from the build_windows job
- name: Download Windows Artifact
uses: actions/download-artifact@v4
with:
name: PixelFlasher.exe Artifacts
path: release
continue-on-error: true
# Download the Windows-2019 artifact from the build_windows_2019 job
- name: Download Windows-2019 Artifact
uses: actions/download-artifact@v4
with:
name: PixelFlasher_Win_2019.exe Artifacts
path: release
continue-on-error: true
# Download the Ubuntu_20_04 artifact from the build_ubuntu_20_04 job
- name: Download Ubuntu_20_04 Artifact
uses: actions/download-artifact@v4
with:
name: PixelFlasher_Ubuntu_20_04 Artifacts
path: release
continue-on-error: true
# Download the Ubuntu_22_04 artifact from the build_ubuntu_22_04 job
- name: Download Ubuntu_22_04 Artifact
uses: actions/download-artifact@v4
with:
name: PixelFlasher_Ubuntu_22_04 Artifacts
path: release
continue-on-error: true
# Download the Ubuntu_24_04 artifact from the build_ubuntu_24_04 job
- name: Download Ubuntu_24_04 Artifact
uses: actions/download-artifact@v4
with:
name: PixelFlasher_Ubuntu_24_04 Artifacts
path: release
continue-on-error: true
# Download the Mac-OS artifacts from the build_mac_12 job
- name: Download Mac-OS Artifacts
uses: actions/download-artifact@v4
with:
name: PixelFlasher.dmg Artifacts
path: release
continue-on-error: true
# List the artifacts downloaded
- name: List contents of dist directory
run: ls ${{ github.workspace }}/release*
- name: Create release
id: create_release
uses: softprops/action-gh-release@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag_name: v${{ steps.get_version.outputs.version }}
name: Release v${{ steps.get_version.outputs.version }}
# body_path: RELEASE.md
draft: true
prerelease: false
files: |
release/*
continue-on-error: true