1- # Workflow to build and test wheels.
2- # To work on the wheel building infrastructure on a fork, comment out:
3- #
4- # if: github.repository == 'numpy/numpy'
5- #
6- # in the get_commit_message job. Be sure to include [wheel build] in your commit
7- # message to trigger the build. All files related to wheel building are located
8- # at tools/wheels/
9- # Alternatively, you can add labels to the pull request in order to trigger wheel
10- # builds.
11- # The labels that trigger builds are:
12- # 36 - Build(for changes to the building process,
13- # 14 - Release(ensure wheels build before release)
14- name : Wheel builder
1+ name : Publish sdist and wheels
152
163on :
174 schedule :
@@ -39,39 +26,8 @@ permissions:
3926 contents : read # to fetch code (actions/checkout)
4027
4128jobs :
42- get_commit_message :
43- name : Get commit message
44- runs-on : ubuntu-latest
45- # Only workflow_dispatch is enabled on forks.
46- # To enable this job and subsequent jobs on a fork for other events, comment out:
47- if : github.repository == 'numpy/numpy' || github.event_name == 'workflow_dispatch'
48- outputs :
49- message : ${{ steps.commit_message.outputs.message }}
50- steps :
51- - name : Checkout numpy
52- uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
53- # Gets the correct commit message for pull request
54- with :
55- ref : ${{ github.event.pull_request.head.sha }}
56- persist-credentials : false
57- - name : Get commit message
58- id : commit_message
59- env :
60- HEAD : ${{ github.ref }}
61- run : |
62- set -xe
63- COMMIT_MSG=$(git log --no-merges -1 --oneline)
64- echo "message=$COMMIT_MSG" >> $GITHUB_OUTPUT
65- echo github.ref "$HEAD"
66-
6729 build_wheels :
6830 name : Build wheel ${{ matrix.python }}-${{ matrix.buildplat[1] }}-${{ matrix.buildplat[2] }}
69- needs : get_commit_message
70- if : >-
71- contains(needs.get_commit_message.outputs.message, '[wheel build]') ||
72- github.event_name == 'schedule' ||
73- github.event_name == 'workflow_dispatch' ||
74- (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && ( ! endsWith(github.ref, 'dev0')))
7531 runs-on : ${{ matrix.buildplat[0] }}
7632 strategy :
7733 # Ensure that a wheel builder finishes even if another fails
11268
11369 env :
11470 IS_32_BIT : ${{ matrix.buildplat[1] == 'win32' }}
115- IS_PUSH : ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }}
116- IS_SCHEDULE_DISPATCH : ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
11771 steps :
11872 - name : Checkout numpy
11973 uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
13286 uses : ./.github/windows_arm64_steps
13387
13488 - name : pkg-config-for-win
89+ if : runner.os == 'windows'
13590 run : |
13691 choco install -y --no-progress --stoponfirstfailure --checksum 6004DF17818F5A6DBF19CB335CC92702 pkgconfiglite
13792 $CIBW = "${{ github.workspace }}/.openblas"
@@ -141,12 +96,6 @@ jobs:
14196 # passed through, so convert it to '/'
14297 $CIBW = $CIBW.replace("\","/")
14398 echo "CIBW_ENVIRONMENT_WINDOWS=PKG_CONFIG_PATH=$CIBW" >> $env:GITHUB_ENV
144- if : runner.os == 'windows'
145-
146- # Used to push the built wheels
147- - uses : actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
148- with :
149- python-version : " 3.x"
15099
151100 - name : Setup macOS
152101 if : matrix.buildplat[0] == 'macos-13' || matrix.buildplat[0] == 'macos-14'
@@ -184,125 +133,29 @@ jobs:
184133 name : ${{ matrix.python }}-${{ matrix.buildplat[1] }}-${{ matrix.buildplat[2] }}
185134 path : ./wheelhouse/*.whl
186135
187- - name : install micromamba
188- uses : mamba-org/setup-micromamba@b09ef9b599704322748535812ca03efb2625677b
189- if : ${{ matrix.buildplat[1] != 'win_arm64' }} # unsupported platform at the moment
190- with :
191- # for installation of anaconda-client, required for upload to
192- # anaconda.org
193- # Note that this step is *after* specific pythons have been used to
194- # build and test the wheel
195- # for installation of anaconda-client, for upload to anaconda.org
196- # environment will be activated after creation, and in future bash steps
197- init-shell : bash
198- environment-name : upload-env
199- create-args : >-
200- anaconda-client
201-
202- - name : win-arm64 install anaconda client
203- if : ${{ matrix.buildplat[1] == 'win_arm64' }}
204- run : |
205- # Rust installation needed for rpds-py.
206- Invoke-WebRequest https://static.rust-lang.org/rustup/dist/aarch64-pc-windows-msvc/rustup-init.exe -UseBasicParsing -Outfile rustup-init.exe
207- .\rustup-init.exe -y
208- $env:PATH="$env:PATH;$env:USERPROFILE\.cargo\bin"
209- pip install anaconda-client
210-
211-
212- - name : Upload wheels
213- if : success() && github.repository == 'numpy/numpy'
214- shell : bash -el {0}
215- # see https://github.com/marketplace/actions/setup-miniconda for why
216- # `-el {0}` is required.
217- env :
218- NUMPY_STAGING_UPLOAD_TOKEN : ${{ secrets.NUMPY_STAGING_UPLOAD_TOKEN }}
219- NUMPY_NIGHTLY_UPLOAD_TOKEN : ${{ secrets.NUMPY_NIGHTLY_UPLOAD_TOKEN }}
220- run : |
221- source tools/wheels/upload_wheels.sh
222- set_upload_vars
223- # trigger an upload to
224- # https://anaconda.org/scientific-python-nightly-wheels/numpy
225- # for cron jobs or "Run workflow" (restricted to main branch).
226- # Tags will upload to
227- # https://anaconda.org/multibuild-wheels-staging/numpy
228- # The tokens were originally generated at anaconda.org
229- upload_wheels
230-
231136 build_sdist :
232137 name : Build sdist
233- needs : get_commit_message
234- if : >-
235- contains(needs.get_commit_message.outputs.message, '[wheel build]') ||
236- github.event_name == 'schedule' ||
237- github.event_name == 'workflow_dispatch' ||
238- (github.event_name == 'pull_request' &&
239- (contains(github.event.pull_request.labels.*.name, '36 - Build') ||
240- contains(github.event.pull_request.labels.*.name, '14 - Release'))) ||
241- (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && ( ! endsWith(github.ref, 'dev0')))
242138 runs-on : ubuntu-latest
243- env :
244- IS_PUSH : ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }}
245- # commented out so the sdist doesn't upload to nightly
246- # IS_SCHEDULE_DISPATCH: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
247139 steps :
248140 - name : Checkout numpy
249141 uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
250142 with :
251143 submodules : true
252144 persist-credentials : false
253- # Used to push the built wheels
254- - uses : actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
255- with :
256- # Build sdist on lowest supported Python
257- python-version : " 3.11"
145+
258146 - name : Build sdist
259147 run : |
260148 python -m pip install -U pip build
261149 python -m build --sdist -Csetup-args=-Dallow-noblas=true
150+
262151 - name : Test the sdist
263152 run : |
264- # TODO: Don't run test suite, and instead build wheels from sdist
265- # Depends on pypa/cibuildwheel#1020
266153 python -m pip install dist/*.gz -Csetup-args=-Dallow-noblas=true
267154 pip install -r requirements/test_requirements.txt
268155 cd .. # Can't import numpy within numpy src directory
269156 python -c "import numpy, sys; print(numpy.__version__); sys.exit(numpy.test() is False)"
270157
271- - name : Check README rendering for PyPI
272- run : |
273- python -mpip install twine
274- twine check dist/*
275-
276158 - uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
277159 with :
278160 name : sdist
279161 path : ./dist/*
280-
281- - uses : conda-incubator/setup-miniconda@835234971496cad1653abb28a638a281cf32541f # v3.2.0
282- with :
283- # for installation of anaconda-client, required for upload to
284- # anaconda.org
285- # default (and activated) environment name is test
286- # Note that this step is *after* specific pythons have been used to
287- # build and test
288- auto-update-conda : true
289- python-version : " 3.11"
290-
291- - name : Upload sdist
292- if : success() && github.repository == 'numpy/numpy'
293- shell : bash -el {0}
294- env :
295- NUMPY_STAGING_UPLOAD_TOKEN : ${{ secrets.NUMPY_STAGING_UPLOAD_TOKEN }}
296- # commented out so the sdist doesn't upload to nightly
297- # NUMPY_NIGHTLY_UPLOAD_TOKEN: ${{ secrets.NUMPY_NIGHTLY_UPLOAD_TOKEN }}
298- run : |
299- conda install -y anaconda-client
300- source tools/wheels/upload_wheels.sh
301- set_upload_vars
302- # trigger an upload to
303- # https://anaconda.org/scientific-python-nightly-wheels/numpy
304- # for cron jobs or "Run workflow" (restricted to main branch).
305- # Tags will upload to
306- # https://anaconda.org/multibuild-wheels-staging/numpy
307- # The tokens were originally generated at anaconda.org
308- upload_wheels
0 commit comments