Skip to content

Commit

Permalink
Prep for v1.0.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
c-randall committed Dec 23, 2024
1 parent 6184a17 commit 9af8bb2
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 96 deletions.
30 changes: 16 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@ name: build-and-test
on:
push:
paths-ignore:
- '*.md'
- 'docs/**'
- 'images/**'
- 'LICENSE'
- 'SUNDIALS_LICENSE'
- '.github/ISSUE_TEMPLATE/**'
- "*.md"
- "docs/**"
- "images/**"
- "LICENSE"
- "SUNDIALS_LICENSE"
- ".github/ISSUE_TEMPLATE/**"

pull_request:
branches: [main]
paths-ignore:
- '*.md'
- 'docs/**'
- 'images/**'
- 'LICENSE'
- 'SUNDIALS_LICENSE'
- '.github/ISSUE_TEMPLATE/**'
- "*.md"
- "docs/**"
- "images/**"
- "LICENSE"
- "SUNDIALS_LICENSE"
- ".github/ISSUE_TEMPLATE/**"

jobs:
lint:
Expand All @@ -29,7 +29,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ['3.13']
python-version: ["3.13"]

defaults:
run:
Expand Down Expand Up @@ -63,7 +63,7 @@ jobs:
fail-fast: false
matrix:
os: [macos-13, macos-latest, windows-latest, ubuntu-latest]
python-version: ['3.9', '3.13']
python-version: ["3.9", "3.13"]

defaults:
run:
Expand All @@ -81,6 +81,8 @@ jobs:
environment-file: environments/ci_environment.yml
python-version: ${{ matrix.python-version }}
activate-environment: sun
channels: conda-forge
conda-remove-defaults: "true"

- name: Verify environment
run: |
Expand Down
128 changes: 47 additions & 81 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,24 @@ 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]+'
- "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.release.outputs.tag_version }}
tag_version: ${{ steps.tag.outputs.tag_version }}
local_version: ${{ steps.local.outputs.local_version }}

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Extract tag details
id: release
- name: Extract tag version details
id: tag
run: |
if [[ "${{ github.ref_type }}" = "tag" ]]; then
TAG_VERSION=${GITHUB_REF#refs/tags/v}
Expand All @@ -30,6 +31,20 @@ jobs:
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 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
Expand All @@ -41,71 +56,17 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.13'
python-version: "3.13"

- name: Fetch info from PyPI
run: |
response=$(curl -s https://pypi.org/pypi/scikit-sundae/json || echo "{}")
latest_pypi_version=$(echo "$response" | jq -r '.releases | keys | .[]' | sort -rV | head -n 1)
if [[ -z "$latest_pypi_version" ]]; then
echo "Package not found on PyPI."
latest_pypi_version="0.0.0"
fi
echo "Latest version on PyPI: $latest_pypi_version"
echo "latest_pypi_version=$latest_pypi_version" >> $GITHUB_ENV
- name: Compare version against PyPI and exit if not newer
- name: Check version details agasint PyPI, tag, etc.
run: |
TAG_VERSION=${{ needs.details.outputs.tag_version }}
PYPI_VERSION=$latest_pypi_version
TAG_BASE=${TAG_VERSION%%[a-z]}
PYPI_BASE=${PYPI_VERSION%%[a-z]}
TAG_SUFFIX=${TAG_VERSION#$TAG_BASE}
PYPI_SUFFIX=${PYPI_VERSION#$PYPI_BASE}
suffix_count=0
[[ -n "$TAG_SUFFIX" ]] && ((suffix_count++))
[[ -n "$PYPI_SUFFIX" ]] && ((suffix_count++))
if [[ "$TAG_VERSION" == "$PYPI_VERSION" ]]; then
echo "The tag $TAG_VERSION matches the PyPI version $PYPI_VERSION."
exit 1
elif [[ "$suffix_count" == 1 && "$TAG_BASE" == "$PYPI_BASE" ]]; then
if [[ -n "$PYPI_SUFFIX" ]]; then
echo "The tag $TAG_VERSION is newer than PyPI $PYPI_VERSION."
else
echo "The tag $TAG_VERSION is older than PyPI $PYPI_VERSION."
exit 1
fi
else
newest=$(printf "%s\n%s" "$TAG_VERSION" "$PYPI_VERSION" | sort -V | tail -n 1)
if [[ "$TAG_VERSION" == "$newest" ]]; then
echo "The tag $TAG_VERSION is newer than PyPI $PYPI_VERSION."
else
echo "The tag $TAG_VERSION is older than PyPI $PYPI_VERSION."
exit 1
fi
fi
- name: Verify tag and pyproject.toml versions match
env: # Don't let extensions compile, just grab version
BUILD_SDIST: 1
run: |
python -m pip install --upgrade pip
pip install setuptools numpy cython
LOCAL_VERSION=${{ needs.details.outputs.local_version }}
PKG_VERSION=$(python setup.py --version)
TAG_VERSION=${{ needs.details.outputs.tag_version }}
cd scripts
if [[ "$PKG_VERSION" != "$TAG_VERSION" ]]; then
echo "Version mismatch: setup.py has $PKG_VERSION, but tag is $TAG_VERSION."
exit 1
else
echo "Package and tag versions match: $PKG_VERSION == $TAG_VERSION."
fi
pip install requests packaging
python version_checker.py --tag="$TAG_VERSION" --local="$LOCAL_VERSION"
build-wheels:
name: (wheel ${{ matrix.python-version }}, ${{ matrix.os }})
Expand All @@ -116,7 +77,7 @@ jobs:
fail-fast: true
matrix:
os: [macos-13, macos-latest, windows-latest, ubuntu-latest]
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]

defaults:
run:
Expand All @@ -134,6 +95,8 @@ jobs:
environment-file: environments/ci_environment.yml
python-version: ${{ matrix.python-version }}
activate-environment: sun
channels: conda-forge
conda-remove-defaults: "true"

- name: Install build
run: pip install build
Expand All @@ -143,27 +106,28 @@ jobs:
conda info
conda list
- name: Set up environment variables for MacOS
if: runner.os == 'macOS'
run: |
echo "MACOSX_DEPLOYMENT_TARGET=11.0" >> $GITHUB_ENV
echo "LDFLAGS=-headerpad_max_install_names" >> $GITHUB_ENV
- name: Build wheels
env:
MACOSX_DEPLOYMENT_TARGET: '11.0'
LDFLAGS: -headerpad_max_install_names
run: python -m build --wheel

run: python -m build --wheel --verbose

- name: Repair Windows wheels
if: runner.os == 'Windows'
run: |
pip install delvewheel
for whl in dist/*sundae*.whl; do
delvewheel repair "$whl" -w wheels/ || exit 1;
delvewheel repair "$whl" -w wheels/ || exit 1;
done
- name: Set dylib path for delocate
if: runner.os == 'macOS'
run: echo "DYLD_LIBRARY_PATH=$CONDA_PREFIX/lib" >> $GITHUB_ENV

- name: Repair MacOS wheels
if: runner.os == 'macOS'
run: |
echo "DYLD_LIBRARY_PATH=$CONDA_PREFIX/lib" >> $GITHUB_ENV
pip install delocate
for whl in dist/*sundae*.whl; do
delocate-wheel "$whl" -w wheels/ || exit 1;
Expand Down Expand Up @@ -214,7 +178,7 @@ jobs:
fail-fast: true
matrix:
os: [ubuntu-latest]
python-version: ['3.13']
python-version: ["3.13"]

defaults:
run:
Expand All @@ -232,6 +196,8 @@ jobs:
environment-file: environments/ci_environment.yml
python-version: ${{ matrix.python-version }}
activate-environment: sun
channels: conda-forge
conda-remove-defaults: "true"

- name: Install build
run: pip install build
Expand Down Expand Up @@ -279,7 +245,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.13'
python-version: "3.13"

- name: Install twine
run: pip install twine
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# pyproject.toml

[build-system]
requires = ["setuptools", "cython>=3", "numpy"]
requires = ["setuptools", "cython", "numpy"]
build-backend = "setuptools.build_meta"

[project]
Expand Down

0 comments on commit 9af8bb2

Please sign in to comment.