MacOS Exporter App #9
Workflow file for this run
This file contains hidden or 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
| # This workflow will install Python dependencies, run tests and lint with a variety of Python versions | |
| # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | |
| name: MacOS Exporter App - Python Tests | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| paths: | |
| - "python/**" | |
| pull_request: | |
| branches: [ "main" ] | |
| paths: | |
| - "python/**" | |
| release: | |
| types: [published, prereleased] | |
| env: | |
| PYTHONPATH: "${{ github.workspace }}/python:$PYTHONPATH" | |
| PYINSTALLER_PYTHON_VER: 3.13 | |
| APP_NAME: OpenTagViewer-ExportWizardMacOS | |
| APP_ZIP_NAME: OpenTagViewer-ExportWizardMacOS.zip | |
| jobs: | |
| test: | |
| runs-on: macos-14 # We *need* 14, this whole setup is only supported up to <= 14 (without weird security disabling hacks) | |
| strategy: | |
| fail-fast: true | |
| matrix: | |
| python-version: ["3.10", "3.11", "3.12", "3.13"] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v3 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| working-directory: ./python | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install flake8 pytest | |
| pip install -r requirements.txt | |
| - name: Lint with flake8 | |
| working-directory: . # run flake8 from repository root | |
| run: | | |
| # Run flake8 on the 'python' directory, letting it pick up the .flake8 config file | |
| # stop the build if there are Python syntax errors or undefined names | |
| flake8 ./python --count --select=E9,F63,F7,F82 --show-source --statistics | |
| flake8 ./python --count --exit-zero --statistics | |
| - name: Test with pytest | |
| working-directory: ./python | |
| run: | | |
| pytest ./test | |
| build-executable: | |
| environment: 'MacOS Exporter App CI' | |
| needs: test # run this job only after 'test' job completes successfully | |
| runs-on: macos-14 # We *need* 14, this whole setup is only supported up to <= 14 (without weird security disabling hacks) | |
| if: | | |
| github.event_name == 'release' | |
| && (github.event.release.prerelease == true || github.event.release.published_at != null) | |
| && startsWith(github.event.release.tag_name, 'macos-exporter-v') | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python ${{ env.PYINSTALLER_PYTHON_VER }} | |
| uses: actions/setup-python@v3 | |
| with: | |
| python-version: ${{ env.PYINSTALLER_PYTHON_VER }} | |
| - name: Install dependencies | |
| working-directory: ./python | |
| run: | | |
| brew install python-tk | |
| python -m pip install --upgrade pip | |
| pip install pyinstaller -r requirements.txt | |
| - name: Run PyInstaller for MacOS | |
| working-directory: ./python | |
| run: | | |
| pyinstaller \ | |
| --onefile \ | |
| --windowed \ | |
| --name "OpenTagViewer" \ | |
| --osx-bundle-identifier "dev.wander.opentagviewer" \ | |
| --icon=OpenTagViewer.icns \ | |
| --noconfirm \ | |
| ./main/wizard.py | |
| - name: Prepare and Upload MacOS App | |
| working-directory: ./python | |
| run: | | |
| APP_VERSION=1.0.3 | |
| cd ./dist | |
| zip -r ${{ env.APP_ZIP_NAME }} OpenTagViewer.app/ OpenTagViewer | |
| mkdir -p ${{ github.workspace }}/output | |
| mv ${{ github.workspace }}/python/dist/${{ env.APP_ZIP_NAME }} ${{ github.workspace }}/output/${{ env.APP_ZIP_NAME }} | |
| echo "UPLOAD_ASSET=${{ env.APP_ZIP_NAME }}" >> $GITHUB_ENV | |
| echo "UPLOAD_PATH=${{ github.workspace }}/output/${{ env.APP_ZIP_NAME }}" >> $GITHUB_ENV | |
| - name: Upload PyInstaller Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.APP_NAME }} | |
| path: ${{ github.workspace }}/output/${{ env.APP_ZIP_NAME }} | |
| - name: Upload Release Asset to GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| if: github.event_name == 'release' | |
| with: | |
| files: ${{ env.UPLOAD_PATH }} # Path to asset created in previous step | |
| name: ${{ env.APP_ZIP_NAME }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.MACOS_EXPORTER_APP_GITHUB_TOKEN }} # Provided by GitHub Actions |