-
Notifications
You must be signed in to change notification settings - Fork 802
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
Add cibuildwheel
workflow
#2029
Open
yambati03
wants to merge
17
commits into
borglab:develop
Choose a base branch
from
yambati03:develop
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 14 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
ae433fb
Create initial workflow for cibuildwheel
yambati03 16a516c
Update CMake command to point to right path
yambati03 5008083
Update another bad path
yambati03 00b70e6
Fix ANOTHER bad path
yambati03 4a57824
Install dependencies in manylinux container as well
yambati03 8cbb4fc
Trying something
yambati03 5466a96
Install boost from source, delete CMakeCache before building
yambati03 9c2ed3d
Make shared libraries
yambati03 dc667c4
Update make command
yambati03 c4d7e62
Use CMake as generator
yambati03 d0e25bc
Modify setup.py.in to force root to be platform-dependent
yambati03 c17a3f8
Publish to TestPyPI after wheels are built
yambati03 5da3691
Set package name to gtsam-nightly if nightly build
yambati03 abe4cd7
Pass NIGHTLY env variable to cibw container
yambati03 408aaea
Address some comments on PR
yambati03 15e1926
Make version string PEP440 compliant
yambati03 a3e42a8
Make upload to PyPI verbose
yambati03 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
name: Build Wheels (cibuildwheel) | ||
|
||
on: [workflow_dispatch] | ||
|
||
jobs: | ||
build_wheels: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- os: ubuntu-latest | ||
python_version: "3.10" | ||
cibw_python_version: 310 | ||
platform_id: manylinux_x86_64 | ||
manylinux_image: manylinux2014 | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python ${{ matrix.python_version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python_version }} | ||
|
||
- name: Set Nightly Flag | ||
run: echo "NIGHTLY=1" >> $GITHUB_ENV | ||
|
||
- name: Install Dependencies | ||
run: | | ||
sudo apt-get install -y wget libicu-dev python3-pip python3-setuptools libboost-all-dev ninja-build | ||
python3 -m pip install -r python/dev_requirements.txt | ||
|
||
- name: Run CMake | ||
run: | | ||
cmake . -B build -DGTSAM_BUILD_PYTHON=1 -DGTSAM_PYTHON_VERSION=${{ matrix.python_version }} | ||
|
||
- name: Build and test wheels | ||
env: | ||
CIBW_BUILD: cp${{ matrix.cibw_python_version }}-${{ matrix.platform_id }} | ||
CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.manylinux_image }} | ||
CIBW_ARCHS: all | ||
CIBW_ENVIRONMENT_PASS_LINUX: NIGHTLY | ||
|
||
CIBW_BUILD_FRONTEND: "build" | ||
CIBW_BEFORE_ALL: bash {project}/build_tools/wheels/cibw_before_all.sh ${{ matrix.python_version }} {project} | ||
|
||
CIBW_BUILD_VERBOSITY: 1 | ||
|
||
run: bash build_tools/wheels/build_wheels.sh | ||
|
||
- name: Store artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: cibw-wheels-cp${{ matrix.cibw_python_version }}-${{ matrix.platform_id }} | ||
path: wheelhouse/*.whl | ||
|
||
upload_all: | ||
name: Upload All | ||
needs: build_wheels | ||
runs-on: ubuntu-latest | ||
permissions: | ||
id-token: write | ||
steps: | ||
- name: Download Artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
path: dist/ | ||
merge-multiple: true | ||
|
||
- name: Publish to TestPyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
packages-dir: dist/ | ||
repository-url: https://test.pypi.org/legacy/ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/build* | ||
/build | ||
/debug* | ||
.idea | ||
*.pyc | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,10 +10,16 @@ set (GTSAM_VERSION_PATCH 0) | |
set (GTSAM_PRERELEASE_VERSION "a0") | ||
math (EXPR GTSAM_VERSION_NUMERIC "10000 * ${GTSAM_VERSION_MAJOR} + 100 * ${GTSAM_VERSION_MINOR} + ${GTSAM_VERSION_PATCH}") | ||
|
||
if ("${GTSAM_PRERELEASE_VERSION}" STREQUAL "") | ||
if (DEFINED ENV{NIGHTLY}) | ||
string(TIMESTAMP NOW "%Y.%m.%d.%H.%M") | ||
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. And make this the PR merge commit hash |
||
set (GTSAM_VERSION_STRING "${NOW}") | ||
set (SETUP_NAME "gtsam-nightly") | ||
elseif ("${GTSAM_PRERELEASE_VERSION}" STREQUAL "") | ||
set (GTSAM_VERSION_STRING "${GTSAM_VERSION_MAJOR}.${GTSAM_VERSION_MINOR}.${GTSAM_VERSION_PATCH}") | ||
set (SETUP_NAME "gtsam") | ||
else() | ||
set (GTSAM_VERSION_STRING "${GTSAM_VERSION_MAJOR}.${GTSAM_VERSION_MINOR}${GTSAM_PRERELEASE_VERSION}") | ||
set (SETUP_NAME "gtsam") | ||
endif() | ||
|
||
project(GTSAM | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
set -x | ||
|
||
python -m pip install cibuildwheel | ||
python -m cibuildwheel build/python --output-dir wheelhouse | ||
yambati03 marked this conversation as resolved.
Show resolved
Hide resolved
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/bin/bash | ||
yambati03 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
set -e | ||
set -x | ||
|
||
PYTHON_VERSION="$1" | ||
PROJECT_DIR="$2" | ||
|
||
export PYTHON="python${PYTHON_VERSION}" | ||
|
||
yum install -y wget ninja-build | ||
$(which $PYTHON) -m pip install -r $PROJECT_DIR/python/dev_requirements.txt | ||
|
||
# Install Boost | ||
wget https://archives.boost.io/release/1.87.0/source/boost_1_87_0.tar.gz --quiet | ||
tar -xzf boost_1_87_0.tar.gz | ||
cd boost_1_87_0 | ||
./bootstrap.sh --prefix=/opt/boost | ||
./b2 install --prefix=/opt/boost --with=all | ||
|
||
# Remove build/cache files that were generated on host | ||
cd .. | ||
rm -rf $PROJECT_DIR/build | ||
rm -rf CMakeCache.txt CMakeFiles | ||
|
||
cmake $PROJECT_DIR \ | ||
-B build \ | ||
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} \ | ||
-DGTSAM_BUILD_TESTS=OFF \ | ||
-DGTSAM_BUILD_UNSTABLE=${GTSAM_BUILD_UNSTABLE:-ON} \ | ||
-DGTSAM_USE_QUATERNIONS=OFF \ | ||
-DGTSAM_WITH_TBB=${GTSAM_WITH_TBB:-OFF} \ | ||
-DGTSAM_BUILD_EXAMPLES_ALWAYS=OFF \ | ||
-DGTSAM_BUILD_WITH_MARCH_NATIVE=OFF \ | ||
-DGTSAM_BUILD_PYTHON=ON \ | ||
-DGTSAM_UNSTABLE_BUILD_PYTHON=${GTSAM_BUILD_UNSTABLE:-ON} \ | ||
-DGTSAM_PYTHON_VERSION=$PYTHON_VERSION \ | ||
-DPYTHON_EXECUTABLE:FILEPATH=$(which $PYTHON) \ | ||
-DGTSAM_ALLOW_DEPRECATED_SINCE_V43=OFF \ | ||
-DCMAKE_INSTALL_PREFIX=$PROJECT_DIR/gtsam_install | ||
|
||
cd $PROJECT_DIR/build/python | ||
make -j $(nproc) install |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 think we need to maybe re-brand to gtsam-develop, as in our slack discussion.