Skip to content

Commit

Permalink
Merge pull request #4 from firedrakeproject/connorjward/merge-upstream
Browse files Browse the repository at this point in the history
Connorjward/merge upstream
  • Loading branch information
connorjward authored Dec 4, 2024
2 parents db2ab02 + 1d50f77 commit 06d2da8
Show file tree
Hide file tree
Showing 70 changed files with 1,390 additions and 1,427 deletions.
184 changes: 184 additions & 0 deletions .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
---
name: Build
concurrency:
group: ${{ github.workflow }}-${{ github.event.number }}-${{ github.event.ref }}
cancel-in-progress: true

# Adapted from https://github.com/matplotlib/matplotlib/blob/main/.github/workflows/nightlies.yml
# and https://cibuildwheel.pypa.io/en/stable/setup/#github-actions

# 1. Move as much as possible to pyproject.toml instead of using env vars
# 2. Use native compiling for macOS via -13 (Intel) and -14 (arm) runners
# 3. For aarch64, only ever test py312 and skip testing other python versions
# (for speed).
# 4. Split aarch64 python version builds over jobs, for all other systems/archs build
# wheels for all Python versions in a single job (for speed).
# 5. On pushes, build and test all wheels and push as release artifacts (in
# draft mode for main branch pushes).
# 6. On scheduled runs, build and test all wheels against
# scientific-python-nightly-wheels NumPy dev, then upload the resulting wheels there.
# 7. On PRs, only build one aarch64 wheel (for speed).
# 8. On PRs, build against NumPy dev if [pip-pre] is in the commit message.
# 9. On PRs, build all aarch64 variants if [aarch64] is in the commit message.

on:
# Run daily at 1:23 UTC to upload nightly wheels to Anaconda Cloud
schedule:
- cron: '23 1 * * *'
# Run on demand with workflow dispatch
workflow_dispatch:
# Run on all PRs
pull_request:
# Run on tags
push:
branches:
- master
tags:
- '*'

permissions:
actions: read
contents: write

jobs:
build_wheels:
name: 'Wheels: ${{ matrix.os }} ${{ matrix.arch }} ${{ matrix.python }}'
runs-on: ${{ matrix.os }}
continue-on-error: true
strategy:
matrix:
# Wheel builds are fast except for aarch64, so split that into multiple jobs,
# one for each Python version
os: [ubuntu-latest]
arch: [aarch64]
python:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
include:
- os: ubuntu-latest
arch: x86_64
- os: windows-latest
arch: AMD64
- os: macos-14
arch: arm64
- os: macos-13
arch: x86_64
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # get the non-merge commit for PRs

# Get HDF5 outside of cibuildwheel so that we can set env vars via GITHUB_ENV
# inside the HDF5-getting scripts and have them be in effect for the
# cibuildwheel step.

# Cache HDF5
- name: Cache built HDF5
uses: actions/cache@v4
with:
key: ${{ matrix.os }}-${{ matrix.arch }}-6
path: cache/hdf5

# Windows HDF5
- uses: nuget/setup-nuget@v2
if: runner.os == 'Windows'
- uses: actions/setup-python@v5
with:
python-version: 3.12
if: runner.os == 'Windows'
- run: bash ./ci/cibw_before_all_windows.sh "${{ github.workspace }}"
if: runner.os == 'Windows'

# macOS HDF5
- run: bash ./ci/cibw_before_all_macos.sh "${{ github.workspace }}"
if: runner.os == 'macOS'

# Linux emulation for aarch64 support
# https://cibuildwheel.pypa.io/en/stable/faq/#emulation
- uses: docker/setup-qemu-action@v3
with:
platforms: all
if: runner.os == 'Linux' && matrix.arch == 'aarch64'

# Triage build, and set outputs.skip = 1 if on aarch64 and we don't want to build the wheel
- run: bash ./ci/triage_build.sh "${{ matrix.arch }}" "${{ github.event.pull_request.head.sha || github.sha }}" "${{ matrix.python }}"
id: triage

# Now actually build the wheels
- uses: pypa/[email protected]
env:
# Note that tool.cibuildwheel "skip" in pyproject.toml also limits what gets built
CIBW_ARCHS: ${{ matrix.arch }}
CIBW_BUILD: ${{ env.CIBW_BUILD }}
CIBW_SKIP: ${{ env.CIBW_SKIP }}
CIBW_BEFORE_BUILD: ${{ env.CIBW_BEFORE_BUILD }}
CIBW_BUILD_FRONTEND: ${{ env.CIBW_BUILD_FRONTEND }}
TOX_TEST_LIMITED: ${{ env.TOX_TEST_LIMITED }}
CIBW_PRERELEASE_PYTHONS: ${{ env.CIBW_PRERELEASE_PYTHONS }}
CIBW_BEFORE_TEST: ${{ env.CIBW_BEFORE_TEST }}
if: steps.triage.outputs.skip != '1'

- run: python ./ci/bundle_hdf5_whl.py wheelhouse
if: steps.triage.outputs.skip != '1' && runner.os == 'Windows'

# And upload the results
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl
if: steps.triage.outputs.skip != '1'

upload_wheels:
name: Upload wheels
needs: build_wheels
runs-on: ubuntu-latest
defaults:
run:
shell: bash -el {0}
steps:
- uses: actions/download-artifact@v4
with:
pattern: cibw-wheels-*
merge-multiple: true
path: dist
- run: pwd && ls -alt . && ls -alt dist/
# If it's a PR, do nothing else.
# If it's a scheduled run, it was built with nightly NumPy, push to scientific-python:
- name: Upload wheels to Anaconda Cloud as nightlies
uses: scientific-python/upload-nightly-action@82396a2ed4269ba06c6b2988bb4fd568ef3c3d6b # 0.6.1
with:
artifacts_path: dist
anaconda_nightly_upload_token: ${{ secrets.ANACONDA_ORG_UPLOAD_TOKEN }}
if: github.repository_owner == 'h5py' && github.event_name == 'schedule'
# If it's a push to master, create a (private) draft release;
# If it's a tag, publish it to the existing public release, knowing that the tag name
# is the same as th release name:
- name: Set release variables
id: vars
run: |
set -eo pipefail
if [[ "${{ github.ref_type }}" == "tag" ]]; then
RELEASE_NAME="" # will use the tag name, which we always set to the release name
GENERATE=false
else
RELEASE_NAME=dev
GENERATE=true
fi
echo "release_name=$RELEASE_NAME" >> $GITHUB_OUTPUT
echo "generate=$GENERATE" >> $GITHUB_OUTPUT
- name: Upload to GitHub releases
uses: softprops/action-gh-release@v2
# https://github.com/softprops/action-gh-release?tab=readme-ov-file#inputs
with:
name: ${{ steps.vars.outputs.release_name }}
# Note that draft releases are not public
draft: ${{ github.ref_type != 'tag' }}
prerelease: ${{ github.ref_type != 'tag' }}
generate_release_notes: ${{ steps.vars.outputs.generate }}
files: |
dist/*.whl
if: github.repository_owner == 'h5py' && github.event_name == 'push'
2 changes: 1 addition & 1 deletion .github/workflows/lowlevel-api-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.8'
python-version: '3.9'

- name: Install tox
run: |
Expand Down
106 changes: 0 additions & 106 deletions .github/workflows/nightlies.yml

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ MANIFEST
coverage.xml
.vscode/
.mypy_cache/
/cache/

# Rever
rever/
Expand Down
36 changes: 7 additions & 29 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
language: python
os: linux
dist: focal
dist: jammy
arch: ppc64le
python: 3.11

notifications:
email: false
Expand All @@ -20,44 +22,20 @@ env:
global:
- HDF5_CACHE_DIR=$HOME/.cache/hdf5
- TERM=dumb
- TOXENV=py311-test-deps
- HDF5_VERSION=1.10.6
- HDF5_DIR=$HDF5_CACHE_DIR/$HDF5_VERSION
- H5PY_ENFORCE_COVERAGE=yes

jobs:
include:
# needed to work around https://github.com/travis-ci/travis-ci/issues/4794
# TODO: We should see if we can replace this with installing python via pyenv # based on toxenv
# Test on ppc64le
- arch: ppc64le
python: 3.9
env:
- TOXENV=py39-test-deps
- TOX_OPTS="--force-dep numpy<1.23"
- HDF5_VERSION=1.10.5
- HDF5_DIR=$HDF5_CACHE_DIR/$HDF5_VERSION
- H5PY_ENFORCE_COVERAGE=yes
- arch: arm64
services: docker
python: 3.9
virt: vm
env:
- TOXENV=py39-test-deps
- TOX_OPTS=""
- HDF5_VERSION=1.10.5
- HDF5_DIR=$HDF5_CACHE_DIR/$HDF5_VERSION
- H5PY_ENFORCE_COVERAGE=yes
- CIBW_BUILD: cp3*-manylinux*
- CIBW_MANYLINUX_AARCH64_IMAGE: ghcr.io/h5py/manylinux2014_aarch64-hdf5
- CIBW_ARCHS: aarch64
before_install:
# - export PATH=/usr/lib/ccache:$PATH
- ccache -s

install:
- pip install -U pip tox codecov virtualenv
- ci/get_hdf5_if_needed.sh
- if [[ $CIBW_ARCHS == aarch64 ]]; then python -m pip install 'cibuildwheel<2.16.2'; fi

script:
- if [[ $CIBW_ARCHS == aarch64 ]]; then python3 -m cibuildwheel --output-dir wheelhouse; fi
- tox legacy -v $TOX_OPTS 2>&1
- sleep 5

Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
HDF5 for Python
===============
`h5py` is a thin, pythonic wrapper around `HDF5 <https://portal.hdfgroup.org/hdf5/develop/index.html>`_,
which runs on Python 3 (3.8+).
which runs on Python 3 (3.9+).

Websites
--------
Expand Down
Loading

0 comments on commit 06d2da8

Please sign in to comment.