-
Notifications
You must be signed in to change notification settings - Fork 17
152 lines (131 loc) · 4.63 KB
/
build-upload-wheels.yml
File metadata and controls
152 lines (131 loc) · 4.63 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
name: pypi
permissions:
contents: read
on:
release:
types: [published]
pull_request:
paths:
- "buildscripts/cibuildwheel/**"
- ".github/workflows/build-upload-wheels.yml"
- "src/**"
- setup.py
- MANIFEST.in
- pyproject.toml
workflow_dispatch:
jobs:
# Always runs: Build wheels for all platforms and upload artifacts.
build-wheels:
runs-on: ${{ matrix.os }}
strategy:
matrix:
# TODO: Add windows.
os: [ubuntu-latest, macos-latest, ubuntu-24.04-arm]
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
# Checkout the repo with history to get the commit hash for the build
# string.
with:
fetch-depth: 0
# Used to host cibuildwheel.
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065
- name: Install cibuildwheel
run: python -m pip install cibuildwheel==3.3.1
- name: Build wheels {{ matrix.os }}
# Set LLVM_VERSION for the host to forward to the cibuildwheel
# environment.
env:
LLVM_VERSION: "20.1.8"
run: python -m cibuildwheel --output-dir wheelhouse
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl
build-sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
with:
fetch-depth: 0
- name: Build sdist
env:
LLVM_VERSION: "20.1.8"
run: pipx run build --sdist
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
with:
name: cibw-sdist
path: dist/*.tar.gz
# Always runs: Test wheels across OS/Python/Numba matrix.
test-wheels:
needs: build-wheels
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, ubuntu-24.04-arm]
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
numba-version: ['0.62.0', '0.62.1', '0.63.0', '0.63.1']
exclude:
- python-version: '3.14'
numba-version: '0.62.0'
- python-version: '3.14'
numba-version: '0.62.1'
steps:
- name: Download built wheels
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0
with:
pattern: cibw-*
path: dist
merge-multiple: true
- name: Setup Python
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065
with:
python-version: ${{ matrix.python-version }}
- name: Install and test wheel
run: |
python -m pip install --upgrade pip
python -m pip install "numba==${{ matrix.numba-version }}" lark cffi setuptools
python -m pip install --pre --no-deps --no-index --find-links dist/ pyomp
# Verify the numba version.
python -c "import numba; assert numba.__version__ == '${{ matrix.numba-version }}'"
# Run host OpenMP tests.
RUN_TARGET=0 python -m numba.runtests -v -- numba.openmp.tests.test_openmp
# Run device (cpu target) OpenMP tests.
OMP_TARGET_OFFLOAD=mandatory TEST_DEVICE=host RUN_TARGET=1 \
python -m numba.runtests -v -- numba.openmp.tests.test_openmp.TestOpenmpTarget
# Only on pre-release: Publish to TestPyPI for testing.
publish-testpypi:
needs: [build-wheels, test-wheels, build-sdist]
if: github.event.release.prerelease
runs-on: ubuntu-latest
environment: testpypi
permissions:
id-token: write
steps:
- uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0
with:
pattern: cibw-*
path: dist
merge-multiple: true
- name: Publish testpypi
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e
with:
repository-url: https://test.pypi.org/legacy/
verbose: true
# Only on full release: Publish to production PyPI.
publish-pypi:
needs: [build-wheels, test-wheels, build-sdist]
if: github.event_name == 'release' && !github.event.release.prerelease
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write
steps:
- uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0
with:
pattern: cibw-*
path: dist
merge-multiple: true
- name: Publish pypi
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e
with:
verbose: true