Skip to content

TST: drop older GDAL, require shapely for tests, consolidate arrow test parametrize #369

TST: drop older GDAL, require shapely for tests, consolidate arrow test parametrize

TST: drop older GDAL, require shapely for tests, consolidate arrow test parametrize #369

Workflow file for this run

name: Release
on:
push:
branches:
- main # just build the sdist & wheel, skip release
tags:
- "v*"
pull_request: # also build on PRs touching files that affect building sdist / wheels
paths:
- ".github/workflows/release.yml"
- "ci/**"
- "MANIFEST.in"
- "pyproject.toml"
- "setup.py"
workflow_dispatch:
# cancel running jobs on new commit to PR
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
build-sdist:
name: Build pyogrio sdist
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Build a source tarball
run: |
python -m pip install --upgrade pip
python -m pip install build setuptools
python -m build --sdist
- uses: actions/upload-artifact@v3
with:
path: ./dist/*.tar.gz
retention-days: 5
test-sdist:
name: Test sdist
needs: [build-sdist]
runs-on: ubuntu-latest
container:
image: "ghcr.io/osgeo/gdal:ubuntu-small-3.6.3" # python 3.10.6
steps:
- name: Download sdist from artifacts
uses: actions/download-artifact@v3
with:
path: wheelhouse
- name: Install pip
run: |
apt-get update && apt-get install -y python3-pip
- name: Build from sdist and install test dependencies
shell: bash
run: |
python3 -m pip install --no-cache-dir wheelhouse/artifact/*.tar.gz
python3 -m pip install --no-cache-dir pytest pandas pyproj shapely>=2
python3 -m pip install --no-cache-dir --no-deps geopandas
python3 -m pip list
- name: Run tests
shell: bash
run: |
cd ..
python3 -m pytest --pyargs pyogrio.tests -v
build-wheels-linux:
name: Build wheels on Linux
runs-on: "ubuntu-20.04"
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
with:
install: true
buildkitd-flags: --debug
- name: Build Docker image with vcpkg and gdal
# using build-push-action (without push) to make use of cache arguments
uses: docker/build-push-action@v4
with:
context: .
file: ci/manylinux2014_x86_64-vcpkg-gdal.Dockerfile
tags: manylinux-vcpkg-gdal:latest
push: false
load: true
cache-from: type=gha
cache-to: type=gha,mode=max
env:
BUILDKIT_PROGRESS: plain
- name: Build wheels
uses: pypa/cibuildwheel@v2.14.1
- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
build-wheels-mac-win:
name: Build wheels on ${{ matrix.os }} (${{ matrix.arch }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: "macos-11"
triplet: "x64-osx-dynamic"
arch: x86_64
vcpkg_cache: "/Users/runner/.cache/vcpkg/archives"
vcpkg_logs: "/usr/local/share/vcpkg/buildtrees/**/*.log"
- os: "macos-11"
triplet: "arm64-osx-dynamic-release"
arch: arm64
vcpkg_cache: "/Users/runner/.cache/vcpkg/archives"
vcpkg_logs: "/usr/local/share/vcpkg/buildtrees/**/*.log"
- os: "windows-2019"
triplet: "x64-windows-dynamic-release"
arch: AMD64
# windows requires windows-specific paths
vcpkg_cache: "c:\\vcpkg\\installed"
vcpkg_logs: "c:\\vcpkg\\buildtrees\\**\\*.log"
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Cache vcpkg
uses: actions/cache@v3
id: vcpkgcache
with:
path: |
${{ matrix.vcpkg_cache }}
# bump the last digit to avoid using previous build cache
key: ${{ matrix.os }}-${{ matrix.arch }}-vcpkg-gdal3.6.4-cache0
# MacOS build requires aclocal, which is part of automake, but appears
# to be missing in default image
- name: Reinstall automake
if: runner.os == 'macOS'
run: |
brew reinstall automake
echo $(which aclocal)
- name: Checkout specific version of vcpkg
shell: bash
run: |
cd $VCPKG_INSTALLATION_ROOT
# on mac the clone is not clean, otherwise git pull fails
git reset --hard
# pull latest version to ensure the required commit with GDAL 3.6 is available
git pull
git checkout 580f143d123ce6abb5c135b11d6402c9a54bc9b9
- name: Install GDAL
env:
VCPKG_DEFAULT_TRIPLET: ${{ matrix.triplet }}
shell: bash
run: |
vcpkg install --overlay-triplets=./ci/custom-triplets --feature-flags="versions,manifests" --x-manifest-root=./ci --x-install-root=$VCPKG_INSTALLATION_ROOT/installed
vcpkg list
- name: Upload vcpkg build logs
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
path: ${{ matrix.vcpkg_logs }}
- name: Build wheels
uses: pypa/cibuildwheel@v2.14.1
env:
# CIBW needs to know triplet for the correct install path
VCPKG_DEFAULT_TRIPLET: ${{ matrix.triplet }}
CIBW_ARCHS: ${{ matrix.arch }}
- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
test-wheels:
name: Test wheels on ${{ matrix.os }} (Python ${{ matrix.python-version }})
needs: [build-wheels-linux, build-wheels-mac-win]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-20.04", "windows-latest", "macos-11", "macos-latest"]
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
cache-dependency-path: "ci/requirements-wheel-test.txt"
- name: Download wheels from artifacts
uses: actions/download-artifact@v3
with:
path: wheelhouse
- name: Install dependencies and pyogrio wheel
shell: bash
run: |
python -m pip install -r ci/requirements-wheel-test.txt
python -m pip install --no-deps geopandas
python -m pip install --pre --find-links wheelhouse/artifact pyogrio
python -m pip list
- name: Run tests
shell: bash
run: |
cd ..
python -c "import pyogrio; print(f'GDAL version: {pyogrio.__gdal_version__}\nGEOS version: {pyogrio.__gdal_geos_version__}')"
python -m pytest --pyargs pyogrio.tests -v
publish:
name: Publish pyogrio to GitHub / PyPI
needs: [test-sdist, test-wheels]
runs-on: ubuntu-latest
# release on every tag
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/')
steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: false
prerelease: false
- name: Get Asset name
run: |
export PKG=$(ls dist/ | grep tar)
set -- $PKG
echo "name=$1" >> $GITHUB_ENV
- name: Upload Release Asset (sdist) to GitHub
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist/${{ env.name }}
asset_name: ${{ env.name }}
asset_content_type: application/zip