Skip to content

Build wheels with cibuildwheel #8

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

Merged
merged 3 commits into from
May 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
40 changes: 40 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build

on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
paths-ignore:
- '**.rst'
- 'docs/**'
push:
branches:
- main
paths-ignore:
- '**.rst'
- 'docs/**'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build_wheels:
strategy:
matrix:
os: ["ubuntu-20.04", "macos-11"]

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

steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: |
make requirements c_lib
- name: Build wheels
uses: pypa/[email protected]
- name: Upload packages
if: github.event_name == 'push'
uses: actions/upload-artifact@v3
with:
name: ada-url-packages
path: wheelhouse/*
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and test
name: Unit tests

on:
pull_request:
Expand All @@ -21,38 +21,26 @@ jobs:
build_test:
strategy:
matrix:
os: ["ubuntu-20.04", "macos-latest"]
python: ["3.8", "3.9", "3.10", "3.11"]
os: ["ubuntu-20.04", "macos-11"]

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

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python }}
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
python-version: "3.8"
- name: Install dependencies
run: |
make requirements
- name: Build packages
run: |
make package
- name: Repair wheels
if: "matrix.os == 'ubuntu-20.04'"
run: |
pip install -U auditwheel patchelf
auditwheel repair --plat manylinux_2_24_x86_64 --wheel-dir dist dist/ada_url-*linux*.whl
- name: Run tests
run: |
pip install -e .
make coverage
- name: Build docs with sphinx
if: "matrix.python == '3.8' && matrix.os == 'ubuntu-20.04'"
- name: Check docs
run: |
make docs
- name: Upload packages
uses: actions/upload-artifact@v3
with:
name: ada-url-packages
path: dist/*
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,11 @@ clean:
$(RM) ada_url/_ada_wrapper.abi3.so
$(RM) ada_url/ada.o

.PHONY: package
package:
.PHONY: c_lib
c_lib:
$(CXX) -c "ada_url/ada.cpp" -fPIC -std="c++17" -O2 -o "ada_url/ada.o"

.PHONY: package
package: c_lib
python -m build --no-isolation
twine check dist/*
16 changes: 16 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,19 @@ exclude = [
".git",
".ruff_cache",
]

[tool.cibuildwheel]
build = [
"cp38-*",
"cp39-*",
"cp310-*",
"cp311-*",
"pp38-*",
"pp39-*",
]

[tool.cibuildwheel.linux]
archs = ["x86_64"]

[tool.cibuildwheel.macos]
archs = ["x86_64", "universal2", "arm64"]