Skip to content

Commit

Permalink
CI: Make a wheel
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmcl committed Feb 6, 2025
1 parent 9f5ab82 commit 916b5fc
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 5 deletions.
16 changes: 13 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: CI

on:
push:
branches: ["main"]
branches: ["**"] # For now, let's build all branches. Roll this back if it gets too slow or we exhaust our quota.
pull_request:
branches: ["**"] # * does not match '/'
workflow_dispatch: # For manually triggering a build: https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#workflow_dispatch
Expand All @@ -12,9 +12,10 @@ jobs:
strategy:
matrix:
# We mainly care about hardware rather than OS
# macos-13 is x86. All later ones are arm64
# macos-13 is x86. This one doesn't work for some reason.
# macos-latest is arm64
# ubuntu-latest is x64
os: [macos-13, macos-latest, ubuntu-latest]
os: [macos-latest, ubuntu-latest]

runs-on: ${{ matrix.os }}

Expand All @@ -41,3 +42,12 @@ jobs:
working-directory: ./interop
run: |
pytest
- name: Make a wheel
# https://github.com/pypa/cibuildwheel
run: |
pip install cibuildwheel
bin/make-wheel
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl
10 changes: 9 additions & 1 deletion bin/make-wheel
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,15 @@ cp $ROOT/interop/pyproject.toml $WHEEL_DIR
cp $ROOT/interop/MANIFEST.in $WHEEL_DIR

cd $WHEEL_DIR
python -m build

if [ -z "${GITHUB_RUN_ID+x}" ]; then
echo "Building wheel locally"
python -m build -w
else
# https://github.com/pypa/cibuildwheel
echo "Building wheel via GitHub Actions"
python -m cibuildwheel --output-dir $WHEEL_DIR/wheelhouse
fi

# To upload the wheel, with the proper token in ~/.pypirc, run
#
Expand Down
2 changes: 1 addition & 1 deletion interop/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1 +1 @@
include klr/bin/*
include bin/*
13 changes: 13 additions & 0 deletions interop/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,18 @@ testpaths = [
"test",
]

# NB: All this setuptools stuff took about 1000 hours to figure out so never delete this.
[tool.setuptools]
# This makes it ok for there to be both klr and wheelhouse (where we generates wheels on github actions) in the same directory
packages = ["klr"]
# This tricks setuptools into knowing this is a binary wheel
ext-modules = [
{name = "klr", sources = []}
]

[tool.setuptools.package-data]
# This part is essential to get the binary bin/klr included in the wheel
klr = ["bin/klr"]

[project.urls]
Repository = "https://github.com/leanprover/KLR"

0 comments on commit 916b5fc

Please sign in to comment.