| 1 | name: Build |
| 2 | |
| 3 | on: [push, pull_request] |
| 4 | |
| 5 | jobs: |
| 6 | |
| 7 | build_sdist: |
| 8 | runs-on: ubuntu-latest |
| 9 | |
| 10 | steps: |
| 11 | - uses: actions/checkout@v4 |
| 12 | |
| 13 | - name: Set up Python |
| 14 | uses: actions/setup-python@v5 |
| 15 | with: |
| 16 | python-version: '3.10' |
| 17 | |
| 18 | - name: Install dependencies |
| 19 | run: | |
| 20 | python -m pip install --upgrade build |
| 21 | |
| 22 | - name: Build sdist |
| 23 | run: python -m build --sdist |
| 24 | |
| 25 | - uses: actions/upload-artifact@v4 |
| 26 | with: |
| 27 | name: sdist |
| 28 | path: ./dist/*.tar.gz |
| 29 | |
| 30 | build_wheels: |
| 31 | name: Build wheels on ${{ matrix.os }} (${{ matrix.platform_id }}) |
| 32 | runs-on: ${{ matrix.os }} |
| 33 | strategy: |
| 34 | fail-fast: false |
| 35 | matrix: |
| 36 | include: |
| 37 | - os: windows-2022 |
| 38 | platform_id: win_amd64 |
| 39 | cairo_plat: x64 |
| 40 | msvc_arch: x64 |
| 41 | - os: windows-2022 |
| 42 | platform_id: win32 |
| 43 | cairo_plat: x86 |
| 44 | msvc_arch: x86 |
| 45 | |
| 46 | steps: |
| 47 | - uses: actions/checkout@v4 |
| 48 | |
| 49 | - name: Setup MSVC |
| 50 | uses: ilammy/[email protected] |
| 51 | with: |
| 52 | arch : ${{ matrix.msvc_arch }} |
| 53 | |
| 54 | - name: Build wheels |
| 55 | uses: pypa/[email protected] |
| 56 | env: |
| 57 | CFLAGS: "-DCAIRO_WIN32_STATIC_BUILD=1" |
| 58 | CIBW_BEFORE_BUILD: "python {package}/.ci/download-cairo-win32.py ${{ matrix.cairo_plat }}" |
| 59 | CIBW_BUILD: cp39-${{ matrix.platform_id }} cp310-${{ matrix.platform_id }} cp311-${{ matrix.platform_id }} cp312-${{ matrix.platform_id }} cp313-${{ matrix.platform_id }} |
| 60 | CIBW_TEST_REQUIRES: pytest==7.4.4 hypothesis==6.98.3 attrs==23.2.0 |
| 61 | CIBW_TEST_COMMAND: bash {package}/.ci/test-wheels.sh {package} |
| 62 | CIBW_TEST_SKIP: "*-win_arm64" |
| 63 | CIBW_ENVIRONMENT_WINDOWS: PKG_CONFIG_PATH='${{ github.workspace }}/cairo-prebuild/lib/pkgconfig' PKG_CONFIG='${{ github.workspace }}/cairo-prebuild/bin/pkgconf.exe' |
| 64 | |
| 65 | - uses: actions/upload-artifact@v4 |
| 66 | with: |
| 67 | name: "wheel-${{ matrix.cairo_plat }}" |
| 68 | path: ./wheelhouse/*.whl |