-
Notifications
You must be signed in to change notification settings - Fork 393
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #621 from matplotlib/feature-workflow-improvements
Add general improvements to new workflow
- Loading branch information
Showing
3 changed files
with
59 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
||
|
@@ -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 | ||
|
@@ -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 | ||
|
@@ -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" | ||
|
@@ -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: | ||
|
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters