-
Notifications
You must be signed in to change notification settings - Fork 8
145 lines (132 loc) · 4.87 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
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/*
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
- 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 }}
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 }}\geos-${{ env.GEOS_VERSION }}\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:
name: artifact
path: dist
- name: Publish on PyPI
uses: pypa/gh-action-pypi-publish@release/v1