diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..120773ea --- /dev/null +++ b/.github/workflows/build.yml @@ -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 diff --git a/ci/macos/build b/ci/macos/build new file mode 100755 index 00000000..ce87415b --- /dev/null +++ b/ci/macos/build @@ -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 diff --git a/ci/windows/build.bat b/ci/windows/build.bat new file mode 100644 index 00000000..e265f7c6 --- /dev/null +++ b/ci/windows/build.bat @@ -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 +:: diff --git a/pythoncode/FortiusANT-macos.spec b/pythoncode/FortiusANT-macos.spec new file mode 100644 index 00000000..2c5d9b1d --- /dev/null +++ b/pythoncode/FortiusANT-macos.spec @@ -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) diff --git a/pythoncode/FortiusAnt.icns b/pythoncode/FortiusAnt.icns new file mode 100644 index 00000000..f9f377ee Binary files /dev/null and b/pythoncode/FortiusAnt.icns differ