CI release: activate windows builds #50
Workflow file for this run
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
name: Build and publish | |
on: | |
# trigger action from GitHub GUI (testing, no publish) | |
workflow_dispatch: | |
release: | |
types: | |
- published | |
pull_request: # also build on PRs touching any file below | |
paths: | |
- ".github/workflows/release.yml" | |
- "ci/*" | |
- "MANIFEST.in" | |
- "pyproject.toml" | |
jobs: | |
build_sdist: | |
name: Build sdist | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Build SDist | |
run: pipx run build --sdist | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: release-sdist | |
path: ./dist/*.tar.gz | |
retention-days: 30 | |
- name: Check metadata | |
run: pipx run twine check dist/* | |
build_wheels: | |
name: Build binary wheel on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
env: | |
ABSL_VERSION: "20240722.0" | |
S2GEOMETRY_VERSION: "0.11.1" | |
S2GEOGRAPHY_VERSION: "0.1.2" | |
CXX_STANDARD: 17 | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: ubuntu-latest | |
arch: x86_64 | |
# - os: windows-2019 | |
# arch: x86 | |
# msvc_arch: x86 | |
- os: windows-2019 | |
arch: AMD64 | |
msvc_arch: x64 | |
- os: macos-13 | |
arch: x86_64 | |
cmake_osx_architectures: x86_64 | |
macosx_deployment_target: 13.0 | |
- os: macos-14 | |
arch: arm64 | |
cmake_osx_architectures: arm64 | |
macosx_deployment_target: 14.0 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Cache 3rd-party install directory | |
id: cache-build | |
uses: actions/cache@v4 | |
with: | |
path: ${{ runner.temp }}/3rd-party/dist | |
key: ${{ matrix.os }}-${{ matrix.arch }}-${{ env.ABSL_VERSION }}-${{ env.S2GEOMETRY_VERSION }}-${{ env.S2GEOGRAPHY_VERSION }}-${{ hashFiles('ci/*') }} | |
- name: Copy 3rd-party license files | |
run: | | |
cp ci/LICENSE_* . | |
ls -all . | |
shell: bash | |
# install openssl on windows using vcpkg | |
# https://github.com/actions/runner-images/issues/8344 | |
- name: Cache OpenSSL build directory (Windows) | |
if: runner.os == 'Windows' | |
uses: actions/cache@v4 | |
with: | |
path: ${{ runner.temp }}\vcpkg_cache | |
key: vcpkg-openssl-${{ runner.os }} | |
- name: Install OpenSSL (Windows) | |
if: runner.os == 'Windows' | |
shell: powershell | |
run: | | |
New-Item -Path "${{ runner.temp }}" -Name "vcpkg_cache" -ItemType "directory" -Force | |
vcpkg install openssl:x64-windows-dynamic-release | |
vcpkg list | |
env: | |
VCPKG_DEFAULT_BINARY_CACHE: ${{ runner.temp }}\vcpkg_cache | |
- name: Build wheels | |
uses: pypa/[email protected] | |
env: | |
CIBW_ARCHS: ${{ matrix.arch }} | |
CIBW_SKIP: cp36-* pp* *musllinux* *-manylinux_i686 | |
CIBW_TEST_SKIP: "cp38-macosx_arm64" | |
CIBW_ENVIRONMENT_LINUX: | |
DEPENDENCIES_DIR=/host${{ runner.temp }}/3rd-party | |
CMAKE_PREFIX_PATH=/host${{ runner.temp }}/3rd-party/dist | |
ABSL_VERSION=${{ env.ABSL_VERSION }} | |
S2GEOMETRY_VERSION=${{ env.S2GEOMETRY_VERSION }} | |
S2GEOGRAPHY_VERSION=${{ env.S2GEOGRAPHY_VERSION }} | |
CXX_STANDARD=${{ env.CXX_STANDARD }} | |
CIBW_ENVIRONMENT_MACOS: | |
PROJECT_DIR=${{ github.workspace }} | |
DEPENDENCIES_DIR=${{ runner.temp }}/3rd-party | |
CMAKE_PREFIX_PATH=${{ runner.temp }}/3rd-party/dist | |
ABSL_VERSION=${{ env.ABSL_VERSION }} | |
S2GEOMETRY_VERSION=${{ env.S2GEOMETRY_VERSION }} | |
S2GEOGRAPHY_VERSION=${{ env.S2GEOGRAPHY_VERSION }} | |
CXX_STANDARD=${{ env.CXX_STANDARD }} | |
MACOSX_DEPLOYMENT_TARGET=${{ matrix.macosx_deployment_target }} | |
CMAKE_OSX_ARCHITECTURES='${{ matrix.cmake_osx_architectures }}' | |
CIBW_ENVIRONMENT_WINDOWS: | |
DEPENDENCIES_DIR='${{ runner.temp }}\3rd-party' | |
ABSL_VERSION=${{ env.ABSL_VERSION }} | |
S2GEOMETRY_VERSION=${{ env.S2GEOMETRY_VERSION }} | |
S2GEOGRAPHY_VERSION=${{ env.S2GEOGRAPHY_VERSION }} | |
CXX_STANDARD=${{ env.CXX_STANDARD }} | |
OPENSSL_ROOT_DIR=${{ env.VCPKG_INSTALLATION_ROOT }}\packages\openssl_x64-windows | |
CIBW_BEFORE_ALL: ./ci/install_3rdparty.sh | |
CIBW_BEFORE_ALL_WINDOWS: ci\install_3rdparty.cmd | |
CIBW_BEFORE_BUILD_WINDOWS: pip install delvewheel | |
CIBW_REPAIR_WHEEL_COMMAND_LINUX: 'LD_LIBRARY_PATH=/host${{ runner.temp }}/3rd-party/dist/lib64 auditwheel repair -w {dest_dir} {wheel}' | |
CIBW_REPAIR_WHEEL_COMMAND_MACOS: 'DYLD_LIBRARY_PATH=${{ runner.temp }}/3rd-party/dist/lib delocate-wheel --require-archs=${{ matrix.arch }} -w {dest_dir} -v {wheel}' | |
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: 'delvewheel repair --add-path ${{ runner.temp }}\3rd-party\dist\bin -w {dest_dir} {wheel}' | |
CIBW_TEST_REQUIRES: pytest | |
CIBW_TEST_COMMAND: pytest {project}/tests | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: release-${{ matrix.os }}-${{ matrix.arch }} | |
path: ./wheelhouse/*.whl | |
retention-days: 5 | |
upload_all: | |
needs: [build_sdist, build_wheels] | |
environment: pypi | |
permissions: | |
id-token: write | |
runs-on: ubuntu-latest | |
if: github.event_name == 'release' && github.event.action == 'published' | |
steps: | |
- name: Get dist files | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: release-* | |
merge-multiple: true | |
path: dist | |
- name: Publish on PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 |