|
| 1 | +name: Wheels |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + overrideVersion: |
| 7 | + description: Manually force a version |
| 8 | + release: |
| 9 | + types: |
| 10 | + - published |
| 11 | + pull_request: |
| 12 | + paths: |
| 13 | + - .github/workflows/wheels.yaml |
| 14 | + schedule: |
| 15 | + # Run weekly on Mondays at 01:23 UTC |
| 16 | + - cron: "23 1 * * 1" |
| 17 | + |
| 18 | +permissions: |
| 19 | + actions: read |
| 20 | + |
| 21 | +concurrency: |
| 22 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 23 | + cancel-in-progress: true |
| 24 | + |
| 25 | +env: |
| 26 | + SETUPTOOLS_SCM_PRETEND_VERSION: ${{ github.event.inputs.overrideVersion }} |
| 27 | + |
| 28 | +jobs: |
| 29 | + build_sdist: |
| 30 | + name: Build SDist |
| 31 | + runs-on: ubuntu-latest |
| 32 | + steps: |
| 33 | + - uses: actions/checkout@v5 |
| 34 | + with: |
| 35 | + fetch-depth: 0 |
| 36 | + submodules: true |
| 37 | + |
| 38 | + - name: Build SDist |
| 39 | + run: pipx run build --sdist |
| 40 | + |
| 41 | + - name: Check metadata |
| 42 | + run: pipx run twine check --strict dist/*.tar.gz |
| 43 | + |
| 44 | + - uses: actions/upload-artifact@v4 |
| 45 | + with: |
| 46 | + path: dist/* |
| 47 | + name: wheels-sdist |
| 48 | + |
| 49 | + build_wheels: |
| 50 | + name: ${{ matrix.build }} ${{ matrix.arch }} on ${{ matrix.os }} |
| 51 | + runs-on: ${{ matrix.os }} |
| 52 | + strategy: |
| 53 | + fail-fast: false |
| 54 | + matrix: |
| 55 | + include: |
| 56 | + - os: macos-15-intel |
| 57 | + arch: auto64 |
| 58 | + build: "*" |
| 59 | + |
| 60 | + - os: macos-latest |
| 61 | + arch: auto64 |
| 62 | + build: "*" |
| 63 | + |
| 64 | + - os: windows-latest |
| 65 | + arch: auto64 |
| 66 | + build: "cp*" |
| 67 | + |
| 68 | + - os: windows-latest |
| 69 | + arch: auto32 |
| 70 | + build: "*" |
| 71 | + |
| 72 | + - os: windows-11-arm |
| 73 | + arch: auto |
| 74 | + build: "*" |
| 75 | + |
| 76 | + - os: ubuntu-latest |
| 77 | + arch: auto64 |
| 78 | + build: "*manylinux*" |
| 79 | + |
| 80 | + - os: ubuntu-latest |
| 81 | + arch: auto64 |
| 82 | + build: "*musllinux*" |
| 83 | + |
| 84 | + - os: ubuntu-24.04-arm |
| 85 | + arch: auto64 |
| 86 | + build: "*manylinux*" |
| 87 | + |
| 88 | + - os: ubuntu-24.04-arm |
| 89 | + arch: auto64 |
| 90 | + build: "*musllinux*" |
| 91 | + |
| 92 | + steps: |
| 93 | + - uses: actions/checkout@v5 |
| 94 | + with: |
| 95 | + fetch-depth: 0 |
| 96 | + submodules: true |
| 97 | + |
| 98 | + - uses: astral-sh/setup-uv@v7 |
| 99 | + |
| 100 | + - uses: pypa/cibuildwheel@v3.2 |
| 101 | + env: |
| 102 | + CIBW_BUILD: ${{ matrix.build }} |
| 103 | + CIBW_ARCHS: ${{ matrix.arch }} |
| 104 | + |
| 105 | + - name: Verify clean directory |
| 106 | + shell: bash |
| 107 | + run: git diff --exit-code |
| 108 | + |
| 109 | + - name: Upload wheels |
| 110 | + uses: actions/upload-artifact@v5 |
| 111 | + with: |
| 112 | + path: wheelhouse/*.whl |
| 113 | + name: wheels-${{ strategy.job-index }} |
| 114 | + |
| 115 | + upload_all: |
| 116 | + name: Upload if release |
| 117 | + needs: [build_sdist, build_wheels] |
| 118 | + runs-on: ubuntu-latest |
| 119 | + if: github.event_name == 'release' && github.event.action == 'published' |
| 120 | + environment: |
| 121 | + name: pypi |
| 122 | + url: https://pypi.org/p/datrie |
| 123 | + permissions: |
| 124 | + id-token: write |
| 125 | + attestations: write |
| 126 | + contents: read |
| 127 | + |
| 128 | + steps: |
| 129 | + - uses: actions/download-artifact@v6 |
| 130 | + with: |
| 131 | + pattern: wheels-* |
| 132 | + merge-multiple: true |
| 133 | + path: dist |
| 134 | + |
| 135 | + - name: List all files |
| 136 | + run: ls -lh dist |
| 137 | + |
| 138 | + - name: Generate artifact attestation for sdist and wheels |
| 139 | + uses: actions/attest-build-provenance@v3 |
| 140 | + with: |
| 141 | + subject-path: "dist/datrie-*" |
| 142 | + |
| 143 | + - uses: pypa/gh-action-pypi-publish@release/v1 |
| 144 | + with: |
| 145 | + print-hash: true |
0 commit comments