RFC: generalize macos + windows builds #398
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
| name: CD | |
| on: | |
| push: | |
| tags: v* | |
| pull_request: | |
| paths: | |
| - Cargo.toml | |
| - Cargo.lock | |
| - .cargo/config.toml | |
| - pyproject.toml | |
| - .github/workflows/cd.yml | |
| workflow_dispatch: | |
| permissions: {} | |
| env: | |
| UV_PYTHON_PREFERENCE: only-system | |
| jobs: | |
| pre-publication-checks: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Source | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - uses: astral-sh/setup-uv@681c641aba71e4a1c380be3ab5e12ad51f415867 # v7.1.6 | |
| with: | |
| enable-cache: false | |
| - name: Pre-publication checks | |
| run: uv run scripts/pre_publish_checks.py | |
| build-sdist: | |
| name: Build source distribution | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - uses: astral-sh/setup-uv@681c641aba71e4a1c380be3ab5e12ad51f415867 # v7.1.6 | |
| with: | |
| enable-cache: false | |
| - name: Build sdist | |
| run: uv build --sdist | |
| - name: Upload sdist | |
| uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 | |
| with: | |
| name: sdist | |
| path: dist/*.tar.gz | |
| test-sdist: | |
| name: Test source distribution | |
| needs: [build-sdist] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Source | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - uses: astral-sh/setup-uv@681c641aba71e4a1c380be3ab5e12ad51f415867 # v7.1.6 | |
| with: | |
| enable-cache: false | |
| - run: uv sync --only-group test | |
| - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| path: dist | |
| name: sdist | |
| - name: test source distribution in isolation | |
| run: | | |
| tar xzf dist/*.tar.gz | |
| cd rlic-* | |
| uv pip install . | |
| uv run --no-project pytest --color=yes -ra | |
| macos: | |
| runs-on: ${{ matrix.target.runs-on }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| platform: | |
| - {pyver: '3.11', abi: abi3} | |
| # - {pyver: 3.15t, abi: abi3t} | |
| target: | |
| - {runs-on: macos-15-intel, arch-short: x64, arch-long: x86_64, feature-flags: -F fma} | |
| - {runs-on: macos-latest, arch-short: arm64, arch-long: aarch64-apple-darwin, feature-flags: -F fma -F branchless} | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0 | |
| with: | |
| python-version: ${{ matrix.platform.pyver }} | |
| architecture: ${{ matrix.target.arch-short }} | |
| allow-prereleases: ${{ matrix.platform.pyver == '3.15t' }} | |
| - uses: astral-sh/setup-uv@681c641aba71e4a1c380be3ab5e12ad51f415867 # v7.1.6 | |
| with: | |
| enable-cache: false | |
| - name: Configure uv | |
| if: ${{ matrix.platform.pyver == '3.15t' }} | |
| run: | | |
| echo "UV_PRERELEASE=allow" >> $GITHUB_ENV | |
| - run: rustup update | |
| - name: Build wheels | |
| uses: PyO3/maturin-action@04ac600d27cdf7a9a280dadf7147097c42b757ad # v1.50.1 | |
| with: | |
| target: ${{ matrix.target.arch-long }} | |
| args: --release --out dist -F pyo3/${{ matrix.platform.abi }} --no-default-features ${{ matrix.target.feature-flags }} | |
| - name: Test wheel | |
| run: | | |
| uv sync --only-group test | |
| uv pip install numpy | |
| uv pip install rlic --no-index --find-links dist --no-deps | |
| uv run --no-sync pytest --color=yes | |
| - name: Upload wheels | |
| uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 | |
| with: | |
| name: wheels-mac-${{ matrix.target.arch-short }} | |
| path: dist | |
| windows: | |
| runs-on: ${{ matrix.target.runs-on }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| platform: | |
| - {pyver: '3.11', abi: abi3} | |
| #- {pyver: 3.15t, abi: abi3t} | |
| target: | |
| - {runs-on: windows-latest, arch-short: x64, arch-long: x64, feature-flags: -F fma} | |
| - {runs-on: windows-11-arm, arch-short: arm64, arch-long: aarch64-pc-windows-msvc, feature-flags: -F fma -F branchless} | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0 | |
| with: | |
| python-version: ${{ matrix.platform.pyver }} | |
| architecture: ${{ matrix.target.arch-short }} | |
| allow-prereleases: ${{ matrix.platform.pyver == '3.15t' }} | |
| - uses: astral-sh/setup-uv@681c641aba71e4a1c380be3ab5e12ad51f415867 # v7.1.6 | |
| with: | |
| enable-cache: false | |
| - name: Configure uv | |
| if: ${{ matrix.platform.pyver == '3.15t' }} | |
| run: | | |
| echo "UV_PRERELEASE=allow" >> $GITHUB_ENV | |
| - run: rustup update | |
| - name: Build wheels | |
| uses: PyO3/maturin-action@04ac600d27cdf7a9a280dadf7147097c42b757ad # v1.50.1 | |
| with: | |
| target: ${{ matrix.target.arch-long }} | |
| args: --release --out dist -F pyo3/${{ matrix.platform.abi }} --no-default-features ${{ matrix.target.feature-flags }} | |
| - name: Test wheel | |
| run: | | |
| uv sync --only-group test | |
| uv pip install numpy | |
| uv pip install rlic --no-index --find-links dist --no-deps | |
| uv run --no-sync pytest --color=yes | |
| - name: Upload wheels | |
| uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 | |
| with: | |
| name: wheels-win-${{ matrix.target.arch-short }} | |
| path: dist | |
| manylinux: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| platform: | |
| - {pyver: '3.11', abi: abi3} | |
| #- {pyver: 3.15t, abi: abi3t} | |
| target: | |
| - x86_64 | |
| - aarch64 | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0 | |
| with: | |
| python-version: ${{ matrix.platform.pyver }} | |
| architecture: x64 | |
| allow-prereleases: ${{ matrix.platform.pyver == '3.15t' }} | |
| - uses: astral-sh/setup-uv@681c641aba71e4a1c380be3ab5e12ad51f415867 # v7.1.6 | |
| with: | |
| enable-cache: false | |
| - name: Configure uv | |
| if: ${{ matrix.platform.pyver == '3.15t' }} | |
| run: | | |
| echo "UV_PRERELEASE=allow" >> $GITHUB_ENV | |
| - name: Build wheels | |
| uses: PyO3/maturin-action@04ac600d27cdf7a9a280dadf7147097c42b757ad # v1.50.1 | |
| with: | |
| target: ${{ matrix.target }} | |
| manylinux: '2_28' | |
| args: --release --out dist --no-default-features -F pyo3/${{ matrix.platform.abi }} -F fma ${{ startsWith( matrix.target , 'aarch64' ) && '-F branchless' || '' }} -i python${{ matrix.platform.pyver }} | |
| - name: Test wheel | |
| if: matrix.target == 'x86_64' | |
| run: | | |
| uv sync --only-group test | |
| uv pip install numpy | |
| uv pip install rlic --no-index --find-links dist --no-deps | |
| uv run --no-sync pytest --color=yes | |
| - name: Upload wheels | |
| uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 | |
| with: | |
| name: wheels-manylinux-${{ matrix.target }} | |
| path: dist | |
| musllinux: | |
| # cross-compiling: no testing | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| platform: | |
| - {pyver: '3.11', abi: abi3} | |
| #- {pyver: 3.15t, abi: abi3t} | |
| target: | |
| - x86_64-unknown-linux-musl | |
| - aarch64-unknown-linux-musl | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0 | |
| with: | |
| python-version: ${{ matrix.platform.pyver }} | |
| architecture: x64 | |
| allow-prereleases: ${{ matrix.platform.pyver == '3.15t' }} | |
| - uses: astral-sh/setup-uv@681c641aba71e4a1c380be3ab5e12ad51f415867 # v7.1.6 | |
| with: | |
| enable-cache: false | |
| - name: Configure uv | |
| if: ${{ matrix.platform.pyver == '3.15t' }} | |
| run: | | |
| echo "UV_PRERELEASE=allow" >> $GITHUB_ENV | |
| - name: Build wheels | |
| uses: PyO3/maturin-action@04ac600d27cdf7a9a280dadf7147097c42b757ad # v1.50.1 | |
| with: | |
| target: ${{ matrix.target }} | |
| manylinux: musllinux_1_2 | |
| args: --release --out dist --no-default-features -F pyo3/${{ matrix.platform.abi }} -F fma ${{ startsWith( matrix.target , 'aarch64' ) && '-F branchless' || '' }} -i python${{ matrix.platform.pyver }} | |
| - name: Upload wheels | |
| uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 | |
| with: | |
| name: wheels-musllinux-${{ matrix.target }} | |
| path: dist | |
| deploy: | |
| name: Publish to PyPI | |
| needs: | |
| - pre-publication-checks | |
| - build-sdist | |
| - test-sdist | |
| - macos | |
| - windows | |
| - manylinux | |
| - musllinux | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/p/rlic | |
| permissions: | |
| id-token: write | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download sdist | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| path: dist | |
| name: sdist | |
| - name: Download wheels | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| path: dist | |
| pattern: wheels-* | |
| merge-multiple: true | |
| - uses: astral-sh/setup-uv@681c641aba71e4a1c380be3ab5e12ad51f415867 # v7.1.6 | |
| with: | |
| enable-cache: false | |
| - run: uvx abi3audit dist/*cp311-abi3*.whl --verbose | |
| - run: rm -v dist/*abit* || true # tmp | |
| - name: Publish package distributions to PyPI | |
| if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') | |
| uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0 |