1+ name : Publish PauliEngine Python sdist and wheels to PyPI
2+
3+ on :
4+ workflow_dispatch :
5+ inputs :
6+ force-upload :
7+ description : ' Upload artifacts without a corresponding release'
8+ required : false
9+ default : false
10+ type : boolean
11+ release :
12+ types :
13+ - published
14+ pull_request :
15+ # PRs trigger for the "opened", "reopened", "synchronize" events (default) and
16+ # "ready_for_review"
17+ paths :
18+ - .github/workflows/deploy.yml
19+ types :
20+ - opened
21+ - reopened
22+ - synchronize # when new commits are pushed to the PR
23+ - ready_for_review # when the PR is un-drafted
24+
25+ concurrency :
26+ group : ${{ github.workflow }}-${{ github.ref }}
27+ cancel-in-progress : true
28+
29+ env :
30+ COLUMNS : 120
31+ FORCE_COLOR : 3
32+
33+ jobs :
34+ build-sdist :
35+ name : Build source distribution
36+ runs-on : ubuntu-latest
37+ steps :
38+ - uses : actions/checkout@v6
39+ with :
40+ fetch-depth : 0 # such that setuptools_scm can do its job correctly
41+
42+ - name : Build SDist
43+ run : |
44+ pipx install uv
45+ pipx run build --verbose --sdist --installer=uv
46+
47+ - uses : actions/upload-artifact@v6
48+ with :
49+ name : cibw-sdist
50+ path : dist/*.tar.gz
51+
52+ build-wheels :
53+ # in combination with the PR types selection, this top-level if statement
54+ # skips running the workflow for Draft PRs
55+ if : ${{ github.event_name == 'push' || !github.event.pull_request.draft }}
56+ name : Build Python wheels for ${{ matrix.os }}
57+ runs-on : ${{ matrix.runs-on }}
58+ strategy :
59+ matrix :
60+ os : [ linux-intel, linux-arm, macos-arm, windows-intel, windows-arm]
61+ include :
62+ - archs : native
63+ platform : auto
64+ - os : linux-intel
65+ runs-on : ubuntu-latest
66+ - os : linux-arm
67+ runs-on : ubuntu-24.04-arm
68+ - os : macos-arm
69+ runs-on : macos-latest
70+ - os : windows-intel
71+ runs-on : windows-latest
72+ - os : windows-arm
73+ runs-on : windows-latest
74+ steps :
75+ - uses : actions/checkout@v6
76+ with :
77+ fetch-depth : 0
78+
79+ - uses : pypa/cibuildwheel@v3.3.1
80+ with :
81+ extras : " uv"
82+ env :
83+ # target platform
84+ CIBW_PLATFORM : ${{ matrix.platform }}
85+ # architectures to build
86+ CIBW_ARCHS : ${{ matrix.archs }}
87+ # use uv and build
88+ CIBW_BUILD_FRONTEND : " build[uv]"
89+ # increase pip debugging output
90+ CIBW_BUILD_VERBOSITY : 1
91+ CIBW_DEBUG_TRACEBACK : TRUE
92+ CIBW_BEFORE_ALL_LINUX : |
93+ dnf install -y ninja-build
94+ # install conan and C++ dependencies for the project
95+ pip install conan
96+ conan profile detect --force
97+
98+ # install symengine
99+ conan install . --output-folder=build --build=missing -pr ./conan_profile
100+ CIBW_BEFORE_ALL_MACOS : |
101+ # install conan and C++ dependencies for the project
102+ pip install conan
103+ conan profile detect --force
104+
105+ # install symengine
106+ conan install . --output-folder=build --build=missing -pr ./conan_profile
107+ CIBW_BEFORE_ALL_WINDOWS : |
108+ pip install delvewheel conan && conan profile detect --force && conan install . --output-folder=build --build=missing -pr conan_profile
109+ # do not activate architecture-dependent compiler flags
110+ # 4 jobs in parallel, but do not start new ones if load average exceeds 5
111+ CIBW_ENVIRONMENT_LINUX :
112+ CMAKE_TOOLCHAIN_FILE=build/conan_toolchain.cmake
113+ CIBW="true"
114+ SKBUILD_BUILD_TOOL_ARGS="-j4;-l5"
115+ # set deployment target for C++20 compatibility
116+ # do not activate architecture-dependent compiler flags
117+ # 4 jobs in parallel, but do not start new ones if load average exceeds 5
118+ CIBW_ENVIRONMENT_MACOS : >
119+ CIBW="true"
120+ MACOSX_DEPLOYMENT_TARGET=15.0
121+ SKBUILD_BUILD_TOOL_ARGS="-j4;-l5"
122+ CIBW_ENVIRONMENT_WINDOWS : >
123+ CIBW="true"
124+ SKBUILD_BUILD_TOOL_ARGS="/m:4"
125+ CMAKE_TOOLCHAIN_FILE=build\conan_toolchain.cmake
126+ # build 3.10, 3.11, 3.12, 3.13 (with GIL), and 3.14 (with GIL)
127+ CIBW_BUILD : " cp310-* cp311-* cp312-* cp313-* cp314-*"
128+ # skip musl builds, and PyPy builds
129+ CIBW_SKIP : " *-musllinux_*"
130+ # use abi3audit to catch issues with Limited API wheels
131+ CIBW_REPAIR_WHEEL_COMMAND_LINUX : |
132+ auditwheel repair -w {dest_dir} {wheel}
133+ if [[ "{wheel}" == *abi3* ]]; then
134+ pipx run abi3audit --strict --report {wheel}
135+ else
136+ echo "{wheel} is not abi3, skipping abi3audit"
137+ fi
138+ # use abi3audit to catch issues with Limited API wheels
139+ CIBW_REPAIR_WHEEL_COMMAND_MACOS : |
140+ delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}
141+ if [[ "{wheel}" == *abi3* ]]; then
142+ pipx run abi3audit --strict --report {wheel}
143+ else
144+ echo "{wheel} is not abi3, skipping abi3audit"
145+ fi
146+ CIBW_REPAIR_WHEEL_COMMAND_WINDOWS : |
147+ delvewheel repair -w {dest_dir} {wheel}
148+ if [[ "{wheel}" == *abi3* ]]; then
149+ pipx run abi3audit --strict --report {wheel}
150+ else
151+ echo "{wheel} is not abi3, skipping abi3audit"
152+ fi
153+ CIBW_TEST_COMMAND : python -m pytest {package}/tests
154+ CIBW_TEST_GROUPS : " test"
155+
156+ - name : Upload wheels
157+ uses : actions/upload-artifact@v6
158+ with :
159+ name : cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
160+ path : wheelhouse/*.whl
0 commit comments