Skip to content

Commit 291fce6

Browse files
Build executables via GitHub actions (#160)
* Initial attempt at building the FortiusANT windows executable automatically by github actions * Enter pythoncode directory before installing requirements * Install pyinstaller in github actions * Try to download and unzip libusb * Try to fix downloading libusb zip file * Try again using bitsadmin and copy file to system32 so pyinstaller can use it * Removed quote from download string which was wrong * Fixed typo in priority setting of bitsadmin command * Try using cmd shell for downloading libusb * Save the generated executable as artifact * Also build the ExplorANT executable * Rename generated artifacts folder * Split building ExplorANT and FortiusANT into separate steps * Moved github actions build steps to windows batch file to be able to test and execute locally * Build FortusAnt app for macOS using github-actions * Removed invalid shell setting for build job on macos * Fixed wrong casing for macOS artifact * Try again storing macOS artifacts * Changed backslash to forward slash for macOS github action * Archive whole dist directory for macOS
1 parent 331e2b7 commit 291fce6

File tree

5 files changed

+191
-0
lines changed

5 files changed

+191
-0
lines changed

.github/workflows/build.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Build FortiusANT
2+
3+
on: [push]
4+
5+
jobs:
6+
build-windows:
7+
runs-on: windows-latest
8+
steps:
9+
- uses: actions/checkout@v2
10+
- uses: actions/setup-python@v2
11+
with:
12+
python-version: 3.7
13+
- name: Build Windows Executables
14+
shell: cmd
15+
run: |
16+
ci/windows/build.bat
17+
- uses: actions/upload-artifact@v2
18+
with:
19+
name: Windows artifacts
20+
path: |
21+
pythoncode\dist\FortiusANT.exe
22+
pythoncode\dist\ExplorANT.exe
23+
24+
build-macos:
25+
runs-on: macos-latest
26+
steps:
27+
- uses: actions/checkout@v2
28+
- uses: actions/setup-python@v2
29+
with:
30+
python-version: 3.7
31+
- name: Build macOS Executable
32+
run: |
33+
ci/macos/build
34+
- uses: actions/upload-artifact@v2
35+
with:
36+
name: macOS artifacts
37+
path: |
38+
pythoncode/dist

ci/macos/build

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
pushd pythoncode
6+
7+
python3 -m venv ./build-env
8+
source ./build-env/bin/activate
9+
10+
python -m pip install --upgrade pip
11+
pip install pyinstaller
12+
pip install -r requirements.txt
13+
14+
pyinstaller --clean FortiusANT-macos.spec --onefile --windowed --clean --noconfirm
15+
16+
deactivate
17+
18+
popd
19+
20+
echo Done

ci/windows/build.bat

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
@echo off
2+
3+
:: Automated build for the FortiusANT and ExplorANT executables on Windows.
4+
call :DOWNLOAD_LIBUSB || goto :ERROR
5+
call :INSTALL_PACKAGES || goto :ERROR
6+
call :BUILD_EXPLORANT || goto :ERROR
7+
call :BUILD_FORTIUSANT || goto :ERROR
8+
9+
echo Build succeeded
10+
exit /b 0
11+
::
12+
13+
:: DOWNLOAD_LIBUSB
14+
::
15+
:: Download libusb driver and place it in the system32 folder so it can be found by pyinstaller
16+
:DOWNLOAD_LIBUSB
17+
setlocal
18+
bitsadmin /transfer downloadJob /download /priority foreground https://sourceforge.net/projects/libusb-win32/files/libusb-win32-releases/1.2.6.0/libusb-win32-bin-1.2.6.0.zip %cd%\libusb-win32-bin-1.2.6.0.zip ^
19+
|| exit /b 1
20+
tar -xf %cd%\libusb-win32-bin-1.2.6.0.zip ^
21+
|| exit /b 1
22+
copy %cd%\libusb-win32-bin-1.2.6.0\bin\amd64\libusb0.dll C:\Windows\System32\libusb0.dll ^
23+
|| exit /b 1
24+
25+
exit /b 0
26+
endlocal
27+
::
28+
29+
:: INSTALL_PACKAGES
30+
::
31+
:: Install all required pip packages
32+
:INSTALL_PACKAGES
33+
setlocal
34+
pushd pythoncode
35+
python -m pip install --upgrade pip ^
36+
|| exit /b 1
37+
pip install pyinstaller ^
38+
|| exit /b 1
39+
pip install -r requirements.txt ^
40+
|| exit /b 1
41+
42+
popd
43+
exit /b 0
44+
endlocal
45+
::
46+
47+
:: BUILD_EXPLORANT
48+
::
49+
:: Build the ExplorANT executable
50+
:BUILD_EXPLORANT
51+
setlocal
52+
pushd pythoncode
53+
pyinstaller --clean MakeExplorANT.spec ^
54+
|| exit /b 1
55+
56+
popd
57+
exit /b 0
58+
endlocal
59+
::
60+
61+
:: BUILD_FORTIUSANT
62+
::
63+
:: Build the FortiusANT executable
64+
:BUILD_FORTIUSANT
65+
setlocal
66+
pushd
67+
cd pythoncode
68+
pyinstaller --clean MakeFortiusANT.spec ^
69+
|| exit /b 1
70+
71+
exit /b 0
72+
popd
73+
endlocal
74+
::
75+
76+
:: ERROR
77+
::
78+
:: Exit on failure
79+
:ERROR
80+
echo Build failed
81+
exit /b 1
82+
::

pythoncode/FortiusANT-macos.spec

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# -*- mode: python ; coding: utf-8 -*-
2+
3+
block_cipher = None
4+
5+
6+
a = Analysis(['FortiusAnt.py'],
7+
pathex=['.'],
8+
binaries=[],
9+
datas=[
10+
( './FortiusAnt.icns', '.' ),
11+
( './FortiusAnt.ico', '.' ),
12+
( './FortiusAnt.jpg', '.' ),
13+
( './heart.jpg', '.' ),
14+
( './settings.bmp', '.' ),
15+
( './sponsor.bmp', '.' ),
16+
( './tacxfortius_1942_firmware.hex', '.' ),
17+
( './tacximagic_1902_firmware.hex', '.' )
18+
],
19+
hiddenimports=[],
20+
hookspath=[],
21+
runtime_hooks=[],
22+
excludes=[],
23+
win_no_prefer_redirects=False,
24+
win_private_assemblies=False,
25+
cipher=block_cipher,
26+
noarchive=False)
27+
pyz = PYZ(a.pure, a.zipped_data,
28+
cipher=block_cipher)
29+
exe = EXE(pyz,
30+
a.scripts,
31+
[],
32+
exclude_binaries=True,
33+
name='FortiusAnt',
34+
debug=False,
35+
bootloader_ignore_signals=False,
36+
strip=False,
37+
upx=True,
38+
console=False)
39+
40+
coll = COLLECT(exe,
41+
a.binaries,
42+
a.zipfiles,
43+
a.datas,
44+
strip=False,
45+
upx=True,
46+
name='FortiusAnt')
47+
48+
app = BUNDLE(coll,
49+
name='FortiusAnt.app',
50+
icon='FortiusAnt.icns',
51+
bundle_identifier=None)

pythoncode/FortiusAnt.icns

555 KB
Binary file not shown.

0 commit comments

Comments
 (0)