Skip to content

Merge pull request #43 from bug/np24except #89

Merge pull request #43 from bug/np24except

Merge pull request #43 from bug/np24except #89

Workflow file for this run

name: release
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+a[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+b[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+rc[0-9]+"
jobs:
details:
runs-on: ubuntu-latest
outputs:
tag_version: ${{ steps.tag.outputs.tag_version }}
local_version: ${{ steps.local.outputs.local_version }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.14"
- name: Extract tag version details
id: tag
run: |
if [[ "${{ github.ref_type }}" = "tag" ]]; then
TAG_VERSION=${GITHUB_REF#refs/tags/v}
echo "tag_version=$TAG_VERSION" >> "$GITHUB_OUTPUT"
echo "Tag version is $TAG_VERSION"
else
echo "No tag found"
exit 1
fi
- name: Extract local package version
id: local
env: # Don't let extensions compile, just grab version
BUILD_SDIST: 1
run: |
python -m pip install --upgrade pip
pip install --upgrade setuptools numpy cython
LOCAL_VERSION=$(python setup.py --version)
echo "local_version=$LOCAL_VERSION" >> "$GITHUB_OUTPUT"
echo "Local version is $LOCAL_VERSION"
check-version:
needs: details
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.14"
- name: Check version details agasint PyPI, tag, etc.
run: |
TAG_VERSION=${{ needs.details.outputs.tag_version }}
LOCAL_VERSION=${{ needs.details.outputs.local_version }}
cd scripts
pip install requests packaging
python version_checker.py --tag="$TAG_VERSION" --local="$LOCAL_VERSION"
build-wheels:
name: (wheels, ${{ matrix.os }})
needs: [details, check-version]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, macos-15-intel, macos-latest, windows-latest]
defaults:
run:
shell: bash -el {0}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Python and SUNDIALS
if: runner.os != 'Linux'
uses: mamba-org/setup-micromamba@v2
with: # ci_environment.yml specifies sundials version to compile
environment-file: environments/ci_environment.yml
create-args: python=3.14
- name: List info
if: runner.os != 'Linux'
run: |
micromamba info
micromamba list
- name: Install cibuildwheel
run: python -m pip install cibuildwheel
- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_SKIP: "cp3??t-* *-win32 *-manylinux_i686 *-musllinux_*"
CIBW_ENVIRONMENT_WINDOWS: >-
PATH="$CONDA_PREFIX/Library;$PATH"
SUNDIALS_PREFIX="$CONDA_PREFIX/Library"
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: >
pip install delvewheel &&
delvewheel repair -w {dest_dir} --add-dll openblas.dll {wheel}
CIBW_ENVIRONMENT_MACOS: >-
SUNDIALS_PREFIX="$CONDA_PREFIX"
MACOSX_DEPLOYMENT_TARGET="11.0"
LDFLAGS="-headerpad_max_install_names"
CIBW_REPAIR_WHEEL_COMMAND_MACOS: >
export DYLD_LIBRARY_PATH="$CONDA_PREFIX/lib" &&
delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}
CIBW_BEFORE_ALL_LINUX: bash scripts/install_sundials_linux.sh
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_ENVIRONMENT_LINUX: >-
SUNDIALS_PREFIX="/root/.local/share/mamba/envs/sun"
LD_LIBRARY_PATH="/root/.local/share/mamba/envs/sun/lib:$LD_LIBRARY_PATH"
CIBW_TEST_REQUIRES: pytest pandas
CIBW_TEST_COMMAND: pytest {project}/tests
- name: List files in wheelhouse dir
run: |
if [[ "$RUNNER_OS" == "Windows" ]]; then
dir wheelhouse
else
ls wheelhouse
fi
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: dist-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: wheelhouse/*.whl
build-sdist:
name: (sdist, ${{ matrix.os }})
needs: [details, check-version]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest]
python-version: ["3.14"]
defaults:
run:
shell: bash -el {0}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Python and SUNDIALS
uses: mamba-org/setup-micromamba@v2
with: # ci_environment.yml specifies sundials version to compile
environment-file: environments/ci_environment.yml
create-args: python=${{ matrix.python-version }}
- name: Install build
run: pip install build
- name: Build sdist
env: # Don't compile extensions if just building sdist
BUILD_SDIST: 1
run: |
echo "BUILD_SDIST is set to: $BUILD_SDIST"
python -m build --sdist
- name: Test source installation
env: # Make sure extensions compile during actual install
BUILD_SDIST: 0
run: |
echo "BUILD_SDIST is set to: $BUILD_SDIST"
python -m pip install --upgrade pip
pip install dist/*.tar.gz -v
pip install pandas pytest
pytest ./tests
- name: Upload tarball
uses: actions/upload-artifact@v4
with:
name: dist-sdist
path: dist/*.tar.gz
pypi-publish:
name: Upload to PyPI
needs: [build-wheels, build-sdist]
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: dist/
pattern: dist-*
merge-multiple: true
- name: Check files
run: ls dist
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.14"
- name: Install twine
run: pip install twine
- name: Check builds and upload to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
twine check dist/*
twine upload dist/*