Skip to content

refactor: Move utilities dependent on wx to gui #509

refactor: Move utilities dependent on wx to gui

refactor: Move utilities dependent on wx to gui #509

name: Build macOS app
on:
push:
pull_request:
release:
types:
- published
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
# build for Intel x64
- os: macos-15-intel
architecture: x64
python-version: '3.11'
# build for Apple Silicon arm64
- os: macos-14
architecture: arm64
python-version: '3.13'
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
architecture: ${{ matrix.architecture }}
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip pyinstaller setuptools wheel cython cffi -r requirements.txt
- name: Build Cython ext
run: |
python setup.py build_ext --inplace
- name: Make pyinstaller spec
run: |
pyi-makespec --windowed --name "Pronterface" --target-architecture "${{ matrix.architecture == 'arm64' && 'arm64' || 'x86_64' }}" --add-data "printrun/assets:printrun/assets" --icon "./assets_raw/icons/pronterface.icns" pronterface.py
# Edit spec file
export GIT_HASH=$(git rev-parse --short "$GITHUB_SHA")
export VERSION="$(python3 -c 'import printrun.printcore as core; print(core.__version__)' 2>/dev/null)"
export YEAR=$(date +%Y)
sed -i '' '$ s/.$//' Pronterface.spec
cat >> Pronterface.spec <<EOL
info_plist={
'CFBundleVersion': '$GIT_HASH',
'CFBundleShortVersionString': "$VERSION",
'NSHumanReadableCopyright': "FOSS © $YEAR, GPL-3.0 licensed",
'NSPrincipalClass': 'NSApplication',
'NSAppleScriptEnabled': False,
'NSAppSleepDisabled': True,
},
)
EOL
- name: Make pyinstaller build
run: |
pyinstaller --clean Pronterface.spec -y
# Zip app manually to avoid losing execute permissions for binary file in app
cd dist
zip -r -X Pronterface-app.zip Pronterface.app
- name: Copy translation files
run: |
cp -r locale dist
cp README.md dist/
- name: Configuration for releases
if: ${{ github.event_name == 'release' }}
run: |
echo "EXE_NAME=${{ github.ref_name }}_macos_${{ matrix.architecture }}" >> $GITHUB_ENV
- name: Configuration for pushes
if: ${{ github.event_name == 'push' }}
run: |
echo "EXE_NAME=printrun-nightly_${{ matrix.os }}_${{ matrix.architecture }}_py${{ matrix.python-version }}" >> $GITHUB_ENV
- name: Configuration for pull requests
if: ${{ github.event_name == 'pull_request' }}
run: |
echo "EXE_NAME=printrun-test_${{ matrix.os }}_${{ matrix.architecture }}_py${{ matrix.python-version }}" >> $GITHUB_ENV
- name: Upload artifacts for inspection
uses: actions/upload-artifact@v5
with:
name: ${{ env.EXE_NAME }}
path: |
dist/Pronterface-app.zip
dist/README.md
dist/locale
upload_release_assets:
needs: [build]
if: github.event_name == 'release' && github.event.action == 'published'
uses: kliment/Printrun/.github/workflows/upload-assets.yml@master