Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 44 additions & 19 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,63 @@ name: Run tests

on:
push:
pull_request:
release:
workflow_dispatch:

# Cancel superseded runs on the same ref so stale jobs don't pile up.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:

test_ubuntu:
name: py${{ matrix.python-version }} / ${{ matrix.numpy-spec }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
# This workflow's unique job is to prove a NumPy-2-built package runs on
# NumPy 1.x (the gh-114 ABI path) from a source install. Per-OS / per-Python
# coverage with NumPy 2.x is already provided by the wheel build+test in
# pypi.yml, so we only need a small representative matrix here:
# - NumPy 1.x runtime on the oldest and a recent Python (the ABI path)
# - one NumPy 2.x source-build smoke test on the newest Python
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]

include:
- python-version: "3.9"
numpy-spec: "numpy>=1.19,<2"
- python-version: "3.12"
numpy-spec: "numpy>=1.19,<2"
- python-version: "3.13"
numpy-spec: "numpy>=2"

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
pip install numpy
pip install scipy
pip install Cython

- name: Install
run: |
pip install .

- name: Set up build environment (Fortran + ninja)
uses: ./.github/workflows/setup-build-env

- name: Build and install stripy
# Built with PEP 517 isolation -> compiled against NumPy 2.x
run: pip install .

- name: Pin runtime NumPy and install test deps
# Resolve together so the NumPy pin is honoured (a separate scipy/pytest
# resolve could otherwise pull NumPy back up).
run: pip install "${{ matrix.numpy-spec }}" pytest scipy

- name: Show resolved versions
run: pip list | grep -iE "numpy|stripy" || true

- name: Run tests
# Run from a neutral directory so the *installed* package (with its
# compiled extensions) is imported, not the ./stripy source-tree shadow.
run: |
pip install pytest
pytest -v
cd "${{ runner.temp }}"
python -m pytest -v "${{ github.workspace }}/stripy/tests"
35 changes: 16 additions & 19 deletions .github/workflows/build_deploy_jbdoc.yml
Original file line number Diff line number Diff line change
@@ -1,51 +1,48 @@
name: API docs / jupyterbook

# We should trigger this from an upload event
# We should trigger this from an upload event

on:
push: # We publish the beta docs as well
branches:
- master
branches:
- master
- dev

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: "3.11"

- name: Set up build environment (Fortran + ninja)
uses: ./.github/workflows/setup-build-env

- name: Install dependencies
- name: Install stripy and doc dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
pip install numpy
pip install scipy
pip install Cython
pip install jupyter-book

- name: Install latest stripy
run: |
pip install scipy jupyter-book
pip install .

- name: Build docs with jupyterbook
shell: bash -l {0}
run: |
VERSION=`python setup.py --version`
VERSION=`python -c "from importlib.metadata import version; print(version('stripy'))"`
echo "VERSION=$(echo $VERSION)" >> $GITHUB_ENV
cd jupyterbook
./build-book.sh
./build-book.sh

# Note deploy key needs the ----BEGIN ... KEY---- lines too

## Always deploy to version directory
- name: Deploy
uses: peaceiris/actions-gh-pages@v3

with:
github_token: ${{ secrets.GITHUB_TOKEN }}
destination_dir: ${{ env.VERSION }}
publish_dir: jupyterbook/_build/html


32 changes: 15 additions & 17 deletions .github/workflows/build_deploy_pdoc.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,30 @@
name: API docs / pdoc3
name: API docs / pdoc3

# We should trigger this from an upload event
# We should trigger this from an upload event

on:
push: # This is not really a great idea
push: # This is not really a great idea
branches:
- master

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Install dependencies
- name: Set up build environment (Fortran + ninja)
uses: ./.github/workflows/setup-build-env

- name: Install stripy and doc dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
pip install numpy
pip install scipy
pip install Cython
pip install pdoc3
pip install pytest

- name: Install latest stripy
run: |
pip install scipy pdoc3
pip install .

- name: Build docs with pdoc
Expand All @@ -38,15 +36,15 @@ jobs:
cd docs
pdoc --config latex_math=True --html -o api --force stripy

# Here we can add an action to build the jupyter book to a different directory
# Here we can add an action to build the jupyter book to a different directory
# and then they can be uploaded together. The jupyter book can contain a link to the
# API docs.

# Note deploy key needs the ----BEGIN ... KEY---- lines too
- name: Deploy
uses: peaceiris/actions-gh-pages@v3

with:
github_token: ${{ secrets.GITHUB_TOKEN }}
destination_dir: docs/
publish_dir: docs/api/stripy
publish_dir: docs/api/stripy
71 changes: 59 additions & 12 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,77 @@
name: Build wheels

on: [push,pull_request,release,workflow_dispatch]
on:
push:
branches: [master] # feature branches are covered by the pull_request event
pull_request:
release:
workflow_dispatch:

# Cancel superseded runs on the same ref so stale wheel builds don't pile up in
# the (slow) macOS runner queue.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
# Don't let one OS failing cancel (and mask) the others.
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-13, macos-14]
include:
- os: ubuntu-latest
- os: windows-latest
# Apple-silicon (arm64) only; Intel-mac (x86_64) users are served by conda.
- os: macos-14
macos_target: "14.0"

steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x

- name: Build wheels
uses: pypa/cibuildwheel@v2.20.0
uses: pypa/cibuildwheel@v2.21.3
env:
# Disable building PyPy wheels on all platforms
CIBW_SKIP: 'pp*'
CIBW_ENVIRONMENT_WINDOWS: "CFLAGS='-lquadmath'"
# PIP_ONLY_BINARY=scipy: install the test-time scipy from a wheel only.
# Otherwise pip may pick a scipy version with no wheel for the target
# interpreter and try to build it from source, which fails in the
# manylinux container (no OpenBLAS/build tooling). Forcing wheels makes
# pip fall back to the newest scipy that ships one.
CIBW_ENVIRONMENT_LINUX: "PIP_ONLY_BINARY=scipy"
CIBW_ENVIRONMENT_WINDOWS: "CFLAGS='-lquadmath' PIP_ONLY_BINARY=scipy"
# Homebrew's gfortran on the macos-14 runner targets the runner's
# macOS version, so the libgfortran/libquadmath that delocate bundles
# require that minimum. Match MACOSX_DEPLOYMENT_TARGET to the runner or
# delocate rejects the wheel ("Library dependencies do not satisfy
# target MacOS version"). (This does raise the wheel's minimum macOS;
# a portable gfortran targeting an older macOS could lower it later.)
CIBW_ENVIRONMENT_MACOS: "MACOSX_DEPLOYMENT_TARGET=${{ matrix.macos_target }} PIP_ONLY_BINARY=scipy"
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.9"
CIBW_ARCHS: 'auto64'
# Use the modern manylinux/musllinux images (GCC 12). The default
# manylinux2014 image ships GCC 10.2, but recent NumPy only publishes
# manylinux_2_28 wheels and its source build requires GCC >= 10.3, so
# the build-isolation NumPy install would fail there. manylinux_2_28
# has wheels available and a new enough compiler.
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
CIBW_MUSLLINUX_X86_64_IMAGE: musllinux_1_2
CIBW_BEFORE_BUILD_WINDOWS: "choco install ninja"
CIBW_BEFORE_BUILD_MACOS: "brew install ninja gcc && brew reinstall gcc"
# CIBW_BEFORE_BUILD_LINUX: "apt-get install -y ninja-build"
CIBW_BEFORE_BUILD: "pip install numpy meson-python ninja setuptools build"
CIBW_TEST_REQUIRES: pytest
# NumPy is NOT installed here on purpose: cibuildwheel builds with PEP 517
# isolation, so the compile-time NumPy comes from `build-system.requires`
# in pyproject.toml (numpy>=2.0), giving wheels that run on NumPy 1.x and 2.x.
# A system ninja just lets meson find one without a per-build pip install.
CIBW_BEFORE_BUILD: "pip install ninja"
# scipy is needed by the mesh tests (stripy uses scipy.optimize/spatial lazily)
CIBW_TEST_REQUIRES: pytest scipy
CIBW_TEST_COMMAND: "pytest {project}/stripy/tests"
# ...
# with:
Expand All @@ -38,6 +81,9 @@ jobs:

- uses: actions/upload-artifact@v4
with:
# Unique name per matrix job: upload-artifact@v4 rejects duplicate
# artifact names within a run, so a shared default name would fail the build.
name: cibw-wheels-${{ matrix.os }}
path: ./wheelhouse/*.whl

build_sdist:
Expand All @@ -51,6 +97,7 @@ jobs:

- uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: dist/*.tar.gz

upload_pypi:
Expand All @@ -63,11 +110,11 @@ jobs:
# or, alternatively, upload to PyPI on every tag starting with 'v' (remove on: release above to use this)
# if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/download-artifact@v4.1.7
- uses: actions/download-artifact@v4
with:
# unpacks default artifact into dist/
# if `name: artifact` is omitted, the action will create extra parent dir
name: artifact
# Gather every wheel/sdist artifact from the build jobs into dist/
pattern: cibw-*
merge-multiple: true
path: dist

- uses: pypa/gh-action-pypi-publish@release/v1
Expand Down
11 changes: 0 additions & 11 deletions .github/workflows/resources/conda_api_docs_environment.yml

This file was deleted.

13 changes: 0 additions & 13 deletions .github/workflows/resources/conda_build_environment.yml

This file was deleted.

22 changes: 0 additions & 22 deletions .github/workflows/resources/conda_jb_docs_environment.yml

This file was deleted.

14 changes: 0 additions & 14 deletions .github/workflows/resources/conda_test_environment.yml

This file was deleted.

Loading
Loading