-
-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build wheels using vcpkg for Linux/MacOS #55
Changes from 61 commits
b1061ea
93b53d6
73bf65f
30d9d8a
9df3287
d265d01
dfa25cc
9451f6f
016a7b0
e6b308f
8e52406
829e77e
625dccb
9682df4
afac704
942ee9c
a468198
d420414
b33f2d9
bde5cab
ee5fe8c
d9375a5
ab37f1f
1c4577b
67f9997
105b50b
3929824
ad9aeaf
1de7027
6b6bc28
8e900ce
5ab8e63
5905e97
d12b5b7
677ed69
6e74c45
d882157
4222e62
42578da
f1b1ff9
faadbc5
4c9dcfe
66b7791
bd296ee
544fb5f
8873a72
28f94b9
29b1ce7
90dd348
4ab4cc2
bfe011f
e292009
e0c1eb9
f922f97
dc45654
ea63984
ce24eef
1300be4
b133504
c78cd03
21d14d6
813707f
5da1f7c
cb2e7c9
06e5e2f
e6d24eb
f74601a
37c57fd
234c8f6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
name: Build Linux wheels | ||
|
||
on: | ||
push: | ||
branches: | ||
- main # just build the sdist & wheel, skip release | ||
tags: | ||
- "*" | ||
pull_request: # also build on PRs touching this file | ||
paths: | ||
- ".github/workflows/build_wheels_linux.yml" | ||
- "ci/*" | ||
- "MANIFEST.in" | ||
- "pyproject.toml" | ||
- "setup.py" | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build_wheels: | ||
name: Build wheels on ${{ matrix.os }} ${{ matrix.platform }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: ["ubuntu-20.04"] | ||
platform: ["x86_64"] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up Docker Buildx | ||
id: buildx | ||
uses: docker/setup-buildx-action@v1 | ||
with: | ||
install: true | ||
|
||
# - name: Build Docker image with vcpkg and gdal | ||
# run: | | ||
# docker build -t manylinux-vcpkg-gdal -f ci/manylinux2014_x86_64-vcpkg-gdal.Dockerfile . | ||
|
||
- 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@v2 | ||
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 | ||
|
||
- run: | | ||
docker images | ||
|
||
- name: Build wheels | ||
uses: pypa/[email protected] | ||
|
||
- uses: actions/upload-artifact@v2 | ||
with: | ||
path: ./wheelhouse/*.whl | ||
|
||
test-wheel: | ||
name: Test wheels on ${{ matrix.os }} ${{ matrix.platform }} | ||
needs: build_wheels | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: ["ubuntu-20.04"] | ||
platform: ["x86_64"] | ||
python-version: ["3.8", "3.9", "3.10"] | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
submodules: false | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Download wheels from artifacts | ||
uses: actions/download-artifact@v2 | ||
with: | ||
path: wheelhouse | ||
|
||
- name: Set version string | ||
shell: bash | ||
run: echo "py_version_str=cp$(echo ${{ matrix.python-version }} | tr -d -c 0-9)" >> $GITHUB_ENV | ||
|
||
- name: Install package from wheel | ||
shell: bash | ||
run: | | ||
ls -R wheelhouse | ||
python -m pip install --upgrade pip | ||
python -m pip install wheelhouse/artifact/pyogrio-*${{ env.py_version_str }}*.whl | ||
|
||
- name: Run tests | ||
# TODO temporary set env variable for curl certificate | ||
env: | ||
CURL_CA_BUNDLE: /etc/ssl/certs/ca-certificates.crt | ||
run: | | ||
python -m pip install pytest pandas pyproj shapely packaging | ||
python -m pip install --no-deps geopandas | ||
python -m pip list | ||
pwd | ||
ls | ||
cd .. | ||
python -m pytest --pyargs pyogrio.tests |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
name: Build MacOS wheels | ||
|
||
on: | ||
push: | ||
branches: | ||
- main # just build the sdist & wheel, skip release | ||
tags: | ||
- "*" | ||
pull_request: # also build on PRs touching this file | ||
paths: | ||
- ".github/workflows/build_wheels_macos.yml" | ||
- "ci/*" | ||
- "MANIFEST.in" | ||
- "pyproject.toml" | ||
- "setup.py" | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build_wheels: | ||
name: Build wheels on ${{ matrix.os }} ${{ matrix.platform }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: ["macos-10.15"] | ||
platform: ["x86_64"] | ||
|
||
env: | ||
MACOSX_DEPLOYMENT_TARGET: "10.15" | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Cache vcpkg | ||
uses: actions/cache@v1 | ||
id: vcpkgcache | ||
with: | ||
path: "/Users/runner/.cache/vcpkg/archives" | ||
key: ${{ matrix.os }}-${{ matrix.platform }}-vcpkg-gdal3.4.1-dynamic | ||
|
||
# MacOS build requires aclocal, which is part of automake, but appears | ||
# to be missing in default image | ||
- name: Reinstall automake | ||
if: ${{ startsWith(matrix.os, 'macos') }} | ||
run: | | ||
brew reinstall automake | ||
echo $(which aclocal) | ||
|
||
- name: Install GDAL | ||
run: | | ||
vcpkg install gdal[core]:x64-osx-dynamic --overlay-triplets=./ci/custom-triplets | ||
|
||
- name: Upload build logs | ||
uses: actions/upload-artifact@v2 | ||
if: ${{ failure() }} | ||
with: | ||
path: /usr/local/share/vcpkg/buildtrees/gdal/*.log | ||
|
||
- name: Build wheels | ||
uses: pypa/[email protected] | ||
env: | ||
PYOGRIO_PACKAGE_DATA: 1 | ||
|
||
- uses: actions/upload-artifact@v2 | ||
with: | ||
path: ./wheelhouse/*.whl | ||
|
||
test-wheel: | ||
name: Test wheels on ${{ matrix.os }} ${{ matrix.platform }} | ||
needs: build_wheels | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: ["macos-latest", "macos-10.15"] | ||
platform: ["x86_64"] | ||
python-version: ["3.8", "3.9"] | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
submodules: false | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Download wheels from artifacts | ||
uses: actions/download-artifact@v2 | ||
with: | ||
path: wheelhouse | ||
|
||
- name: Set version string | ||
shell: bash | ||
run: echo "py_version_str=cp$(echo ${{ matrix.python-version }} | tr -d -c 0-9)" >> $GITHUB_ENV | ||
|
||
- name: Install package from wheel | ||
shell: bash | ||
run: | | ||
ls -R wheelhouse | ||
python -m pip install --upgrade pip | ||
python -m pip install wheelhouse/artifact/pyogrio-*${{ env.py_version_str }}*.whl | ||
|
||
- name: Run tests | ||
run: | | ||
python -m pip install pytest pandas pyproj shapely packaging | ||
python -m pip install --no-deps geopandas | ||
python -m pip list | ||
cd .. | ||
python -m pytest --pyargs pyogrio.tests -v |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,7 @@ include versioneer.py | |
include pyogrio/_version.py | ||
include pyogrio/*.pyx pyogrio/*.pxd | ||
exclude pyogrio/*.c | ||
include LICENSE | ||
include pyproject.toml | ||
exclude MANIFEST.in | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am going to change this back (I think it is a left-over from some experimentation to get the tests working?), as my understanding is that this should not influence wheels but only sdist. This might still be a valid change for the sdist (didn't check that here), but then let's do that in a separate PR focused on sdist. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's fine; I added that while trying to get the pytest tests working, based on adapting what we have in |
||
recursive-include pyogrio/tests/fixtures * |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
set(VCPKG_TARGET_ARCHITECTURE x64) | ||
set(VCPKG_CRT_LINKAGE dynamic) | ||
set(VCPKG_LIBRARY_LINKAGE dynamic) | ||
set(VCPKG_CMAKE_SYSTEM_NAME Linux) | ||
set(VCPKG_BUILD_TYPE release) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
set(VCPKG_TARGET_ARCHITECTURE x64) | ||
set(VCPKG_CRT_LINKAGE dynamic) | ||
set(VCPKG_LIBRARY_LINKAGE dynamic) | ||
set(VCPKG_CMAKE_SYSTEM_NAME Darwin) | ||
set(VCPKG_BUILD_TYPE release) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
FROM quay.io/pypa/manylinux2014_x86_64 | ||
|
||
RUN yum install -y curl unzip zip tar python3 | ||
|
||
RUN git clone https://github.com/Microsoft/vcpkg.git /opt/vcpkg | ||
|
||
ENV VCPKG_INSTALLATION_ROOT="/opt/vcpkg" | ||
ENV PATH="${PATH}:/opt/vcpkg" | ||
|
||
RUN bootstrap-vcpkg.sh && \ | ||
vcpkg integrate install && \ | ||
vcpkg integrate bash | ||
|
||
COPY ci/custom-triplets/x64-linux-dynamic.cmake opt/vcpkg/custom-triplets/x64-linux-dynamic.cmake | ||
|
||
ENV LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/opt/vcpkg/installed/x64-linux-dynamic/lib" | ||
RUN vcpkg install gdal[core]:x64-linux-dynamic --overlay-triplets=opt/vcpkg/custom-triplets |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the Windows PR, I am caching the actual "/installed" directory directly (https://github.com/geopandas/pyogrio/pull/49/files#diff-6c1677623c2a63cdf28017fb8aa9b0395ecf72745a91b9ccd9228dbac36b4475R34). Do you know if there is a big difference? (both seem to work, and I think I have seen both in practice in other projects)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went back to
/Users/runner/.cache/vcpkg/archives
only because it was getting emitted by the logs on GH, and I couldn't figure out the correct install location.For me, I had git cloned vcpkg to a local folder, so the
installed/x64-osx-dynamic/
path ended up being under that.From earlier testing of just building GDAL, it seems like it cached things fine using
/Users/runner/.cache/vcpkg/archives
and may be preferable to use that if that is based on a hash relating to the version of GDAL + deps that are actually installed, if we want those to rebuild on updates from vcpkg (which is debatable).