Skip to content

Commit 98536f8

Browse files
committed
Use standard cibuildwheel orchestration
1 parent 5eb121c commit 98536f8

1 file changed

Lines changed: 146 additions & 72 deletions

File tree

Lines changed: 146 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,158 @@
11
name: 'ROOT Python wheels'
2+
23
on:
34
workflow_dispatch:
45
inputs:
5-
major:
6-
type: choice
7-
description: Major
8-
options:
9-
- 6
10-
- 7
11-
- 8
12-
required: true
13-
default: 6
14-
minor:
15-
type: choice
16-
description: Minor
17-
options:
18-
- 26
19-
- 28
20-
- 30
21-
- 32
22-
- 36
23-
- 38
24-
- 40
25-
- 42
26-
- 44
27-
- 46
28-
- 48
6+
ref:
7+
description: 'The git ref to build the wheel from (branch, tag, or commit SHA).'
8+
type: string
299
required: true
30-
default: 40
31-
patch:
32-
type: choice
33-
description: Patch
34-
options:
35-
- "00"
36-
- "02"
37-
- "04"
38-
- "06"
39-
- "08"
40-
- "10"
41-
- "12"
42-
- "14"
43-
- "16"
44-
- "18"
45-
- "20"
46-
- "22"
47-
- "24"
48-
- "26"
49-
- "28"
50-
- "30"
51-
required: true
52-
default: "00"
10+
default: ''
11+
schedule:
12+
- cron: '01 1 * * *'
13+
pull_request:
14+
types: [opened, synchronize, reopened, labeled]
15+
16+
concurrency:
17+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
18+
cancel-in-progress: true
5319

5420
jobs:
55-
Build_Wheel:
56-
runs-on: macos-26
21+
build-wheels:
22+
if: |
23+
(github.repository_owner == 'root-project' &&
24+
(github.event_name == 'schedule' ||
25+
github.event_name == 'workflow_dispatch')) ||
26+
contains(github.event.pull_request.labels.*.name, 'build-python-wheels')
27+
runs-on: ${{ contains(matrix.target, 'macosx') && 'macos-15' || 'ubuntu-latest' }}
28+
env:
29+
MACOSX_DEPLOYMENT_TARGET: 15.0
30+
strategy:
31+
fail-fast: false
32+
matrix:
33+
target:
34+
- cp310-manylinux_x86_64
35+
- cp311-manylinux_x86_64
36+
- cp312-manylinux_x86_64
37+
- cp313-manylinux_x86_64
38+
- cp314-manylinux_x86_64
39+
- cp310-macosx_arm64
40+
- cp311-macosx_arm64
41+
- cp312-macosx_arm64
42+
- cp313-macosx_arm64
43+
- cp314-macosx_arm64
44+
name: ${{ matrix.target }}
45+
steps:
46+
- uses: actions/checkout@v6
47+
with:
48+
ref: ${{ github.event.inputs.ref }}
49+
- uses: ./.github/workflows/cibuildwheel-impl
50+
with:
51+
build-tag: ${{ matrix.target }}
52+
53+
test-wheels:
54+
needs: build-wheels
55+
runs-on: ubuntu-latest
56+
strategy:
57+
fail-fast: false
58+
matrix:
59+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
60+
name: test-wheel-cp${{ matrix.python-version }}
5761
steps:
58-
- name: Checkout the official ROOT repo
59-
uses: actions/checkout@v6
62+
- uses: actions/checkout@v6
63+
with:
64+
ref: ${{ github.event.inputs.ref }}
65+
- name: Download produced wheels
66+
uses: actions/download-artifact@v4
67+
with:
68+
path: wheels
69+
merge-multiple: true
70+
71+
- name: Setup Python
72+
uses: actions/setup-python@v5
6073
with:
61-
path: root
62-
# ref: v${{ inputs.major }}-${{ inputs.minor }}-${{ inputs.patch }}
63-
- name: Make wheel
74+
python-version: ${{ matrix.python-version }}
75+
76+
- name: Install produced wheel
77+
run: |
78+
ls -R wheels
79+
PY_VER=$(python -c "import sys; print(f'cp{sys.version_info.major}{sys.version_info.minor}')")
80+
WHEEL=$(ls wheels/*${PY_VER}*manylinux*.whl | head -n 1)
81+
echo "Python version: ${PY_VER}, installing wheel: ${WHEEL}"
82+
pip install "$WHEEL"
83+
84+
- name: Install tutorials dependencies
85+
run: |
86+
python -m pip install --no-cache-dir -r test/wheels/requirements-ci.txt
87+
88+
- name: Run tutorials
89+
run: |
90+
pytest -vv --verbosity="4" -rF test/wheels
91+
92+
create-and-upload-wheel-registry:
93+
if: github.event_name != 'pull_request' # The secrets are not available in PR
94+
needs: test-wheels
95+
runs-on: ubuntu-latest
96+
steps:
97+
98+
- name: Download produced wheels
99+
uses: actions/download-artifact@v4
100+
with:
101+
merge-multiple: true
102+
103+
- name: Install required system packages
104+
run: sudo apt-get install -y krb5-user xrootd-client
105+
106+
- name: Setup Python
107+
uses: actions/setup-python@v5
108+
109+
- name: Create PEP503-compliant wheel registry
110+
run: |
111+
mkdir -p wheelhouse
112+
mv *.whl wheelhouse
113+
python -m pip install --upgrade pip
114+
python -m pip install --user simple503
115+
simple503 wheelhouse
116+
117+
- name: Compute number of files to upload
118+
id: nfiles
119+
run: echo "NFILES=$(find wheelhouse -maxdepth 1 | wc -l)" >> "$GITHUB_OUTPUT"
120+
121+
- name: Upload wheels to EOS
64122
env:
65-
MACOSX_DEPLOYMENT_TARGET: 26.5
123+
RWEBEOS_KT: ${{ secrets.RWEBEOS_KT }}
124+
KT_FILE_NAME: /tmp/decoded.keytab
125+
EOS_PATH: /eos/project/r/root-eos/www/experimental-python-wheels
126+
EOS_ENDPOINT: root://eosproject-r.cern.ch
127+
KRB5CCNAME: /tmp/krb5cc
128+
NFILES: ${{ steps.nfiles.outputs.NFILES }}
129+
working-directory: ${{ env.WORKDIR }}
66130
run: |
67-
mkdir wheel_creation && cd wheel_creation
68-
cp -r ../root .
69-
python3 -m venv root_build_env
70-
source root_build_env/bin/activate
71-
pip install --upgrade pip setuptools wheel build
72-
cd root
73-
pip install -r requirements.txt
74-
python3 -m build --wheel
75-
pip install delocate
76-
mkdir fixed_wheels
77-
delocate-wheel -v -w fixed_wheels/ dist/*.whl
78-
79-
- name: Upload_wheel
80-
uses: actions/upload-artifact@v6
131+
echo +++ Content
132+
ls
133+
echo +++ Retrieving the secret
134+
echo ${RWEBEOS_KT} | base64 -d > ${KT_FILE_NAME}
135+
echo +++ Creating the token
136+
kinit -p ${{ secrets.KRB5USER }}@${{ secrets.KRB5REALM }} -kt ${KT_FILE_NAME}
137+
echo +++ Running the copy
138+
xrdcp --parallel ${NFILES} -rf wheelhouse/* ${EOS_ENDPOINT}/${EOS_PATH}/
139+
140+
publish-to-pypi:
141+
if: github.event_name == 'workflow_dispatch'
142+
needs: test-wheels
143+
runs-on: ubuntu-latest
144+
name: >-
145+
Publish Python distribution to PyPI
146+
environment:
147+
name: pypi
148+
url: https://pypi.org/p/root
149+
permissions:
150+
id-token: write
151+
steps:
152+
- name: Download produced wheels
153+
uses: actions/download-artifact@v4
81154
with:
82-
name: Wheel upload
83-
path: /Users/runner/work/root/root/wheel_creation/root/fixed_wheels/*.whl
84-
if-no-files-found: error
155+
merge-multiple: true
156+
path: dist/
157+
- name: Publish distribution to PyPI
158+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)