Skip to content
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

Fix CI, add Python 3.10 #109

Merged
merged 31 commits into from
Feb 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 50 additions & 49 deletions .github/workflows/build-new.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
pull_request:
types: [ assigned, opened, synchronize, reopened ]
release:
types: [published, edited]
types: [ published, edited ]
workflow_dispatch:

jobs:
Expand All @@ -16,67 +16,68 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
pyversion: ["cp36-cp36m", "cp37-cp37m", "cp38-cp38", "cp39-cp39"]
pyversion: [ "cp37-cp37m", "cp38-cp38", "cp39-cp39", "cp310-cp310" ]
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
- name: Build the Linux wheels
run: |
# must be run in docker, cannot be run as freestanding script for toolchain issues
# run on old CentOS. but it's CentOS, so it's yum(RPM) not apt. very old glibc. glibc API is back-compatible but not forward. See https://github.com/pypa/manylinux
# see https://github.com/varunagrawal/docker-images/blob/master/gtsam-manylinux/Dockerfile for an example
# container, but it does not have some necesssary boost packages --> varunagrawal/gtsam-manylinux:latest
sudo docker run --rm -e PLAT=manylinux2014_x86_64 -e PYTHON_VERSION=${{ matrix.pyversion }} -v `pwd`:/io quay.io/pypa/manylinux2014_x86_64 /io/package/build-wheels-linux.sh ${{ matrix.pyversion }}
# cleanup for custom runner
sudo chown -R $(whoami):$(whoami) .
- name: Archive wheels
uses: actions/upload-artifact@v2
with:
# we strip the version number from the artifact name
name: pycolmap-${{ matrix.pyversion }}-manylinux2014_x86_64
path: wheelhouse/pycolmap-*-${{ matrix.pyversion }}-manylinux2014_x86_64.whl
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Build the Linux wheels
run: |
# must be run in docker, cannot be run as freestanding script for toolchain issues
# run on old CentOS. but it's CentOS, so it's yum(RPM) not apt. very old glibc. glibc API is back-compatible but not forward. See https://github.com/pypa/manylinux
# see https://github.com/varunagrawal/docker-images/blob/master/gtsam-manylinux/Dockerfile for an example
# container, but it does not have some necesssary boost packages --> varunagrawal/gtsam-manylinux:latest
sudo docker run --rm -e PLAT=manylinux2014_x86_64 -e PYTHON_VERSION=${{ matrix.pyversion }} -v `pwd`:/io quay.io/pypa/manylinux2014_x86_64 /io/package/build-wheels-linux.sh ${{ matrix.pyversion }}
# sudo docker run --rm -e PLAT=manylinux_2_24_x86_64 -e PYTHON_VERSION=${{ matrix.pyversion }} -v `pwd`:/io quay.io/pypa/manylinux_2_24_x86_64 /io/package/build-wheels-linux-new.sh ${{ matrix.pyversion }}
# cleanup for custom runner
sudo chown -R $(whoami):$(whoami) .
- name: Archive wheels
uses: actions/upload-artifact@v3
with:
# we strip the version number from the artifact name
name: pycolmap-${{ matrix.pyversion }}-manylinux2014_x86_64
path: wheelhouse/pycolmap-*-${{ matrix.pyversion }}-manylinux2014_x86_64.whl

mac-build:
name: Wrapper macOS Build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-11, macos-10.15]
pyversion: ["python@3.7", "python@3.8", "python@3.9"]
os: [ macos-11 ]
pyversion: [ "python@3.7", "python@3.8", "python@3.9", "python@3.10" ]
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
- name: Build the macOS wheels
run: |
./package/build-wheels-macos.sh ${{ matrix.pyversion }}
- name: Archive wheels
uses: actions/upload-artifact@v2
with:
name: pycolmap-${{ matrix.pyversion }}-${{ matrix.os }}
path: ./wheelhouse/pycolmap-*.whl
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Build the macOS wheels
run: |
./package/build-wheels-macos.sh ${{ matrix.pyversion }}
- name: Archive wheels
uses: actions/upload-artifact@v3
with:
name: pycolmap-${{ matrix.pyversion }}-${{ matrix.os }}
path: ./wheelhouse/pycolmap-*.whl

pypi-publish:
name: Publish wheels to PyPI
needs: [linux-build, mac-build]
needs: [ linux-build, mac-build ]
runs-on: ubuntu-latest
# We publish the wheel to pypi when a new tag is pushed,
# either by creating a new GitHub release or explictly with `git tag`
if: ${{ github.event_name == 'release' || startsWith(github.ref, 'refs/tags') }}
steps:
- name: Download wheels
uses: actions/download-artifact@v2
with:
path: ./artifacts/
- name: Move wheels
run: mkdir ./wheelhouse && mv ./artifacts/**/*.whl ./wheelhouse/
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
with:
skip_existing: true
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
packages_dir: ./wheelhouse/
- name: Download wheels
uses: actions/download-artifact@v3
with:
path: ./artifacts/
- name: Move wheels
run: mkdir ./wheelhouse && mv ./artifacts/**/*.whl ./wheelhouse/
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
with:
skip_existing: true
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
packages_dir: ./wheelhouse/
2 changes: 1 addition & 1 deletion package/build-wheels-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ yum install -y \
gflags-devel \
glew-devel

yum install -y suitesparse-devel atlas-devel lapack-devel blas-devel
yum install -y suitesparse-devel atlas-devel lapack-devel blas-devel flann flann-devel lz4 lz4-devel

# Disable CGAL since it pulls many dependencies and increases the wheel size
#yum install -y yum-utils
Expand Down
36 changes: 27 additions & 9 deletions package/build-wheels-macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,31 @@ function retry {
}

declare -a PYTHON_VERSION=( $1 )
# See https://github.com/actions/setup-python/issues/577
find /usr/local/bin -lname '*/Library/Frameworks/Python.framework/*' -delete

brew update
brew upgrade
brew install wget cmake $PYTHON_VERSION
# TODO: try without brew install of boost, but use version below
brew install cmake boost eigen freeimage metis glog gflags suite-sparse ceres-solver glew cgal

brew install llvm libomp
brew install wget cmake
brew install --force $PYTHON_VERSION

brew install \
git \
cmake \
eigen \
freeimage \
flann \
glog \
gflags \
metis \
suite-sparse \
ceres-solver \
glew \
cgal \
sqlite3 \
libomp \
llvm \
lz4

brew info gcc
brew upgrade gcc
Expand All @@ -53,9 +70,9 @@ ls -ltrh $CURRDIR
# Build Boost staticly
mkdir -p boost_build
cd boost_build
retry 3 wget https://boostorg.jfrog.io/artifactory/main/release/1.73.0/source/boost_1_73_0.tar.gz
tar xzf boost_1_73_0.tar.gz
cd boost_1_73_0
retry 3 wget https://boostorg.jfrog.io/artifactory/main/release/1.81.0/source/boost_1_81_0.tar.gz
tar xzf boost_1_81_0.tar.gz
cd boost_1_81_0
./bootstrap.sh --prefix=$CURRDIR/boost_install --with-libraries=serialization,filesystem,thread,system,atomic,date_time,timer,chrono,program_options,regex clang-darwin
./b2 -j$(sysctl -n hw.logicalcpu) cxxflags="-fPIC" runtime-link=static variant=release link=static install

Expand All @@ -79,7 +96,8 @@ done
# Install `delocate` -- OSX equivalent of `auditwheel`
# see https://pypi.org/project/delocate/ for more details
cd $CURRDIR
$INTERPRETER -m pip install delocate==0.10.0
$INTERPRETER -m pip install -U delocate
$INTERPRETER -m pip install -U pip setuptools wheel cffi

ls -ltrh /usr/local
ls -ltrh /usr/local/opt
Expand Down