Skip to content

Commit 287f353

Browse files
committed
CI: add job that builds for non-default Python interpreter on Ubuntu
This guards against issues with trying to use the `python3` interpreter for anything that actually requires the Python interpreter we are building for. In such a build config with multiple interpreters, we need to be careful not to pick up the wrong one when invoking `custom_target` or `run_command` in meson.build files.
1 parent c100886 commit 287f353

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

.github/workflows/linux.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,3 +387,48 @@ jobs:
387387
python -m pip install numpy==1.23.5 cython pybind11 pytest pytest-timeout pytest-xdist pytest-env 'Pillow<10.0.0' mpmath pythran pooch meson hypothesis && \
388388
LD_LIBRARY_PATH=/usr/local/lib python dev.py build && \
389389
LD_LIBRARY_PATH=/usr/local/lib python dev.py test"
390+
391+
#################################################################################
392+
distro_multiple_pythons:
393+
# Purpose is to build for a non-default Python interpreter in a Linux distro
394+
# For such a build config, `python`/`python3` executables may not have
395+
# build dependencies like Cython or NumPy installed.
396+
name: non-default Python interpreter, fast, py3.10/npMin, pip+pytest
397+
needs: get_commit_message
398+
if: >
399+
needs.get_commit_message.outputs.message == 1
400+
&& (github.repository == 'scipy/scipy' || github.repository == '')
401+
runs-on: ubuntu-22.04
402+
steps:
403+
- uses: actions/[email protected]
404+
with:
405+
submodules: recursive
406+
407+
- name: Setup system dependencies
408+
run: |
409+
sudo apt-get -y update
410+
# `python3-dev` yields Python 3.10 on Ubuntu 22.04
411+
sudo apt install -y python3-dev python3.11-dev ninja-build pkg-config libatlas-base-dev liblapack-dev
412+
413+
- name: Setup Python build deps
414+
run: |
415+
python3.11 -m pip install build pythran pybind11 cython numpy meson-python
416+
417+
- name: Build wheel and install
418+
run: |
419+
python3.11 -m build -wnx -Csetup-args=-Dblas=blas-atlas -Csetup-args=-Dlapack=lapack-atlas -Ccompile-args=-j2
420+
python3.11 -m pip install dist/*.whl
421+
422+
- name: Install test dependencies
423+
run: |
424+
python3.11 -m pip install pytest hypothesis
425+
python3.10 -m pip install meson # ensure compile test work with this
426+
427+
- name: Run tests
428+
run: |
429+
# Just a small subset of tests; this will be fine if the build
430+
# succeeds (that's the real purpose of this job)
431+
pushd $RUNNER_TEMP
432+
python3.11 -m pytest --pyargs scipy.cluster
433+
python3.11 -m pytest --pyargs scipy.linalg
434+
popd

0 commit comments

Comments
 (0)