Skip to content

CI: Update cibuildwheel v0.16 #257

CI: Update cibuildwheel v0.16

CI: Update cibuildwheel v0.16 #257

Workflow file for this run

name: Wheels & sdist
on:
push:
branches: [ main ]
release:
types: [ created ]
pull_request: # also build on PRs touching this file
paths:
- ".github/workflows/release.yaml"
- "ci/proj-compile-wheels.sh"
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
env:
PROJ_VERSION: "9.2.1"
jobs:
make_sdist:
name: Make sdist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Conda
uses: s-weigand/setup-conda@v1
with:
conda-channels: conda-forge
- name: Make sdist
shell: bash
run: |
conda config --prepend channels conda-forge
conda config --set channel_priority strict
conda create -n sdist_env build twine cython proj=${{ env.PROJ_VERSION }}
source activate sdist_env
python -m build --sdist
- name: Check packages
shell: bash
run: |
source activate sdist_env
twine check --strict dist/*
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
path: ./dist/*.tar.gz
retention-days: 5
build_wheels:
name: Build ${{ matrix.arch }} wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-20.04
arch: x86_64
- os: ubuntu-20.04
arch: i686
- os: macos-11
arch: x86_64
cmake_osx_architectures: x86_64
# - os: macos-11
# arch: arm64
# cmake_osx_architectures: arm64
# - os: macos-11
# arch: universal2
# cmake_osx_architectures: "x86_64;arm64"
- os: "windows-2019"
arch: "auto64"
triplet: "x64-windows"
vcpkg_cache: "c:\\vcpkg\\installed"
vcpkg_logs: "c:\\vcpkg\\buildtrees\\**\\*.log"
- os: "windows-2019"
arch: "auto32"
triplet: "x86-windows"
vcpkg_cache: "c:\\vcpkg\\installed"
vcpkg_logs: "c:\\vcpkg\\buildtrees\\**\\*.log"
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- name: Cache vcpkg
if: contains(matrix.os, 'windows')
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.triplet }}-vcpkg-proj${{ env.PROJ_VERSION }}-cache0
- name: Install PROJ with vcpkg
if: contains(matrix.os, 'windows')
env:
VCPKG_DEFAULT_TRIPLET: ${{ matrix.triplet }}
shell: bash
run: |
cd "$VCPKG_INSTALLATION_ROOT"
git pull > nul
./bootstrap-vcpkg.bat -disableMetrics
vcpkg install --feature-flags="versions,manifests" --x-manifest-root=${GITHUB_WORKSPACE}/ci --x-install-root=$VCPKG_INSTALLATION_ROOT/installed
mkdir -p ${GITHUB_WORKSPACE}/pyproj/proj_dir/share/proj
cp "$VCPKG_INSTALLATION_ROOT/installed/${{ matrix.triplet }}/share/proj/"* ${GITHUB_WORKSPACE}/pyproj/proj_dir/share/proj/
- name: Build wheels
uses: pypa/cibuildwheel@v2.15
env:
CIBW_SKIP: "*musllinux* pp*-win*"
CIBW_ARCHS: ${{ matrix.arch }}
CIBW_ENVIRONMENT_LINUX:
PROJ_WHEEL=true
PROJ_NETWORK=ON
PROJ_VERSION=${{ env.PROJ_VERSION }}
PROJ_DIR=/project/pyproj/proj_dir
CIBW_ENVIRONMENT_MACOS:
PROJ_WHEEL=true
PROJ_NETWORK=ON
PROJ_VERSION=${{ env.PROJ_VERSION }}
PROJ_DIR=${GITHUB_WORKSPACE}/pyproj/proj_dir
MACOSX_DEPLOYMENT_TARGET=10.9
CMAKE_OSX_ARCHITECTURES='${{ matrix.cmake_osx_architectures }}'
LDFLAGS="${LDFLAGS} -Wl,-rpath,${GITHUB_WORKSPACE}/pyproj/proj_dir/lib"
CIBW_ENVIRONMENT_WINDOWS:
PROJ_WHEEL=true
PROJ_NETWORK=ON
PROJ_VERSION=${{ env.PROJ_VERSION }}
PROJ_DIR=$VCPKG_INSTALLATION_ROOT/installed/${{ matrix.triplet }}
CIBW_BEFORE_BUILD_WINDOWS: "python -m pip install delvewheel"
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "delvewheel repair --add-path C:/vcpkg/installed/${{ matrix.triplet }}/bin -w {dest_dir} {wheel}"
CIBW_BEFORE_ALL_LINUX: bash ./ci/proj-compile-wheels.sh
CIBW_BEFORE_ALL_MACOS: bash ./ci/proj-compile-wheels.sh
CIBW_TEST_REQUIRES: cython pytest numpy==1.26.0b1 pandas xarray
CIBW_BEFORE_TEST: python -m pip install shapely || echo "Shapely install failed"
CIBW_TEST_COMMAND: >
pyproj -v &&
python -c "import pyproj; pyproj.Proj(init='epsg:4269')" &&
cp -r {package}/test . &&
python -m pytest test -v -s
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
retention-days: 5
publish:
name: Publish on PyPI
needs: [make_sdist,build_wheels]
runs-on: ubuntu-latest
# release on every tag
if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist
- name: Upload Wheels to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
skip_existing: true
# repository_url: https://test.pypi.org/legacy/ # To test