Refactor release #33
Workflow file for this run
This file contains 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: Release Python | |
on: | |
pull_request: | |
push: | |
tags: | |
- py-* | |
env: | |
PYTHON_VERSION: '3.8' | |
CARGO_INCREMENTAL: 0 | |
CARGO_NET_RETRY: 10 | |
RUSTUP_MAX_RETRIES: 10 | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
build-wheels: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
package: [polars, polars-lts-cpu] #, polars-u64-idx] | |
os: [ubuntu-latest] #, macos-latest, windows-32gb-ram] | |
architecture: [x86-64, aarch64] | |
steps: | |
- uses: actions/checkout@v4 | |
# Avoid potential out-of-memory errors | |
- name: Set swap space for Linux | |
if: matrix.os == 'ubuntu-latest' | |
uses: pierotofy/set-swap-space@master | |
with: | |
swap-size-gb: 10 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Fix README symlink | |
run: | | |
rm py-polars/README.md | |
cp README.md py-polars/README.md | |
- name: Install yq | |
if: matrix.package != 'polars' | |
run: pip install yq | |
- name: Update package name | |
if: matrix.package != 'polars' | |
run: tomlq -i -t ".project.name = \"${{ matrix.package }}\"" py-polars/pyproject.toml | |
- name: Add bigidx feature | |
if: matrix.package == 'polars-u64-idx' | |
run: tomlq -i -t '.dependencies.polars.features += ["bigidx"]' py-polars/Cargo.toml | |
- name: Set RUSTFLAGS for x86-64 | |
if: matrix.architecture == 'x86-64' && matrix.package != 'polars-lts-cpu' | |
run: echo "RUSTFLAGS=-C target-feature=+sse3,+ssse3,+sse4.1,+sse4.2,+popcnt,+avx,+fma" >> $GITHUB_ENV | |
- name: Set RUSTFLAGS for x86-64 LTS CPU | |
if: matrix.architecture == 'x86-64' && matrix.package == 'polars-lts-cpu' | |
run: echo "RUSTFLAGS=-C target-feature=+sse3,+ssse3,+sse4.1,+sse4.2,+popcnt --cfg use_mimalloc" >> $GITHUB_ENV | |
- name: Set Rust target for aarch64 | |
if: matrix.architecture == 'aarch64' | |
id: target | |
run: | | |
TARGET=${{ matrix.os == 'macos-latest' && 'aarch64-apple-darwin' || 'aarch64-unknown-linux-gnu'}} | |
echo "target=$TARGET" >> $GITHUB_OUTPUT | |
- name: Set jemalloc for aarch64 Linux | |
if: matrix.architecture == 'aarch64' && matrix.os == 'ubuntu-latest' | |
run: | | |
echo "JEMALLOC_SYS_WITH_LG_PAGE=16" >> $GITHUB_ENV | |
- name: Build wheel | |
uses: PyO3/maturin-action@v1 | |
with: | |
command: build | |
target: ${{ steps.target.outputs.target }} | |
args: > | |
--release | |
--manifest-path py-polars/Cargo.toml | |
--out dist | |
${{ matrix.os == 'ubuntu-latest' && matrix.architecture == 'x86-64' && '--sdist' || ''}} | |
manylinux: auto | |
- name: Upload sdist | |
if: matrix.os == 'ubuntu-latest' && matrix.architecture == 'x86-64' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: sdist | |
path: dist/*.tar.gz | |
- name: Upload wheels | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: dist/*.whl | |
publish-to-pypi: | |
needs: build-wheels | |
environment: | |
name: release-python | |
url: https://pypi.org/project/polars | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
steps: | |
- name: Download sdist | |
uses: actions/download-artifact@v3 | |
with: | |
name: sdist | |
path: dist | |
- name: Download wheels | |
uses: actions/download-artifact@v3 | |
with: | |
name: wheels | |
path: dist | |
- name: Publish to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
verbose: true | |
update-github-release: | |
needs: build-wheels | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download sdist | |
uses: actions/download-artifact@v3 | |
with: | |
name: sdist | |
path: dist | |
- name: Upload sdist as asset to GitHub release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
file: dist/polars-*.tar.gz | |
file_glob: true | |
overwrite: true |