Skip to content

Commit f70ab5c

Browse files
committed
Wheels: document the build and the PyPI release, no pull_request trigger
1 parent 9b4c016 commit f70ab5c

3 files changed

Lines changed: 65 additions & 6 deletions

File tree

‎.github/workflows/wheels.yml‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
name: Wheels
1111

12+
# no pull_request trigger: the review/* branches are already built on push,
13+
# a full build takes hours
1214
on:
1315
push:
1416
branches: ["master", "review/**"]
@@ -19,12 +21,6 @@ on:
1921
- CMakeLists.txt
2022
- ci/wheels/**
2123
- .github/workflows/wheels.yml
22-
pull_request:
23-
paths:
24-
- pyproject.toml
25-
- CMakeLists.txt
26-
- ci/wheels/**
27-
- .github/workflows/wheels.yml
2824
workflow_dispatch:
2925

3026
concurrency:

‎.gitignore‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,6 @@ _build/
6464
.Trashes
6565
ehthumbs.db
6666
Thumbs.db
67+
68+
# cibuildwheel
69+
wheelhouse/

‎ci/wheels/README.md‎

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# PyPI wheels
2+
3+
The pythonocc-core wheels published on PyPI are built by
4+
[cibuildwheel](https://cibuildwheel.pypa.io) in the GitHub Actions workflow
5+
`.github/workflows/wheels.yml`:
6+
7+
| Platform | Wheels | Runner |
8+
|----------|--------------------------------------------|------------------------------|
9+
| Linux | `manylinux_2_28_x86_64`, `manylinux_2_28_aarch64` | `ubuntu-24.04`, `ubuntu-24.04-arm` |
10+
| macOS | `macosx_11_0_x86_64`, `macosx_11_0_arm64` | `macos-15-intel`, `macos-15` |
11+
| Windows | `win_amd64` | `windows-2022` |
12+
13+
for CPython 3.10 to 3.14, plus the sdist.
14+
15+
* `pyproject.toml`: the scikit-build-core build, the version is read from
16+
`CMakeLists.txt`, and the cibuildwheel configuration.
17+
* `deps/`: the native dependencies build scripts: SWIG, OCCT and its 3rd
18+
parties (freetype, FreeImage, RapidJSON).
19+
* Linux: built in the manylinux_2_28 container, 3rd parties from the
20+
system (EPEL for FreeImage).
21+
* macOS, Windows: built on the runner, 3rd parties built by vcpkg through
22+
the OCCT vcpkg manifest, with the triplets of `triplets/`.
23+
24+
For each platform, a first job builds the dependencies and saves them to the
25+
GitHub cache (the key is a hash of the platform scripts and triplet), then one
26+
job per Python version restores them and builds and tests a wheel. The
27+
libraries are vendored in the wheels by auditwheel (Linux), delocate (macOS)
28+
and delvewheel (Windows).
29+
30+
The workflow runs on the pushes to master and review/* that change the
31+
packaging, on demand (workflow_dispatch), and on the tags.
32+
33+
## Releasing
34+
35+
Pushing a tag builds the wheels and the sdist and uploads them to PyPI
36+
through [trusted publishing](https://docs.pypi.org/trusted-publishers/).
37+
This requires, once:
38+
39+
* on PyPI, a trusted publisher for the `pythonocc-core` project: owner
40+
`tpaviot`, repository `pythonocc-core`, workflow `wheels.yml`, environment
41+
`pypi`.
42+
* on GitHub, a `pypi` environment in the repository settings (optionally
43+
with required reviewers, to approve each upload).
44+
45+
When upgrading SWIG or OCCT, update the versions in the three `deps/`
46+
scripts, the cache is invalidated by their change.
47+
48+
## Building locally
49+
50+
Linux wheels can be built on any machine with docker:
51+
52+
```bash
53+
pip install cibuildwheel
54+
# optional: cache SWIG and OCCT between runs (/host is the host filesystem)
55+
export PYOCC_DEPS_CACHE=/host$HOME/.cache/pyocc-deps
56+
CIBW_BUILD='cp312-*' cibuildwheel --platform linux
57+
```
58+
59+
from a clean checkout: cibuildwheel copies the whole source tree into the
60+
container.

0 commit comments

Comments
 (0)