-
Notifications
You must be signed in to change notification settings - Fork 370
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BLD: cleanup setup.py and pyproject.toml
Simplify some of the setup.py build work now that we have removed more extension libraries. Move the static content over to pyproject.toml and migrate more content to the modern build utilities.
- Loading branch information
Showing
15 changed files
with
218 additions
and
411 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
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
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 |
---|---|---|
@@ -1,63 +1,112 @@ | ||
name: Build and upload to PyPI | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.number }}-${{ github.event.ref }} | ||
cancel-in-progress: true | ||
|
||
# Only build on published releases | ||
on: | ||
release: | ||
types: | ||
- published | ||
|
||
jobs: | ||
build: | ||
name: Build sdist | ||
runs-on: ubuntu-18.04 | ||
generate-wheels-matrix: | ||
name: Generate wheels matrix | ||
runs-on: ubuntu-latest | ||
outputs: | ||
include: ${{ steps.set-matrix.outputs.include }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Install cibuildwheel | ||
run: pipx install cibuildwheel==2.13.1 | ||
- id: set-matrix | ||
run: | | ||
MATRIX=$( | ||
{ | ||
cibuildwheel --print-build-identifiers --platform linux \ | ||
| jq -nRc '{"only": inputs, "os": "ubuntu-latest"}' \ | ||
&& cibuildwheel --print-build-identifiers --platform macos \ | ||
| jq -nRc '{"only": inputs, "os": "macos-latest"}' \ | ||
&& cibuildwheel --print-build-identifiers --platform windows \ | ||
| jq -nRc '{"only": inputs, "os": "windows-2019"}' | ||
} | jq -sc | ||
) | ||
echo "include=$MATRIX" >> $GITHUB_OUTPUT | ||
env: | ||
CIBW_BUILD: "cp39-* cp310-* cp311-*" | ||
# Skip 32 bit windows builds and musllinux due to lack of numpy wheels | ||
CIBW_SKIP: "*-win32 *-musllinux*" | ||
CIBW_ARCHS_MACOS: x86_64 arm64 | ||
build_wheels: | ||
name: Build ${{ matrix.os }} ${{ matrix.only }} | ||
needs: generate-wheels-matrix | ||
strategy: | ||
matrix: | ||
include: ${{ fromJson(needs.generate-wheels-matrix.outputs.include) }} | ||
runs-on: ${{ matrix.os }} | ||
defaults: | ||
run: | ||
shell: bash -l {0} | ||
|
||
shell: bash | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: conda-incubator/setup-miniconda@v2 | ||
with: | ||
activate-environment: test-environment | ||
python-version: ${{ matrix.python-version }} | ||
channels: conda-forge/label/testing,conda-forge | ||
# We need the full history to generate the proper version number | ||
fetch-depth: 0 | ||
|
||
- name: Install dependencies | ||
run: | | ||
PACKAGES="cython fiona matplotlib-base numpy pyproj pykdtree scipy" | ||
PACKAGES="$PACKAGES owslib pep8 pillow pyshp pytest" | ||
PACKAGES="$PACKAGES pytest-xdist setuptools_scm shapely" | ||
conda install $PACKAGES | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
|
||
- uses: pypa/cibuildwheel@v2.13.1 | ||
with: | ||
only: ${{ matrix.only }} | ||
|
||
- uses: actions/upload-artifact@v3 | ||
with: | ||
path: ./wheelhouse/*.whl | ||
|
||
build_sdist: | ||
name: Build source distribution | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
# We need the full history to generate the proper version number | ||
fetch-depth: 0 | ||
|
||
- name: Create sdist | ||
run: python setup.py build_ext sdist | ||
- uses: actions/setup-python@v4 | ||
name: Install Python | ||
with: | ||
python-version: '3.11' | ||
|
||
- name: Save built packages as artifact | ||
uses: actions/upload-artifact@v3 | ||
- name: Build sdist | ||
run: | | ||
python -m pip install build | ||
# install compiles the cython *.pyx to *.cpp for us | ||
python -m pip install . | ||
python -m build --sdist | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: packages-${{ runner.os }}-${{ matrix.python-version }} | ||
path: dist/ | ||
if-no-files-found: error | ||
retention-days: 5 | ||
path: dist/*.tar.gz | ||
|
||
publish: | ||
name: Publish to PyPI | ||
needs: build | ||
needs: [build_wheels, build_sdist] | ||
environment: | ||
name: PyPI | ||
url: https://pypi.org/project/cartopy | ||
permissions: | ||
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing | ||
runs-on: ubuntu-18.04 | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Download packages | ||
uses: actions/download-artifact@v3 | ||
|
||
- name: Consolidate packages for upload | ||
run: | | ||
mkdir dist | ||
cp packages-*/* dist/ | ||
with: | ||
name: artifact | ||
path: dist | ||
|
||
- name: Publish Package | ||
uses: pypa/gh-action-pypi-publish@v1.8.8 |
Oops, something went wrong.