1+ name : Build Wheels
2+
3+ on :
4+ push :
5+ branches : [ main, master ]
6+ pull_request :
7+ branches : [ main, master ]
8+ release :
9+ types : [ published ]
10+
11+ jobs :
12+ build_wheels :
13+ name : Build wheels on ${{ matrix.os }}
14+ runs-on : ${{ matrix.os }}
15+ strategy :
16+ matrix :
17+ os : [ubuntu-latest, windows-latest, macos-latest]
18+
19+ steps :
20+ - uses : actions/checkout@v4
21+
22+ - name : Set up Python
23+ uses : actions/setup-python@v4
24+ with :
25+ python-version : ' 3.11'
26+
27+ - name : Install dependencies
28+ run : |
29+ python -m pip install --upgrade pip
30+ pip install cibuildwheel
31+
32+ # Ubuntu: Install CGAL and dependencies
33+ - name : Install CGAL on Ubuntu
34+ if : runner.os == 'Linux'
35+ run : |
36+ sudo apt-get update
37+ sudo apt-get install -y \
38+ libcgal-dev \
39+ libeigen3-dev \
40+ libgmp-dev \
41+ libmpfr-dev \
42+ build-essential
43+
44+ # macOS: Install CGAL and dependencies via Homebrew
45+ - name : Install CGAL on macOS
46+ if : runner.os == 'macOS'
47+ run : |
48+ brew update
49+ brew install cgal eigen gmp mpfr
50+
51+ # Windows: Install CGAL and dependencies via vcpkg
52+ - name : Install CGAL on Windows
53+ if : runner.os == 'Windows'
54+ shell : cmd
55+ run : |
56+ git clone https://github.com/Microsoft/vcpkg.git C:\vcpkg
57+ cd C:\vcpkg
58+ .\bootstrap-vcpkg.bat
59+ .\vcpkg integrate install
60+ .\vcpkg install cgal:x64-windows eigen3:x64-windows gmp:x64-windows mpfr:x64-windows
61+
62+ - name : Set dynamic version
63+ run : |
64+ echo "DYNAMIC_VERSION=0.1.0.dev$(git rev-parse --short HEAD)" >> $GITHUB_ENV
65+ shell : bash
66+
67+ - name : Build wheels
68+ env :
69+ # Configure cibuildwheel
70+ CIBW_BUILD : " cp39-* cp310-* cp311-* cp312-* cp313-*"
71+ CIBW_SKIP : " *-win32 *-manylinux_i686 *-musllinux*"
72+
73+ # Set dynamic version for build
74+ CIBW_ENVIRONMENT : " CGAL_ALPHA_WRAPPING_VERSION=${{ env.DYNAMIC_VERSION }}"
75+
76+ # Linux environment
77+ CIBW_BEFORE_BUILD_LINUX : |
78+ yum install -y epel-release &&
79+ yum install -y cgal-devel eigen3-devel gmp-devel mpfr-devel gcc-c++ ||
80+ (apt-get update && apt-get install -y libcgal-dev libeigen3-dev libgmp-dev libmpfr-dev build-essential)
81+
82+ # macOS environment
83+ CIBW_BEFORE_BUILD_MACOS : |
84+ brew install cgal eigen gmp mpfr || true
85+
86+ # Windows environment
87+ CIBW_BEFORE_BUILD_WINDOWS : |
88+ if not exist "C:\vcpkg" (
89+ git clone https://github.com/Microsoft/vcpkg.git C:\vcpkg &&
90+ cd C:\vcpkg &&
91+ .\bootstrap-vcpkg.bat &&
92+ .\vcpkg integrate install &&
93+ .\vcpkg install cgal:x64-windows eigen3:x64-windows gmp:x64-windows mpfr:x64-windows
94+ )
95+
96+ # Environment variables for Windows builds
97+ CIBW_ENVIRONMENT_WINDOWS : >
98+ VCPKG_ROOT="C:\vcpkg"
99+ CMAKE_TOOLCHAIN_FILE="C:\vcpkg\scripts\buildsystems\vcpkg.cmake"
100+
101+ # Repair wheels (especially important for Linux)
102+ CIBW_REPAIR_WHEEL_COMMAND_LINUX : " auditwheel repair -w {dest_dir} {wheel}"
103+ CIBW_REPAIR_WHEEL_COMMAND_MACOS : " delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}"
104+
105+ # Test command to verify wheels work
106+ CIBW_TEST_COMMAND : " python -c 'import cgal_alpha_wrapping; print(cgal_alpha_wrapping.__name__)'"
107+
108+ # Build settings
109+ CIBW_BUILD_VERBOSITY : 1
110+
111+ run : python -m cibuildwheel --output-dir wheelhouse
112+
113+ - name : Upload wheels
114+ uses : actions/upload-artifact@v3
115+ with :
116+ name : wheels-${{ matrix.os }}
117+ path : ./wheelhouse/*.whl
118+
119+ build_sdist :
120+ name : Build source distribution
121+ runs-on : ubuntu-latest
122+ steps :
123+ - uses : actions/checkout@v4
124+
125+ - name : Set up Python
126+ uses : actions/setup-python@v4
127+ with :
128+ python-version : ' 3.11'
129+
130+ - name : Install dependencies
131+ run : |
132+ python -m pip install --upgrade pip
133+ pip install build
134+
135+ - name : Set dynamic version
136+ run : |
137+ echo "DYNAMIC_VERSION=0.1.0.dev$(git rev-parse --short HEAD)" >> $GITHUB_ENV
138+ shell : bash
139+
140+ - name : Build sdist
141+ env :
142+ CGAL_ALPHA_WRAPPING_VERSION : ${{ env.DYNAMIC_VERSION }}
143+ run : python -m build --sdist
144+
145+ - name : Upload sdist
146+ uses : actions/upload-artifact@v3
147+ with :
148+ name : sdist
149+ path : dist/*.tar.gz
150+
151+ upload_test_pypi :
152+ name : Upload to Test PyPI
153+ needs : [build_wheels, build_sdist]
154+ runs-on : ubuntu-latest
155+ if : github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
156+ environment :
157+ name : testpypi
158+ url : https://test.pypi.org/p/cgal-alpha-wrapping
159+ permissions :
160+ id-token : write
161+ steps :
162+ - name : Download all artifacts
163+ uses : actions/download-artifact@v3
164+
165+ - name : Publish to Test PyPI
166+ uses : pypa/gh-action-pypi-publish@release/v1
167+ with :
168+ repository-url : https://test.pypi.org/legacy/
169+ packages-dir : ./*/
170+
171+ upload_pypi :
172+ name : Upload to PyPI
173+ needs : [build_wheels, build_sdist]
174+ runs-on : ubuntu-latest
175+ if : github.event_name == 'release' && github.event.action == 'published'
176+ environment :
177+ name : pypi
178+ url : https://pypi.org/p/cgal-alpha-wrapping
179+ permissions :
180+ id-token : write
181+ steps :
182+ - name : Download all artifacts
183+ uses : actions/download-artifact@v3
184+
185+ - name : Publish to PyPI
186+ uses : pypa/gh-action-pypi-publish@release/v1
187+ with :
188+ packages-dir : ./*/
0 commit comments