Merge pull request #329 from abstractqqq/correct_hist_plot_stacking #694
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: CI | |
permissions: | |
id-token: write | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- "*" | |
pull_request: | |
workflow_dispatch: | |
inputs: | |
# Latest commit to include with the release. If omitted, use the latest commit on the main branch. | |
sha: | |
description: Commit SHA | |
type: string | |
defaults: | |
run: | |
shell: bash | |
env: | |
PYTHON_VERSION: '3.9' | |
jobs: | |
create-sdist: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
package: [polars_ds] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ inputs.sha }} | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Create source distribution | |
uses: PyO3/maturin-action@v1 | |
with: | |
command: sdist | |
args: > | |
--manifest-path Cargo.toml | |
--out dist | |
maturin-version: 1.7.4 | |
- name: Test sdist | |
run: | | |
pip install -r requirements.txt | |
pip install typing_extensions | |
pip install --force-reinstall --verbose dist/*.tar.gz | |
python -c 'import polars_ds as pds' | |
python -c 'from polars_ds import linear_models' | |
python -c 'from polars_ds.spatial import *' | |
python -c 'from polars_ds.sample_and_split import *' | |
python -c 'from polars_ds.exprs.ts_features import *' | |
- name: Upload sdist | |
uses: actions/upload-artifact@v4 | |
with: | |
name: sdist-${{ matrix.package }} | |
path: dist/*.tar.gz | |
build-wheels: | |
runs-on: ${{ matrix.os }} | |
needs: [create-sdist] | |
strategy: | |
fail-fast: false | |
matrix: | |
package: [polars_ds] | |
os: [ubuntu-latest, macos-13, windows-latest] | |
architecture: [x86-64, aarch64] | |
exclude: | |
- os: windows-latest | |
architecture: aarch64 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ inputs.sha }} | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Determine CPU features for x86-64 | |
id: features | |
if: matrix.architecture == 'x86-64' | |
# env: | |
# IS_LTS_CPU: ${{ matrix.package == 'polars_ds_lts_cpu' }} | |
# if [[ "$IS_LTS_CPU" = true ]]; then | |
# FEATURES=+sse3,+ssse3,+sse4.1,+sse4.2,+popcnt,+cmpxchg16b | |
# CC_FEATURES="-msse3 -mssse3 -msse4.1 -msse4.2 -mpopcnt -mcx16" | |
# else | |
# fi | |
run: | | |
TUNE_CPU=skylake | |
FEATURES=+sse3,+ssse3,+sse4.1,+sse4.2,+popcnt,+cmpxchg16b,+avx,+avx2,+fma,+bmi1,+bmi2,+lzcnt,+pclmulqdq,+movbe | |
CC_FEATURES="-msse3 -mssse3 -msse4.1 -msse4.2 -mpopcnt -mcx16 -mavx -mavx2 -mfma -mbmi -mbmi2 -mlzcnt -mpclmul -mmovbe" | |
echo "features=$FEATURES" >> $GITHUB_OUTPUT | |
echo "tune_cpu=$TUNE_CPU" >> $GITHUB_OUTPUT | |
echo "cc_features=$CC_FEATURES" >> $GITHUB_OUTPUT | |
- name: Set RUSTFLAGS for x86-64 | |
if: matrix.architecture == 'x86-64' | |
env: | |
FEATURES: ${{ steps.features.outputs.features }} | |
TUNE_CPU: ${{ steps.features.outputs.tune_cpu }} | |
CC_FEATURES: ${{ steps.features.outputs.cc_features }} | |
# CFG: ${{ matrix.package == 'polars_ds_lts_cpu' && '--cfg allocator="default"' || '' }} | |
# add $CFG | |
run: | | |
if [[ -z "$TUNE_CPU" ]]; then | |
echo "RUSTFLAGS=-C target-feature=$FEATURES" >> $GITHUB_ENV | |
echo "CFLAGS=$CC_FEATURES" >> $GITHUB_ENV | |
else | |
echo "RUSTFLAGS=-C target-feature=$FEATURES -Z tune-cpu=$TUNE_CPU" >> $GITHUB_ENV | |
echo "CFLAGS=$CC_FEATURES -mtune=$TUNE_CPU" >> $GITHUB_ENV | |
fi | |
- name: Set Rust target for aarch64 | |
if: matrix.architecture == 'aarch64' | |
id: target | |
run: | | |
TARGET=$( | |
if [[ "${{ matrix.os }}" == "macos-13" ]]; then | |
echo "aarch64-apple-darwin"; | |
else | |
echo "aarch64-unknown-linux-gnu"; | |
fi | |
) | |
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 Cargo.toml | |
--out dist | |
manylinux: ${{ matrix.architecture == 'aarch64' && '2_24' || 'auto' }} | |
maturin-version: 1.7.4 | |
- name: Test wheel | |
# Only test on x86-64 for now as this matches the runner architecture | |
if: matrix.architecture == 'x86-64' | |
run: | | |
pip install --force-reinstall --verbose dist/*.whl | |
pip install typing_extensions | |
pip install -r requirements.txt | |
python -c 'import polars_ds' | |
python -c 'from polars_ds import linear_models' | |
python -c 'from polars_ds.spatial import *' | |
python -c 'from polars_ds.sample_and_split import *' | |
- name: Upload wheel | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheel-${{ matrix.package }}-${{ matrix.os }}-${{ matrix.architecture }} | |
path: dist/*.whl | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
if: "startsWith(github.ref, 'refs/tags/')" | |
needs: [build-wheels, create-sdist] | |
permissions: | |
id-token: write | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
pattern: wheel-* | |
merge-multiple: true | |
- uses: actions/download-artifact@v4 | |
with: | |
pattern: sdist-* | |
merge-multiple: true | |
- name: Publish to PyPI | |
uses: PyO3/maturin-action@v1 | |
with: | |
command: upload | |
args: --non-interactive --skip-existing * |