Skip to content

chore: Bump version for release #892

chore: Bump version for release

chore: Bump version for release #892

Workflow file for this run

name: Python testing
on: [push, pull_request, workflow_dispatch]
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macOS-11]
defaults:
run:
shell: bash # For `source`
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: 'pip'
cache-dependency-path: requirements/*.txt
- name: Python/tkinter version debug
run: |
python --version
python -c "import sys, tkinter;tcl = tkinter.Tcl();print(f\"{tkinter.TkVersion=}\n{tkinter.TclVersion=}\n{tcl.call('info', 'patchlevel')=}\n{sys.executable=}\n{tkinter.__file__=}\")"
- name: OS specific setup (windows)
if: startswith(matrix.os, 'windows')
run: |
echo 'OS_NAME=windows' >> $GITHUB_ENV
echo 'ACTIVATE_PATH=venv/Scripts/activate' >> $GITHUB_ENV
echo 'RESULT_EXTENSION=.exe' >> $GITHUB_ENV
echo 'PYINSTALLER_ARGS=' >> $GITHUB_ENV
- name: OS specific setup (linux)
if: startswith(matrix.os, 'ubuntu')
run: |
echo 'OS_NAME=linux' >> $GITHUB_ENV
echo 'ACTIVATE_PATH=venv/bin/activate' >> $GITHUB_ENV
echo 'RESULT_EXTENSION=' >> $GITHUB_ENV
echo 'PYINSTALLER_ARGS=' >> $GITHUB_ENV
- name: OS specific setup (mac)
if: startswith(matrix.os, 'macOS')
run: |
echo 'OS_NAME=mac' >> $GITHUB_ENV
echo 'ACTIVATE_PATH=venv/bin/activate' >> $GITHUB_ENV
# Upload the built .dmg app-installer
echo 'RESULT_EXTENSION=.dmg' >> $GITHUB_ENV
# Target universal2 so that the built binary can run on both intel and apple silicon
# Pass --windowed to build a .app bundle
echo 'PYINSTALLER_ARGS=--target-architecture universal2 --windowed' >> $GITHUB_ENV
- name: Select dependency files
run: |
echo "REQUIREMENTS=requirements/${{ env.OS_NAME }}.txt" >> $GITHUB_ENV
echo "DEV_REQUIREMENTS=requirements/${{ env.OS_NAME }}-dev.txt" >> $GITHUB_ENV
- name: Install dependencies
run: |
python -m ensurepip
python -m venv venv
source ${{ env.ACTIVATE_PATH }}
python -m pip install --upgrade pip
python -m pip install -r ${{ env.REQUIREMENTS }} -r ${{ env.DEV_REQUIREMENTS }}
python -m pip install --no-deps -e .
VERSION_STRING="$(python -c 'from prism import VERSION_STRING; print(VERSION_STRING)')"
echo "VERSION_STRING=$VERSION_STRING" >> $GITHUB_ENV
echo "SIMPLE_NAME=prism-$VERSION_STRING" >> $GITHUB_ENV
echo "BUILD_RESULT_NAME=prism-$VERSION_STRING-${{ env.OS_NAME }}${{ env.RESULT_EXTENSION }}" >> $GITHUB_ENV
- name: Run typechecking
run: |
source ${{ env.ACTIVATE_PATH }}
mypy --strict .
- name: Run tests
run: |
source ${{ env.ACTIVATE_PATH }}
coverage run
coverage report
- name: Build single file binary with pyinstaller
run: |
source ${{ env.ACTIVATE_PATH }}
python add_version_to_icon.py # Create the icon file
pyinstaller prism_overlay.py --noconfirm --onefile --icon=pyinstaller/who_with_version.ico --name "${{ env.SIMPLE_NAME }}" --additional-hooks-dir=pyinstaller ${{ env.PYINSTALLER_ARGS }}
- name: Package app bundle to disk image (mac)
if: env.OS_NAME == 'mac'
run: |
brew install create-dmg
convert pyinstaller/who_with_version.ico pyinstaller/who_with_version.icns
mkdir -p 'dist/app'
mv "dist/${{ env.SIMPLE_NAME }}.app" "dist/app"
# Inspired by:
# https://www.pythonguis.com/tutorials/packaging-pyqt5-applications-pyinstaller-macos-dmg/
create-dmg \
--volname "Prism ${{ env.VERSION_STRING }} installer" \
--volicon 'pyinstaller/who_with_version.icns' \
--window-pos 200 120 \
--window-size 600 300 \
--icon-size 100 \
--icon "${{ env.SIMPLE_NAME }}.app" 175 120 \
--hide-extension "${{ env.SIMPLE_NAME }}.app" \
--app-drop-link 425 120 \
"${{ env.BUILD_RESULT_NAME }}" \
"dist/app/"
- name: Store built binary (non-mac)
if: env.OS_NAME != 'mac'
run: |
mv "dist/${{ env.SIMPLE_NAME }}${{ env.RESULT_EXTENSION }}" "${{ env.BUILD_RESULT_NAME }}"
- name: Upload built binary/app .dmg
uses: actions/upload-artifact@v3
with:
name: prism-builds
path: "${{ env.BUILD_RESULT_NAME }}"
if-no-files-found: error