ci: Set PYO3_USE_ABI3_FORWARD_COMPATIBILITY to fix Python 3.13 build #11
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: Build and Publish to PyPI | |
| on: | |
| push: | |
| branches: [ main, master ] | |
| tags: [ 'v*' ] | |
| pull_request: | |
| branches: [ main, master ] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| id-token: write | |
| jobs: | |
| linux: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| target: [x86_64, aarch64] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.11' | |
| - name: Build wheels | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| target: ${{ matrix.target }} | |
| args: --release --out dist --find-interpreter | |
| sccache: 'true' | |
| manylinux: auto | |
| env: | |
| PYO3_USE_ABI3_FORWARD_COMPATIBILITY: 1 | |
| - name: Upload wheels | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels | |
| path: dist | |
| windows: | |
| runs-on: windows-latest | |
| strategy: | |
| matrix: | |
| target: [x64] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.11' | |
| architecture: ${{ matrix.target }} | |
| - name: Build wheels | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| target: ${{ matrix.target }} | |
| args: --release --out dist --find-interpreter | |
| sccache: 'true' | |
| env: | |
| PYO3_USE_ABI3_FORWARD_COMPATIBILITY: 1 | |
| - name: Upload wheels | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels | |
| path: dist | |
| macos: | |
| runs-on: macos-latest | |
| strategy: | |
| matrix: | |
| target: [x86_64, aarch64] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.11' | |
| - name: Build wheels | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| target: ${{ matrix.target }} | |
| args: --release --out dist --find-interpreter | |
| sccache: 'true' | |
| env: | |
| PYO3_USE_ABI3_FORWARD_COMPATIBILITY: 1 | |
| - name: Upload wheels | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels | |
| path: dist | |
| sdist: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Build sdist | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| command: sdist | |
| args: --out dist | |
| - name: Upload sdist | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels | |
| path: dist | |
| test: | |
| needs: [linux, windows, macos, sdist] | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| python-version: ['3.10', '3.11', '3.12', '3.13'] | |
| exclude: | |
| # Reduce matrix size for faster builds | |
| - os: windows-latest | |
| python-version: '3.10' | |
| - os: macos-latest | |
| python-version: '3.10' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v4 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Download wheels | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: wheels | |
| path: dist | |
| - name: Install wheel | |
| shell: bash | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install numpy | |
| # Find and install the appropriate wheel for this platform | |
| python -m pip install --find-links dist --no-index jesse-rust | |
| - name: Test import | |
| run: | | |
| python -c "import jesse_rust; print('jesse_rust imported successfully')" | |
| - name: Run basic tests | |
| run: | | |
| python -c " | |
| import jesse_rust | |
| import numpy as np | |
| # Test that the module loads and basic functionality works | |
| print('Module loaded successfully') | |
| print('Available functions:', [name for name in dir(jesse_rust) if not name.startswith('_')]) | |
| " | |
| publish: | |
| name: Publish to PyPI | |
| runs-on: ubuntu-latest | |
| needs: [test] | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| steps: | |
| - name: Download wheels | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: wheels | |
| path: dist | |
| - name: Publish to PyPI | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| command: upload | |
| args: --non-interactive --skip-existing dist/* | |
| env: | |
| MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }} |