diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 9128539..e01bd83 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -10,14 +10,27 @@ on: - "*.*.*" jobs: - build-macos-app: - runs-on: macos-latest + build-application: + runs-on: ${{ matrix.os }} + + strategy: + matrix: + include: + - os: macos-latest + NAME: MacOS + + - os: windows-latest + NAME: Windows + + - os: ubuntu-22.04 + NAME: Ubuntu permissions: contents: read steps: - name: macOS Notarize -- Install Certificates + if: ${{ matrix.NAME == 'MacOS' }} run: | echo ${{ secrets.CERTIFICATE_P12 }} | base64 --decode > certificate.p12 security import certificate.p12 -P ${{ secrets.CERTIFICATE_PASSWORD }} @@ -53,15 +66,15 @@ jobs: run: | python -m pip install --upgrade pip pip install -r requirements.txt | tee pip_log.txt - python macos/ensure_universal_wheels.py pip_log.txt - pip install --force build/universal_wheels/*.whl pip install -r requirements-dev.txt - - name: Run pre-commit + - name: Make and install universal wheels + if: ${{ matrix.NAME == 'MacOS' }} run: | - pre-commit run --all-files --verbose --show-diff-on-failure + python macos/ensure_universal_wheels.py pip_log.txt + pip install --force build/universal_wheels/*.whl - - name: Build app + - name: Build app with PyInstaller run: | pyinstaller FontraPak.spec -y @@ -70,9 +83,10 @@ jobs: pytest - name: macOS Notarize -- Codesign and Notarize + if: ${{ matrix.NAME == 'MacOS' }} run: | APP_PATH="dist/Fontra Pak.app" - DMG_PATH="dist/FontraPak-macOS.dmg" + DMG_PATH="dist/FontraPak-${{ matrix.NAME }}.dmg" macos/codesign_app.sh "${{ secrets.CODESIGN_NAME }}" "$APP_PATH" macos/entitlements.plist python macos/build_dmg.py "$APP_PATH" "$DMG_PATH" @@ -95,105 +109,26 @@ jobs: xcrun stapler staple "$DMG_PATH" - - name: Storing macOS Artifacts - uses: actions/upload-artifact@v5 - with: - name: FontraPakMacOS - path: ./dist/*.dmg - - build-windows-exe: - runs-on: windows-latest - - permissions: - contents: read - - steps: - - name: Git checkout - uses: actions/checkout@v6 - - - name: Set up Node.js - uses: actions/setup-node@v6 - with: - node-version: 20.x - cache: "npm" - - - name: Set up Python 3.13 - uses: actions/setup-python@v6 - with: - python-version: "3.13" - - - name: Patch requirements.txt - if: github.ref_type == 'tag' - run: | - python scripts/patch_requirements.py ${{ github.ref_name }} - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - python -m pip install -r requirements.txt - python -m pip install -r requirements-dev.txt - - - name: Build exe - run: | - pyinstaller FontraPak.spec -y - - - name: Run tests - run: | - pytest - - - name: Storing Windows Artifacts - uses: actions/upload-artifact@v5 - with: - name: FontraPakWindows - path: ./dist/*.exe - - build-linux-binary: - runs-on: ubuntu-22.04 - - permissions: - contents: read - steps: - - name: Git checkout - uses: actions/checkout@v5 - - - name: Set up Node.js - uses: actions/setup-node@v5 - with: - node-version: 20.x - cache: "npm" - - - name: Set up Python 3.13 - uses: actions/setup-python@v6 - with: - python-version: "3.13" - - - name: Patch requirements.txt - if: github.ref_type == 'tag' - run: | - python scripts/patch_requirements.py ${{ github.ref_name }} - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - python -m pip install -r requirements.txt - python -m pip install -r requirements-dev.txt - - - name: Build executable + - name: Zip Windows exe + if: ${{ matrix.NAME == 'Windows' }} run: | - pyinstaller FontraPak.spec -y - mv dist/Fontra\ Pak dist/fontrapak cd ./dist - tar -czvf FontraPak-Ubuntu.tgz fontrapak + Compress-Archive -Path "Fontra Pak.exe" -Destination FontraPak-${{ matrix.NAME }}.zip - - name: Run tests + - name: Archive executable with tar + if: ${{ matrix.NAME != 'MacOS' && matrix.NAME != 'Windows' }} run: | - pytest + cd ./dist + tar -czvf FontraPak-${{ matrix.NAME }}.tgz fontrapak - - name: Storing Ubuntu Artifacts + - name: Storing Artifacts uses: actions/upload-artifact@v5 with: - name: FontraPakUbuntu - path: ./dist/*.tgz + name: FontraPak-${{ matrix.NAME }} + path: | + ./dist/*.dmg + ./dist/*.zip + ./dist/*.tgz create-github-release: runs-on: ubuntu-latest @@ -201,7 +136,7 @@ jobs: permissions: contents: write - needs: [build-macos-app, build-windows-exe, build-linux-binary] + needs: [build-application] if: github.ref_type == 'tag' steps: @@ -219,16 +154,10 @@ jobs: with: path: ./downloaded-artifact - - name: Zip Windows Artifact - run: | - cd ./downloaded-artifact/FontraPakWindows - zip -q FontraPak-Windows.zip "Fontra Pak.exe" - - name: Display structure of downloaded files run: ls -R working-directory: ./downloaded-artifact - - name: Extract Latest Changes run: | python scripts/extract_latest_changes.py > tmp_latest_changes.txt @@ -239,9 +168,9 @@ jobs: body_path: 'tmp_latest_changes.txt' token: ${{ secrets.GITHUB_TOKEN }} files: | - ./downloaded-artifact/FontraPakWindows/*.zip - ./downloaded-artifact/FontraPakMacOS/*.dmg - ./downloaded-artifact/FontraPakUbuntu/*.tgz + ./downloaded-artifact/FontraPak-MacOS/*.dmg + ./downloaded-artifact/FontraPak-Windows/*.zip + ./downloaded-artifact/FontraPak-Ubuntu/*.tgz draft: true - name: Update website / Repository Dispatch diff --git a/FontraPak.spec b/FontraPak.spec index cc67c7e..4f7af1d 100644 --- a/FontraPak.spec +++ b/FontraPak.spec @@ -159,7 +159,7 @@ else: a.zipfiles, a.datas, [], - name="Fontra Pak", + name="Fontra Pak" if sys.platform == "win32" else "fontrapak", debug=False, bootloader_ignore_signals=False, strip=False, diff --git a/README.md b/README.md index 667a63a..8f60454 100644 --- a/README.md +++ b/README.md @@ -6,14 +6,20 @@ Fontra Pak is a cross-platform, standalone, bundled [Fontra](https://github.com/ Nightly builds can be downloaded from the topmost [“Build Application”](https://github.com/fontra/fontra-pak/actions) workflow. You need to be signed in to GitHub to be able to download. -## Build locally +## Run locally from source -To build, set up a Python 3.10 (or higher) virtual environment, install the requirements from `requirements.txt`, then run: +To run the main program directly, set up a Python 3.10 (or higher) virtual environment, install the requirements from `requirements.txt`, then run: + + python FontraPakMain.py + +## Build a self-contained application locally + +To build a self-contained application, set up a Python 3.10 (or higher) virtual environment, install the requirements from `requirements.txt` and `requirements-dev.txt`, then run: pyinstaller FontraPak.spec -y ## How it works -Easy! +Drop a font file onto application icon, or launch the application, and drop a font file onto the drop area. Or use the "New font" button to create a new font. https://github.com/fontra/fontra-pak/assets/4246121/a4e8054e-995a-4bcc-ac64-5c8a0ea415aa diff --git a/requirements-dev.txt b/requirements-dev.txt index 7c80b02..66ca0cd 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,2 +1,5 @@ -pre-commit==4.5.0 +pyinstaller==6.17.0 +# Use patched fork to work around https://github.com/matthew-brett/delocate/issues/228 +git+https://github.com/justvanrossum/delocate.git +# delocate==0.12.0 pytest==9.0.1 diff --git a/requirements.txt b/requirements.txt index 7254075..23e8255 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,13 +3,9 @@ git+https://github.com/fontra/fontra-compile.git git+https://github.com/fontra/fontra-rcjk.git git+https://github.com/fontra/fontra-glyphs.git aiohttp==3.13.2 -pyinstaller==6.17.0 # pin setuptools for now to avoid new pkg_resources warning setuptools==80.8.0 # pinned! PyQt6==6.7.1 PyQt6-Qt6==6.7.3 PyQt6-sip==13.10.2 -# Use patched fork to work around https://github.com/matthew-brett/delocate/issues/228 -git+https://github.com/justvanrossum/delocate.git -# delocate==0.12.0 psutil==7.1.3