Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add general improvements to new workflow #621

Merged
merged 8 commits into from
Feb 25, 2025
Merged
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
47 changes: 10 additions & 37 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
strategy:
matrix:
package: [basemap_data, basemap_data_hires]
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4

Expand All @@ -48,35 +48,7 @@ jobs:
needs: [build_data]
strategy:
matrix:
include:
- os: ubuntu-latest
arch: x86_64
before_all: >-
echo "Starting BEFORE_ALL script" &&
echo "GEOS_DIR set to: ${GEOS_DIR}" &&
cd "{package}" &&
python -c "import utils; utils.GeosLibrary('${GEOS_VERSION}').build('${GEOS_DIR}', njobs=2)"
- os: macos-13
arch: x86_64
before_all: >-
echo "Starting BEFORE_ALL script" &&
echo "GEOS_DIR set to: ${GEOS_DIR}" &&
cd "{package}" &&
python -c "import utils; utils.GeosLibrary('${GEOS_VERSION}').build('${GEOS_DIR}', njobs=2)"
- os: macos-14
arch: arm64
before_all: >-
echo "Starting BEFORE_ALL script" &&
echo "GEOS_DIR set to: ${GEOS_DIR}" &&
cd "{package}" &&
python -c "import utils; utils.GeosLibrary('${GEOS_VERSION}').build('${GEOS_DIR}', njobs=2)"
- os: windows-latest
arch: x86_64
before_all: >-
echo Starting BEFORE_ALL script &&
echo GEOS_DIR set to: %GEOS_DIR% &&
cd "{package}" &&
python -c "import utils; utils.GeosLibrary('%GEOS_VERSION%').build('%GEOS_DIR%', njobs=2)"
os: [ubuntu-22.04, windows-2019, macos-13, macos-14]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
Expand All @@ -87,7 +59,7 @@ jobs:
python-version: "3.9"

- name: Build sdist
if: matrix.os == 'ubuntu-latest'
if: matrix.os == 'ubuntu-22.04'
run: |
cd packages/basemap
python -m pip install build
Expand All @@ -96,16 +68,17 @@ jobs:
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_BUILD_VERBOSITY: 1
CIBW_ARCHS: "native"
CIBW_BUILD: "cp39* cp310* cp311* cp312* cp313*"
CIBW_ARCHS_MACOS: ${{ matrix.arch }}
CIBW_SKIP: "pp* *-musllinux_* *-win32 *-manylinux_i686 *-musllinux_i686 *-linux_aarch64 *-linux_armv7l"
CIBW_BEFORE_ALL: ${{ matrix.before_all }}
CIBW_BUILD_VERBOSITY: 1
CIBW_SKIP: "*-musllinux_*"
CIBW_BEFORE_ALL: "python {project}/.github/workflows/run_before_all.py"
CIBW_TEST_EXTRAS: "test"
CIBW_TEST_COMMAND: "python -m pytest {project}/packages/basemap"
CIBW_ENVIRONMENT: >-
GEOS_VERSION="3.6.5"
GEOS_DIR="$(pwd)/extern"
GEOS_NJOBS=4
PIP_PREFER_BINARY=1
PYTHONUNBUFFERED=1
LD_LIBRARY_PATH="${GEOS_DIR}/lib"
Expand All @@ -125,7 +98,7 @@ jobs:
check:
name: Check packages
needs: [build_data, build_basemap]
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/download-artifact@v4
with:
Expand All @@ -147,7 +120,7 @@ jobs:
upload:
name: Upload packages
needs: [build_data, build_basemap, check]
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/download-artifact@v4
Expand Down
37 changes: 37 additions & 0 deletions .github/workflows/run_before_all.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#! /usr/bin/env python
"""Helper script to be run by `cibuildwheel` as `before_all` step."""

import os
import sys

HERE = os.path.abspath(__file__)
ROOT = os.path.dirname(os.path.dirname(os.path.dirname(HERE)))
sys.path.insert(0, os.path.join(ROOT, "packages", "basemap"))
import utils # noqa: E402 # pylint: disable=imports


def main():
"""Build the GEOS library based on parsed environment variables."""

geos_version = os.environ.get("GEOS_VERSION", None)
if geos_version is None:
raise ValueError("Undefined environment variable GEOS_VERSION")

geos_dir = os.environ.get("GEOS_DIR", None)
if geos_dir is None:
raise ValueError("Undefined environment variable GEOS_DIR")

geos_njobs = int(os.environ.get("GEOS_NJOBS", 1))

# pylint: disable=consider-using-f-string
print("Running before_all script with the following settings:")
print("GEOS_DIR: {0}".format(geos_dir))
print("GEOS_VERSION: {0}".format(geos_version))
print("GEOS_NJOBS: {0}".format(geos_njobs))

utils.GeosLibrary(geos_version).build(geos_dir, njobs=geos_njobs)
return 0


if __name__ == "__main__":
sys.exit(main())
16 changes: 12 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,17 @@ https://semver.org/spec/v2.0.0.html
## [Unreleased]

### Added
- Support for Python 3.13 (PR [#619], solves issue [#608]).
- Support for NumPy 2.0 (PR [#614] by @cvanelteren, solves issue
[#604]).
- Python 3.13 support (PR [#619], solves issue [#608]).
- NumPy 2.0 support (PR [#614] by @cvanelteren, solves issue [#604]).
- Automated wheels for x86_64 and arm64 (PR [#620] by @cvanelteren,
solves issue [#608]).

### Changed
- **BREAKING CHANGE**: Set Python minimum supported version to 3.9.
- **BREAKING CHANGE**: Migrate `basemap` libraries to use implicit
namespace packages (PR [#576] by @ksunden).
- Migrate workflows to use `cibuildwheel` (PR [#614] by @cvanelteren).
- Migrate workflows to use `cibuildwheel` (PRs [#614] and [#618] by
@cvanelteren and PR [#621], solves GitHub artifact actions v1 sunset).
- Update library dependencies:
- Upgrade upper limit for `basemap_data` to 3.0.
- Upgrade lower limit for `packaging` to 20.5.
Expand Down Expand Up @@ -1154,8 +1156,14 @@ https://semver.org/spec/v2.0.0.html
- Fix glitches in drawing of parallels and meridians.


[#621]:
https://github.com/matplotlib/basemap/pull/621
[#620]:
https://github.com/matplotlib/basemap/pull/620
[#619]:
https://github.com/matplotlib/basemap/pull/619
[#618]:
https://github.com/matplotlib/basemap/pull/618
[#615]:
https://github.com/matplotlib/basemap/pull/615
[#614]:
Expand Down