Build Executables #62
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
name: Build Executables | |
on: | |
workflow_dispatch: | |
inputs: | |
debug_enabled: | |
type: boolean | |
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)' | |
required: false | |
default: false | |
push: | |
branches: [master] | |
pull_request: | |
branches: [master] | |
jobs: | |
build-windows: | |
runs-on: windows-latest | |
steps: | |
- name: Setup tmate session | |
uses: mxschmitt/action-tmate@v3 | |
with: | |
detached: true | |
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} | |
- uses: conda-incubator/setup-miniconda@v3 | |
with: | |
auto-update-conda: true | |
activate-environment: kivy20 | |
python-version: "3.10" | |
channels: conda-forge | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive # Initializes and updates submodules | |
- name: create env | |
shell: bash -l {0} | |
run: conda install -y kivy=2.3 pyinstaller=4.10 requests glfw | |
- name: pip installs | |
shell: bash -l {0} | |
run: pip install kivy-deps.sdl2==0.7.0 kivy-deps.glew pyo kivy-deps.angle==0.4.0 pyenchant | |
- name: install smile | |
shell: bash -l {0} | |
run: pip install -e smile | |
- name: create files | |
shell: bash -l {0} | |
run: echo $SI > serverinfo.txt && echo $ULCRT > cert.pem | |
- name: package cogmood | |
shell: bash -l {0} | |
run: | | |
cd package | |
export KIVY_GL_BACKEND=angle_sdl2 | |
python -m PyInstaller cogmood_windows.spec | |
- name: save exe | |
uses: actions/upload-artifact@v4 | |
with: | |
name: SUPREME_win | |
path: package/dist/SUPREME.exe | |
build-macos: | |
runs-on: macos-14 | |
steps: | |
- name: Setup tmate session | |
uses: mxschmitt/action-tmate@v3 | |
with: | |
detached: true | |
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive # Initializes and updates submodules | |
- name: Install Homebrew dependencies | |
run: | | |
brew update | |
brew install sdl2 sdl2_image sdl2_mixer sdl2_ttf create-dmg | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" # Specify your Python version | |
- name: Check if Python is a fat binary | |
run: | | |
if lipo -info $(which python3) | grep -q "Architectures in the fat file"; then | |
lipo -info $(which python3) | |
echo "Python is a fat binary." | |
export PATH=/Users/runner/hostedtoolcache/Python/3.10.11/arm64/bin:$PATH | |
else | |
echo "Python is NOT a fat binary." | |
exit 1 # Optional: Exit with error if you require a fat binary | |
fi | |
- name: Install dependencies | |
run: | | |
export PATH=/Users/runner/hostedtoolcache/Python/3.10.11/arm64/bin:$PATH | |
mkdir python_packages | |
python3 -m pip install --upgrade pip | |
python3 -m pip install --target $PWD/python_packages --only-binary=:all: --platform macosx_10_13_universal2 -r requirements.txt | |
export PYTHONPATH=$PWD/python_packages:$PYTHONPATH | |
- name: Build executable with PyInstaller | |
run: | | |
export PATH=/Users/runner/hostedtoolcache/Python/3.10.11/arm64/bin:$PATH | |
export PYTHONPATH=$PWD/python_packages:$PWD/smile:$PYTHONPATH | |
cd package | |
python3 -m PyInstaller --noconfirm cogmood_mac.spec | |
cd .. | |
mkdir SUPREME | |
cp -r package/dist/SUPREME.app SUPREME/ | |
create-dmg --volname SUPREME SUPREME.dmg SUPREME | |
- name: Upload macOS executable | |
uses: actions/upload-artifact@v4 | |
with: | |
name: SUPREME_mac | |
path: SUPREME.dmg |