define bash for win #12
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 Multi-Platform Free-Threaded | |
| on: | |
| push: | |
| branches: | |
| - test-free-threaded | |
| workflow_dispatch: | |
| jobs: | |
| build-wheels: | |
| name: Build wheels on ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| #os: [macos-latest, ubuntu-latest, windows-latest] | |
| #os: [macos-latest] | |
| os: [windows-latest] | |
| outputs: | |
| version: ${{ steps.extract_version.outputs.version }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Cache Rust dependencies | |
| uses: swatinem/rust-cache@v2 | |
| with: | |
| workspaces: | | |
| . | |
| py-polars/runtime/polars-runtime-32 | |
| - name: Setup uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| enable-cache: true | |
| cache-dependency-glob: "**/Cargo.toml" | |
| - name: Install Python 3.13t and 3.14t | |
| run: | | |
| uv python install 3.13t | |
| uv python install 3.14t | |
| - name: Build wheels | |
| shell: bash | |
| run: | | |
| # Patch all Cargo.toml files to remove abi3 feature safely | |
| # We use a broad replacement to ensure no abi3 remains | |
| uv run python -c " | |
| import os | |
| for root, dirs, files in os.walk('.'): | |
| if 'target' in dirs: dirs.remove('target') | |
| for file in files: | |
| if file.endswith('.toml'): | |
| path = os.path.join(root, file) | |
| with open(path, 'r') as f: | |
| content = f.read() | |
| if 'abi3-py39' in content: | |
| print(f'Patching {path}') | |
| content = content.replace('\"abi3-py39\", ', '').replace(', \"abi3-py39\"', '').replace('\"abi3-py39\"', '') | |
| with open(path, 'w') as f: | |
| f.write(content) | |
| " | |
| # Root Cargo.toml: Ensure no abi3 feature is left in the workspace dependency | |
| uv run python -c " | |
| path = 'Cargo.toml' | |
| with open(path, 'r') as f: | |
| content = f.read() | |
| if 'abi3-py39' in content: | |
| content = content.replace('\"abi3-py39\", ', '').replace(', \"abi3-py39\"', '').replace('\"abi3-py39\"', '') | |
| with open(path, 'w') as f: | |
| f.write(content) | |
| " | |
| # Get absolute paths to interpreters to avoid discovery issues in maturin | |
| PY313T=$(uv python find 3.13t) | |
| PY314T=$(uv python find 3.14t) | |
| echo "Using interpreters: $PY313T and $PY314T" | |
| # Build 3.13t | |
| uv run --with maturin maturin build -m py-polars/runtime/polars-runtime-32/Cargo.toml --release --compatibility pypi --interpreter "$PY313T" | |
| # Build 3.14t | |
| uv run --with maturin maturin build -m py-polars/runtime/polars-runtime-32/Cargo.toml --release --compatibility pypi --interpreter "$PY314T" | |
| - name: Build Polars wrapper package | |
| shell: bash | |
| run: | | |
| cd py-polars | |
| uv build | |
| cp dist/*.whl ../target/wheels/ | |
| - name: Extract version | |
| id: extract_version | |
| shell: bash | |
| run: | | |
| VERSION=$(grep "^version =" py-polars/runtime/polars-runtime-32/Cargo.toml | head -n 1 | cut -d '\"' -f 2) | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Upload wheels to artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-${{ matrix.os }} | |
| path: target/wheels/*.whl | |
| release: | |
| name: Create Release | |
| needs: build-wheels | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download all wheels | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: wheels | |
| merge-multiple: true | |
| - name: Create or Update Release | |
| uses: softprop/action-gh-release@v2 | |
| with: | |
| tag_name: "v${{ needs.build-wheels.outputs.version }}-ft" | |
| name: "Polars Free-Threaded v${{ needs.build-wheels.outputs.version }}" | |
| files: wheels/*.whl | |
| generate_release_notes: true | |
| draft: false | |
| prerelease: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |