-
Notifications
You must be signed in to change notification settings - Fork 11
206 lines (177 loc) · 6.9 KB
/
Copy pathwheels.yml
File metadata and controls
206 lines (177 loc) · 6.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
name: Wheels
# Build the wheels (cibuildwheel; config in pyproject.toml) and the sdist
# as artifacts. setup-recipe stages the llvm-wheel toolchain at /opt/llvm;
# linux mounts it into the build container, the same manylinux_2_28 image
# the toolchain was built on.
# Every code PR and every push to main builds one python per platform
# with the full suite inside; the `build-wheels` label switches a PR to
# the full python list plus the sdist install test. Schedule, tags, and
# dispatch always build the full list.
on:
workflow_dispatch:
pull_request:
types: [opened, synchronize, reopened, labeled]
paths-ignore:
- 'README.md'
push:
branches: [main]
tags: ['v*']
schedule:
- cron: '30 4 * * 1'
permissions:
contents: read
concurrency:
group: wheels-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
wheels:
name: ${{ matrix.label }}
# Label events run only when the PR carries build-wheels, whichever
# label fired; jobs without a needs edge repeat the guard by alias.
if: &label-guard ${{ github.event.action != 'labeled' || contains(github.event.pull_request.labels.*.name, 'build-wheels') }}
strategy:
fail-fast: false
matrix:
# One row per shipped wheel; test-relocation reuses this list.
include: &platforms
- { os: ubuntu-24.04, label: manylinux-x86_64, arch: x86_64 }
- { os: ubuntu-24.04-arm, label: manylinux-aarch64, arch: aarch64 }
- { os: macos-26, label: macosx-arm64, arch: arm64 }
- { os: macos-26-intel, label: macosx-x86_64, arch: x86_64 }
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
# ref pins the recipe content the cache key is computed from.
- uses: compiler-research/ci-workflows/actions/setup-recipe@main
id: llvm
with:
recipe: llvm-wheel
version: '21.1.8'
os: ${{ matrix.os }}
arch: ${{ matrix.arch }}
ref: 02f380b2e46746cd1c948c085894b8594a867fba
- name: Stage the toolchain at /opt/llvm
env:
RECIPE_PATH: ${{ steps.llvm.outputs.path }}
run: sudo mv "$RECIPE_PATH" /opt/llvm
# The inverse of test-sdist's full-run condition: plain PRs and
# main pushes build one python; schedule, dispatch, tags, and PRs
# labeled build-wheels fall through to pyproject's full list.
- name: Build one python unless a full run is requested
if: >-
${{ !(github.event_name == 'schedule'
|| github.event_name == 'workflow_dispatch'
|| startsWith(github.ref, 'refs/tags/')
|| contains(github.event.pull_request.labels.*.name, 'build-wheels')) }}
run: echo 'CIBW_BUILD=cp314-*' >> "$GITHUB_ENV"
- uses: pypa/cibuildwheel@v4.2.0
- name: Assert the build left the checkout clean
run: git diff --exit-code
- name: Check the wheels against the content allowlist
run: python3 .github/wheel_contents_check.py wheelhouse/*.whl
- uses: actions/upload-artifact@v7
with:
name: wheels-${{ matrix.label }}
path: wheelhouse/*.whl
if-no-files-found: error
# Relocation: each wheel installs and runs the full suite away from its
# build machine. The linux image starts bare (g++ because the JIT reads
# the host's C++ standard library headers). The label guard reaches
# this job through needs.
test-relocation:
name: test relocation (${{ matrix.label }})
needs: wheels
strategy:
fail-fast: false
matrix:
include: *platforms
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- uses: actions/download-artifact@v8
with:
name: wheels-${{ matrix.label }}
path: dist
- name: Install the cp314 wheel and run the suite on python:3.14-slim
if: runner.os == 'Linux'
run: |
docker run --rm -v "$PWD":/src -w /src -e PYTHONSAFEPATH=1 \
-e DEBIAN_FRONTEND=noninteractive python:3.14-slim bash -ec '
apt-get -qq update && apt-get -qq -y install g++ make libeigen3-dev libboost-dev
pip install dist/cppjit-*cp314*.whl -r requirements.txt
bash .github/wheel_test.sh'
- uses: actions/setup-python@v7
if: runner.os == 'macOS'
with:
python-version: '3.14'
- name: Install the cp314 wheel and run the suite
if: runner.os == 'macOS'
env:
PYTHONSAFEPATH: '1'
run: |
brew install eigen boost
pip install dist/cppjit-*cp314*.whl -r requirements.txt
bash .github/wheel_test.sh
sdist:
name: sdist
if: *label-guard
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- run: pipx run build --sdist
- name: Check the sdist metadata
run: pipx run twine check dist/*.tar.gz
- uses: actions/upload-artifact@v7
with:
name: sdist
path: dist/*.tar.gz
if-no-files-found: error
# Build from the sdist and run the full suite against the install.
# PR source-build coverage lives in ci.yml; this job rides the full
# runs (schedule/tag/dispatch and the build-wheels label).
test-sdist:
name: test sdist (build + full suite)
needs: sdist
if: >-
${{ github.event_name == 'schedule'
|| github.event_name == 'workflow_dispatch'
|| startsWith(github.ref, 'refs/tags/')
|| contains(github.event.pull_request.labels.*.name, 'build-wheels') }}
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- uses: actions/setup-python@v7
with:
python-version: '3.12'
- uses: compiler-research/ci-workflows/actions/setup-recipe@main
id: llvm
with:
recipe: llvm-wheel
version: '21.1.8'
os: ubuntu-24.04
arch: x86_64
ref: 02f380b2e46746cd1c948c085894b8594a867fba
- uses: actions/download-artifact@v8
with:
name: sdist
path: dist
- name: Install the test suite's native deps
run: sudo apt-get -q update && sudo apt-get -y install libeigen3-dev libboost-dev
- name: Build and install from the sdist with the test requirements
env:
RECIPE_PATH: ${{ steps.llvm.outputs.path }}
run: >
python -m pip install dist/cppjit-*.tar.gz -v
--config-settings=cmake.define.LLVM_DIR="$RECIPE_PATH/lib/cmake/llvm"
--config-settings=cmake.define.Clang_DIR="$RECIPE_PATH/lib/cmake/clang"
-r requirements.txt
- name: Run the test suite against the sdist install
run: bash .github/wheel_test.sh