-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SymForce-External] Workflow and build support for pip wheels
See `documentation.rst` for usage description. This primarily consists of a workflow (manually triggered) to build wheels on GitHub Actions, and supporting changes to our build to make this work, i.e. for the right files to end up in the wheels in the right places (including getting the README to look right on PyPI). You can now: - Build a wheel in a fresh environment, with basically whatever method you'd like (`python -m build`, `pip wheel`, `python setup.py bdist_wheel`). Running this repeatedly to build multiple wheels also works, but may require cleaning the build directory depending on the method used (see the TODO on symenginepy in CMakeLists.txt) - `pip install .` repeatedly to re-install symforce in the same environment - `pip install -e .` repeatedly, manually cleaning the build (technically just the symenginepy build) between runs Closes #157 GitOrigin-RevId: 0241cd20589e070c8e3d857f61fc2132746113c9
- Loading branch information
1 parent
7f59396
commit fba4ae8
Showing
11 changed files
with
365 additions
and
103 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 @@ | ||
symforce/.clang-format |
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,17 @@ | ||
#!/bin/bash | ||
|
||
# ---------------------------------------------------------------------------- | ||
# SymForce - Copyright 2022, Skydio, Inc. | ||
# This source code is under the Apache 2.0 license found in the LICENSE file. | ||
# ---------------------------------------------------------------------------- | ||
|
||
set -ex | ||
|
||
if [ "$CIBW_ARCHS_MACOS" = "arm64" ]; then | ||
mkdir arm-homebrew | ||
curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C arm-homebrew | ||
response=$(./arm-homebrew/bin/brew fetch --force --bottle-tag=arm64_big_sur gmp | grep "Downloaded to: " | cut -c 16-) | ||
echo $response | ||
# parsed=($response) | ||
./arm-homebrew/bin/brew install $response | ||
fi |
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,84 @@ | ||
name: Build wheels | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build-extra: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Build Wheels | ||
run: | | ||
pip3 install build | ||
python3 -m build --sdist --wheel third_party/skymarshal --outdir ./dist | ||
python3 -m build --sdist --wheel gen/python --outdir ./dist | ||
- name: Upload Wheels | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: symforce-wheels | ||
path: dist/* | ||
|
||
build-macos: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [macos-latest] | ||
python-version: [cp38, cp39, cp310] | ||
arch: [x86_64, arm64] | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install cibuildwheel | ||
run: python3 -m pip install cibuildwheel==2.5.0 | ||
|
||
- name: Build wheels | ||
run: python3 -m cibuildwheel --output-dir wheelhouse | ||
env: | ||
CIBW_BUILD: ${{ matrix.python-version }}-* | ||
CIBW_ARCHS_MACOS: ${{ matrix.arch }} | ||
CIBW_BUILD_FRONTEND: build | ||
GMP_ROOT: /Users/runner/work/symforce/symforce/arm-homebrew/opt/gmp | ||
CIBW_BEFORE_BUILD: ./.github/scripts/mac_install_gmp.sh | ||
CIBW_ENVIRONMENT: SYMFORCE_REWRITE_LOCAL_DEPENDENCIES=True | ||
|
||
- name: Upload wheels | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: symforce-wheels | ||
path: wheelhouse/*.whl | ||
|
||
build-linux: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: [cp38, cp39, cp310] | ||
arch: [x86_64] | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install cibuildwheel | ||
run: python3 -m pip install cibuildwheel==2.5.0 | ||
|
||
- name: Build wheels | ||
run: python3 -m cibuildwheel --output-dir wheelhouse | ||
env: | ||
CIBW_BUILD: ${{ matrix.python-version }}-manylinux_${{ matrix.arch }} | ||
CIBW_BUILD_FRONTEND: build | ||
CIBW_BEFORE_BUILD: yum install -y gmp-devel git | ||
CIBW_ENVIRONMENT: SYMFORCE_REWRITE_LOCAL_DEPENDENCIES=True | ||
|
||
- name: Upload Wheels | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: symforce-wheels | ||
path: wheelhouse/*.whl |
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
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
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.