forked from WouterJD/FortiusANT
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build executables via GitHub actions (WouterJD#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
- Loading branch information
1 parent
331e2b7
commit 291fce6
Showing
5 changed files
with
191 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: Build FortiusANT | ||
|
||
on: [push] | ||
|
||
jobs: | ||
build-windows: | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.7 | ||
- name: Build Windows Executables | ||
shell: cmd | ||
run: | | ||
ci/windows/build.bat | ||
- uses: actions/upload-artifact@v2 | ||
with: | ||
name: Windows artifacts | ||
path: | | ||
pythoncode\dist\FortiusANT.exe | ||
pythoncode\dist\ExplorANT.exe | ||
build-macos: | ||
runs-on: macos-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.7 | ||
- name: Build macOS Executable | ||
run: | | ||
ci/macos/build | ||
- uses: actions/upload-artifact@v2 | ||
with: | ||
name: macOS artifacts | ||
path: | | ||
pythoncode/dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
pushd pythoncode | ||
|
||
python3 -m venv ./build-env | ||
source ./build-env/bin/activate | ||
|
||
python -m pip install --upgrade pip | ||
pip install pyinstaller | ||
pip install -r requirements.txt | ||
|
||
pyinstaller --clean FortiusANT-macos.spec --onefile --windowed --clean --noconfirm | ||
|
||
deactivate | ||
|
||
popd | ||
|
||
echo Done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
@echo off | ||
|
||
:: Automated build for the FortiusANT and ExplorANT executables on Windows. | ||
call :DOWNLOAD_LIBUSB || goto :ERROR | ||
call :INSTALL_PACKAGES || goto :ERROR | ||
call :BUILD_EXPLORANT || goto :ERROR | ||
call :BUILD_FORTIUSANT || goto :ERROR | ||
|
||
echo Build succeeded | ||
exit /b 0 | ||
:: | ||
|
||
:: DOWNLOAD_LIBUSB | ||
:: | ||
:: Download libusb driver and place it in the system32 folder so it can be found by pyinstaller | ||
:DOWNLOAD_LIBUSB | ||
setlocal | ||
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 ^ | ||
|| exit /b 1 | ||
tar -xf %cd%\libusb-win32-bin-1.2.6.0.zip ^ | ||
|| exit /b 1 | ||
copy %cd%\libusb-win32-bin-1.2.6.0\bin\amd64\libusb0.dll C:\Windows\System32\libusb0.dll ^ | ||
|| exit /b 1 | ||
|
||
exit /b 0 | ||
endlocal | ||
:: | ||
|
||
:: INSTALL_PACKAGES | ||
:: | ||
:: Install all required pip packages | ||
:INSTALL_PACKAGES | ||
setlocal | ||
pushd pythoncode | ||
python -m pip install --upgrade pip ^ | ||
|| exit /b 1 | ||
pip install pyinstaller ^ | ||
|| exit /b 1 | ||
pip install -r requirements.txt ^ | ||
|| exit /b 1 | ||
|
||
popd | ||
exit /b 0 | ||
endlocal | ||
:: | ||
|
||
:: BUILD_EXPLORANT | ||
:: | ||
:: Build the ExplorANT executable | ||
:BUILD_EXPLORANT | ||
setlocal | ||
pushd pythoncode | ||
pyinstaller --clean MakeExplorANT.spec ^ | ||
|| exit /b 1 | ||
|
||
popd | ||
exit /b 0 | ||
endlocal | ||
:: | ||
|
||
:: BUILD_FORTIUSANT | ||
:: | ||
:: Build the FortiusANT executable | ||
:BUILD_FORTIUSANT | ||
setlocal | ||
pushd | ||
cd pythoncode | ||
pyinstaller --clean MakeFortiusANT.spec ^ | ||
|| exit /b 1 | ||
|
||
exit /b 0 | ||
popd | ||
endlocal | ||
:: | ||
|
||
:: ERROR | ||
:: | ||
:: Exit on failure | ||
:ERROR | ||
echo Build failed | ||
exit /b 1 | ||
:: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# -*- mode: python ; coding: utf-8 -*- | ||
|
||
block_cipher = None | ||
|
||
|
||
a = Analysis(['FortiusAnt.py'], | ||
pathex=['.'], | ||
binaries=[], | ||
datas=[ | ||
( './FortiusAnt.icns', '.' ), | ||
( './FortiusAnt.ico', '.' ), | ||
( './FortiusAnt.jpg', '.' ), | ||
( './heart.jpg', '.' ), | ||
( './settings.bmp', '.' ), | ||
( './sponsor.bmp', '.' ), | ||
( './tacxfortius_1942_firmware.hex', '.' ), | ||
( './tacximagic_1902_firmware.hex', '.' ) | ||
], | ||
hiddenimports=[], | ||
hookspath=[], | ||
runtime_hooks=[], | ||
excludes=[], | ||
win_no_prefer_redirects=False, | ||
win_private_assemblies=False, | ||
cipher=block_cipher, | ||
noarchive=False) | ||
pyz = PYZ(a.pure, a.zipped_data, | ||
cipher=block_cipher) | ||
exe = EXE(pyz, | ||
a.scripts, | ||
[], | ||
exclude_binaries=True, | ||
name='FortiusAnt', | ||
debug=False, | ||
bootloader_ignore_signals=False, | ||
strip=False, | ||
upx=True, | ||
console=False) | ||
|
||
coll = COLLECT(exe, | ||
a.binaries, | ||
a.zipfiles, | ||
a.datas, | ||
strip=False, | ||
upx=True, | ||
name='FortiusAnt') | ||
|
||
app = BUNDLE(coll, | ||
name='FortiusAnt.app', | ||
icon='FortiusAnt.icns', | ||
bundle_identifier=None) |
Binary file not shown.