# Build Python wheels for PyPI distribution # Triggered on YYYYMMDD version tags (e.g., 20260220) # Wheels are built with CalVer version (e.g., 2026.2.20) name: Build Wheels on: # Build on YYYYMMDD version tags push: tags: - '[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]' # Allow manual trigger for testing workflow_dispatch: inputs: debug: description: 'Enable debug output' required: false default: false type: boolean jobs: build_wheels: name: Build ${{ matrix.os }} ${{ matrix.arch }} wheels runs-on: ${{ matrix.runner }} strategy: fail-fast: false matrix: include: # Linux x86_64 - os: linux arch: x86_64 runner: ubuntu-latest # Linux aarch64 (uses QEMU emulation) - os: linux arch: aarch64 runner: ubuntu-latest # macOS x86_64 - os: macos arch: x86_64 runner: macos-13 # macOS arm64 (native runner) - os: macos arch: arm64 runner: macos-14 # Windows x86_64 - os: windows arch: AMD64 runner: windows-latest steps: - uses: actions/checkout@v6 # Set up QEMU for Linux aarch64 emulation - name: Set up QEMU if: matrix.os == 'linux' && matrix.arch == 'aarch64' uses: docker/setup-qemu-action@v3 with: platforms: arm64 - name: Build wheels uses: pypa/cibuildwheel@v2.21 env: # Only build for the current architecture CIBW_ARCHS: ${{ matrix.arch }} # Debug output if requested CIBW_BUILD_VERBOSITY: ${{ inputs.debug && '3' || '1' }} - name: Upload wheels uses: actions/upload-artifact@v7 with: name: wheels-${{ matrix.os }}-${{ matrix.arch }} path: ./wheelhouse/*.whl build_sdist: name: Build source distribution runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - name: Build sdist run: pipx run build --sdist - name: Upload sdist uses: actions/upload-artifact@v7 with: name: sdist path: dist/*.tar.gz # Test that the sdist can be installed from source test_sdist: name: Test source distribution needs: build_sdist runs-on: ubuntu-latest steps: - name: Install build dependencies run: | sudo apt-get update sudo apt-get install -y \ cmake ninja-build \ libfreetype-dev libxml2-dev zlib1g-dev \ libpng-dev libjpeg-dev libtiff-dev - name: Download sdist uses: actions/download-artifact@v4 with: name: sdist - name: Install from sdist run: pip install fontforge-*.tar.gz -v - name: Test import run: python -c "import fontforge; import psMat; print('fontforge version:', fontforge.version())" # Combine all artifacts into a single download combine_artifacts: name: Combine artifacts needs: [build_wheels, build_sdist, test_sdist] runs-on: ubuntu-latest steps: - name: Download all artifacts uses: actions/download-artifact@v4 with: path: dist merge-multiple: true - name: List artifacts run: ls -la dist/ - name: Upload combined artifacts uses: actions/upload-artifact@v7 with: name: all-packages path: dist/ # PyPI upload - DISABLED for now # Uncomment and configure trusted publishing when ready # See: https://docs.pypi.org/trusted-publishers/ # # publish: # name: Publish to PyPI # needs: [build_wheels, build_sdist] # runs-on: ubuntu-latest # # Only publish on tag pushes # if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') # environment: # name: pypi # url: https://pypi.org/p/fontforge # permissions: # id-token: write # Required for trusted publishing # steps: # - name: Download all artifacts # uses: actions/download-artifact@v4 # with: # path: dist # merge-multiple: true # # - name: Publish to PyPI # uses: pypa/gh-action-pypi-publish@release/v1