Skip to content

[WIP] Support numpy 2.0 #1288

[WIP] Support numpy 2.0

[WIP] Support numpy 2.0 #1288

name: Mac and Windows Builds
on:
push:
branches:
- 'master'
tags:
- '*'
pull_request:
branches:
- '*'
# Cancel older runs of the same workflow on the same branch
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-and-deploy:
strategy:
matrix:
python3-minor-version: [9, 10, 11, 12]
# TODO: Figure out macos-14/macos-latest
os: [macos-13, ubuntu-latest, windows-latest]
defaults:
run:
shell: bash
env:
PYTHON_VERSION: ${{ format('3.{0}', matrix.python3-minor-version) }}
PYTHON_EXECUTABLE: ${{ format('cp3{0}', matrix.python3-minor-version) }}
SETUPTOOLS_USE_DISTUTILS: ${{ matrix.python3-minor-version == 12 && 'local' || 'stdlib' }}
runs-on: ${{ matrix.os }}
name: Build and Deploy (${{ matrix.os }}, 3.${{ matrix.python3-minor-version }})
steps:
- name: Checkout
uses: actions/checkout@v3
# Python interpreter used by cibuildwheel, but it uses a different one internally
- name: Setting up Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v2
with:
platforms: all
# We build the source archive separately because of this: https://github.com/alkaline-ml/pmdarima/pull/136#discussion_r279781731
# We build it first because of this: https://github.com/alkaline-ml/pmdarima/issues/448
- name: Building source distribution
run: make version sdist
- name: Install cibuildwheel
run: python -m pip install 'cibuildwheel<2.20.0'
- name: Building and testing wheels
run: python -m cibuildwheel --output-dir dist
env:
# TODO: Move Linux x86_64 builds to GHA?
CIBW_ARCHS_LINUX: "aarch64"
CIBW_ARCHS_MACOS: "x86_64 arm64"
CIBW_ARCHS_WINDOWS: "AMD64"
CIBW_BEFORE_ALL: make version
CIBW_BEFORE_BUILD: >
pip install -r build_tools/build_requirements.txt &&
pip install -r requirements.txt
# Tests are run in a separate virtual env, so we need to re-install deps
CIBW_BEFORE_TEST: >
pip install -r build_tools/build_requirements.txt &&
pip install -r requirements.txt
CIBW_BUILD: "${{ env.PYTHON_EXECUTABLE }}-*"
CIBW_ENVIRONMENT: CC=gcc SETUPTOOLS_USE_DISTUTILS=${{ env.SETUPTOOLS_USE_DISTUTILS }}
CIBW_ENVIRONMENT_MACOS: PMD_MPL_BACKEND=TkAgg PYTHON_CROSSENV=true SETUPTOOLS_USE_DISTUTILS=${{ env.SETUPTOOLS_USE_DISTUTILS }}
CIBW_ENVIRONMENT_PASS_LINUX: GITHUB_REF
# No support for pypy or musl
CIBW_SKIP: "pp* *-musllinux_*"
# Runs tests and checks for a numpy regression by upgrading numpy and running tests again
CIBW_TEST_COMMAND: >
pytest --showlocals --durations=20 --pyargs pmdarima
# TODO: Add these back
# pip install --upgrade scipy numpy &&
# pytest --showlocals --durations=20 --pyargs pmdarima
# Avoid testing on emulated architectures
CIBW_TEST_SKIP: "*-*linux_{aarch64,ppc64le,s390x} *-macosx_arm64"
- name: Checking README compatibility
run: |
python -m pip install "twine>=1.13.0" readme_renderer
if python -c "from twine.commands.check import check; check(['dist/*'])" | grep "warning"; then
echo "README will not render properly on PyPI"
exit 1
else
echo "README rendered appropriately"
fi
# See https://github.com/alkaline-ml/pmdarima/issues/448
- name: Ensuring sdist SOURCES.txt has no absolute paths
run: |
cd dist
tar xzf $(find . -name "*.tar.gz")
OUTPUT_DIRECTORY=$(find . -type d -name "pmdarima-*")
if grep -q "^/" ${OUTPUT_DIRECTORY}/pmdarima.egg-info/SOURCES.txt; then
echo "SOURCES.txt contains absolute paths in sdist"
exit 1
else
echo "SOURCES.txt looks good"
rm -rf "$OUTPUT_DIRECTORY"
fi
- name: Ensuring sdist can be installed
run: pip install dist/$(ls dist | grep tar)
- name: Ensuring VERSION file exists
id: version_check # Need this to refer to output below
run: |
if [ -f "${GITHUB_WORKSPACE}/pmdarima/VERSION" ]; then
echo "VERSION file exists"
echo "version_exists=true" >> $GITHUB_OUTPUT
else
echo "VERSION file does not exist"
echo "version_exists=false" >> $GITHUB_OUTPUT
fi
- name: Deploying to PyPI
# Only deploy on tags and when VERSION file created
if: startsWith(github.ref, 'refs/tags') && success() && steps.version_check.outputs.version_exists == 'true'
run: |
chmod +x build_tools/github/deploy.sh
./build_tools/github/deploy.sh
env:
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}