-
Notifications
You must be signed in to change notification settings - Fork 10
213 lines (190 loc) · 8.1 KB
/
wheels.yml
File metadata and controls
213 lines (190 loc) · 8.1 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
207
208
209
210
211
212
213
name: Publish sdist and wheels
on:
schedule:
# ┌───────────── minute (0 - 59)
# │ ┌───────────── hour (0 - 23)
# │ │ ┌───────────── day of the month (1 - 31)
# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC)
# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT)
# │ │ │ │ │
- cron: "42 2 * * SUN,WED"
pull_request:
branches:
- main
- maintenance/**
push:
branches:
- main # FOR TESTING
tags:
- v*
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
contents: read # to fetch code (actions/checkout)
jobs:
build_wheels:
name: Build wheel ${{ matrix.python }}-${{ matrix.buildplat[1] }}-${{ matrix.buildplat[2] }}
runs-on: ${{ matrix.buildplat[0] }}
strategy:
# Ensure that a wheel builder finishes even if another fails
fail-fast: false
matrix:
# Github Actions doesn't support pairing matrix values together, let's improvise
# https://github.com/github/feedback/discussions/7835#discussioncomment-1769026
buildplat:
- [ubuntu-22.04, manylinux_x86_64, ""]
#- [ubuntu-22.04, musllinux_x86_64, ""]
#- [ubuntu-22.04-arm, manylinux_aarch64, ""]
#- [ubuntu-22.04-arm, musllinux_aarch64, ""]
#- [macos-13, macosx_x86_64, openblas]
# targeting macos >= 14. Could probably build on macos-14, but it would be a cross-compile
#- [macos-13, macosx_x86_64, accelerate]
#- [macos-14, macosx_arm64, accelerate] # always use accelerate
#- [windows-2022, win_amd64, ""]
#- [windows-2022, win32, ""]
#- [windows-11-arm, win_arm64, ""]
#python: ["cp311", "cp312", "cp313", "cp313t", "cp314", "cp314t", "pp311"]
python: ["cp311"] #, "cp312", "cp313", "cp313t", "cp314", "cp314t", "pp311"]
exclude:
# Don't build PyPy 32-bit windows
- buildplat: [windows-2022, win32, ""]
python: "pp311"
# Don't build PyPy arm64 windows
- buildplat: [windows-11-arm, win_arm64, ""]
python: "pp311"
# No PyPy on musllinux images
- buildplat: [ ubuntu-22.04, musllinux_x86_64, "" ]
python: "pp311"
- buildplat: [ ubuntu-22.04-arm, musllinux_aarch64, "" ]
python: "pp311"
- buildplat: [ macos13, macosx_x86_64, openblas ]
python: "cp313t"
- buildplat: [ macos13, macosx_x86_64, openblas ]
python: "cp314t"
env:
IS_32_BIT: ${{ matrix.buildplat[1] == 'win32' }}
steps:
- name: Checkout numpy-release
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- name: Checkout numpy
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: numpy/numpy
path: numpy-src
submodules: true
persist-credentials: false
- name: Setup MSVC (32-bit)
if: ${{ matrix.buildplat[1] == 'win32' }}
uses: bus1/cabuild/action/msdevshell@e22aba57d6e74891d059d66501b6b5aed8123c4d # v1
with:
architecture: 'x86'
- name: Setup LLVM for Windows ARM64
if: ${{ matrix.buildplat[1] == 'win_arm64' }}
uses: ./.github/windows_arm64_steps
- name: pkg-config-for-win
if: runner.os == 'windows'
run: |
choco install -y --no-progress --stoponfirstfailure --checksum 6004DF17818F5A6DBF19CB335CC92702 pkgconfiglite
$CIBW = "${{ github.workspace }}/.openblas"
# pkgconfig needs a complete path, and not just "./openblas since the
# build is run in a tmp dir (?)
# It seems somewhere in the env passing, `\` is not
# passed through, so convert it to '/'
$CIBW = $CIBW.replace("\","/")
echo "CIBW_ENVIRONMENT_WINDOWS=PKG_CONFIG_PATH=$CIBW" >> $env:GITHUB_ENV
- name: Setup macOS
if: matrix.buildplat[0] == 'macos-13' || matrix.buildplat[0] == 'macos-14'
run: |
# Needed due to https://github.com/actions/runner-images/issues/3371
# Supported versions: https://github.com/actions/runner-images/blob/main/images/macos/macos-14-arm64-Readme.md
echo "FC=gfortran-13" >> "$GITHUB_ENV"
echo "F77=gfortran-13" >> "$GITHUB_ENV"
echo "F90=gfortran-13" >> "$GITHUB_ENV"
if [[ ${{ matrix.buildplat[2] }} == 'accelerate' ]]; then
# macosx_arm64 and macosx_x86_64 with accelerate
# only target Sonoma onwards
CIBW="MACOSX_DEPLOYMENT_TARGET=14.0 INSTALL_OPENBLAS=false RUNNER_OS=macOS"
echo "CIBW_ENVIRONMENT_MACOS=$CIBW" >> "$GITHUB_ENV"
# the macos-13 image that's used for building the x86_64 wheel can't test
# a wheel with deployment target >= 14 without further work
echo "CIBW_TEST_SKIP=*-macosx_x86_64" >> "$GITHUB_ENV"
else
# macosx_x86_64 with OpenBLAS
# if INSTALL_OPENBLAS isn't specified then scipy-openblas is automatically installed
CIBW="RUNNER_OS=macOS"
PKG_CONFIG_PATH="$PWD/.openblas"
DYLD="$DYLD_LIBRARY_PATH:/$PWD/.openblas/lib"
echo "CIBW_ENVIRONMENT_MACOS=$CIBW PKG_CONFIG_PATH=$PKG_CONFIG_PATH DYLD_LIBRARY_PATH=$DYLD" >> "$GITHUB_ENV"
fi
- name: Build wheels
uses: pypa/cibuildwheel@5f22145df44122af0f5a201f93cf0207171beca7 # v3.0.0
env:
CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }}
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: ${{ matrix.python }}-${{ matrix.buildplat[1] }}-${{ matrix.buildplat[2] }}
path: ./wheelhouse/*.whl
build_sdist:
name: Build sdist
runs-on: ubuntu-latest
steps:
- name: Checkout numpy-release
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- name: Checkout numpy
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: numpy/numpy
path: numpy-src
submodules: true
persist-credentials: false
- name: Build sdist
run: |
python -m pip install -U pip build
python -m build --sdist -Csetup-args=-Dallow-noblas=true
- name: Test the sdist
run: |
python -m pip install dist/*.gz -Csetup-args=-Dallow-noblas=true
pip install -r requirements/test_requirements.txt
cd .. # Can't import numpy within numpy src directory
python -c "import numpy, sys; print(numpy.__version__); sys.exit(numpy.test() is False)"
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: sdist
path: ./dist/*
testpypi-publish:
name: Upload release to TestPyPI
if: # TODO - add a release True/False? and on `main`?
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/numpy
permissions:
id-token: write
steps:
# TODO: retrieve your distributions here
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
with:
print-hash: true
pypi-publish:
name: Upload release to PyPI
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/numpy
permissions:
id-token: write
steps:
# TODO: retrieve your distributions here
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
with:
print-hash: true