forked from SciTools/cartopy
-
Notifications
You must be signed in to change notification settings - Fork 0
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
212 additions
and
405 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,108 @@ | ||
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 | ||
on: [push, pull_request] | ||
# 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.12.0 | ||
- 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 due to compiler | ||
# Skip musllinux because there aren't musllinux wheels yet | ||
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 | ||
|
||
- 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' | ||
|
||
- name: Create sdist | ||
run: python setup.py build_ext sdist | ||
- uses: pypa/[email protected] | ||
with: | ||
only: ${{ matrix.only }} | ||
|
||
- name: Save built packages as artifact | ||
uses: actions/upload-artifact@v3 | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: packages-${{ runner.os }}-${{ matrix.python-version }} | ||
path: dist/ | ||
if-no-files-found: error | ||
retention-days: 5 | ||
|
||
publish: | ||
name: Publish to PyPI | ||
needs: build | ||
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 | ||
path: ./wheelhouse/*.whl | ||
|
||
build_sdist: | ||
name: Build source distribution | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Download packages | ||
uses: actions/download-artifact@v3 | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: actions/setup-python@v4 | ||
name: Install Python | ||
with: | ||
python-version: '3.11' | ||
|
||
- name: Consolidate packages for upload | ||
- name: Build sdist | ||
run: | | ||
mkdir dist | ||
cp packages-*/* dist/ | ||
python -m pip install build | ||
python -m build --sdist | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
path: dist/*.tar.gz | ||
|
||
# publish: | ||
# name: Publish to PyPI | ||
# 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 | ||
|
||
# steps: | ||
# - name: Download packages | ||
# uses: actions/download-artifact@v3 | ||
|
||
# - name: Consolidate packages for upload | ||
# run: | | ||
# mkdir dist | ||
# cp packages-*/* dist/ | ||
|
||
- name: Publish Package | ||
uses: pypa/[email protected] | ||
# - name: Publish Package | ||
# uses: pypa/[email protected] |
Oops, something went wrong.