Skip to content

Commit 6bb799b

Browse files
rgommerscharris
authored andcommitted
MAINT: Split up .github/workflows to match main
This is a backport of numpy#24493 and numpy#24291. The purpose of this is to ease future backports that expect these files. - CI: move some jobs in `build_test.yml` to Meson - CI: split `build_test.yml` into three GHA jobs files Also documents better what is being run. See numpygh-24410 for the overall restructuring plan for GitHub Actions CI. - CI: merge `linux_meson.yml` into `linux_blas.yml` - TST: disable mypy tests in test suite unless an environment variable is set These tests are super slow, and they're effectively always passing in CI. Running them on all "full" test suite runs is too expensive. Note that SciPy has an XSLOW mark, NumPy does not. So use an env var for now. - CI: add new GHA CI jobs to run MyPy across OS/Python flavors
1 parent 1989099 commit 6bb799b

File tree

7 files changed

+622
-419
lines changed

7 files changed

+622
-419
lines changed

.github/actions/action.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ runs:
1111
echo DOWNLOAD_OPENBLAS $DOWNLOAD_OPENBLAS
1212
echo USE_DEBUG $USE_DEBUG
1313
echo NPY_USE_BLAS_ILP64 $NPY_USE_BLAS_ILP64
14-
echo NUMPY_EXPERIMENTAL_ARRAY_FUNCTION $NUMPY_EXPERIMENTAL_ARRAY_FUNCTION
1514
echo USE_ASV $USE_ASV
1615
echo PATH $PATH
1716
echo python `which python`

.github/workflows/linux.yml

Lines changed: 208 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,208 @@
1+
name: Linux tests
2+
3+
# This file is meant for testing across supported Python versions, build types
4+
# and interpreters (PyPy, python-dbg, a pre-release Python in summer time),
5+
# build-via-sdist, run benchmarks, measure code coverage, and other build
6+
# options like relaxed-strides.
7+
8+
on:
9+
push:
10+
branches:
11+
# coverage comparison in the "full" step needs to run on main after merges
12+
- main
13+
pull_request:
14+
branches:
15+
- main
16+
- maintenance/**
17+
18+
defaults:
19+
run:
20+
shell: bash
21+
22+
env:
23+
DOWNLOAD_OPENBLAS: 1
24+
25+
concurrency:
26+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
27+
cancel-in-progress: true
28+
29+
permissions:
30+
contents: read # to fetch code (actions/checkout)
31+
32+
jobs:
33+
lint:
34+
if: github.repository == 'numpy/numpy' && github.event_name != 'push'
35+
runs-on: ubuntu-latest
36+
continue-on-error: true
37+
steps:
38+
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
39+
with:
40+
submodules: recursive
41+
fetch-depth: 0
42+
- uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0
43+
with:
44+
python-version: '3.9'
45+
- name: Install linter requirements
46+
run:
47+
python -m pip install -r linter_requirements.txt
48+
- name: Run linter on PR diff
49+
run:
50+
python tools/linter.py --branch origin/${{ github.base_ref }}
51+
52+
smoke_test:
53+
if: "github.repository == 'numpy/numpy'"
54+
runs-on: ubuntu-latest
55+
env:
56+
MESON_ARGS: "-Dallow-noblas=true -Dcpu-baseline=none -Dcpu-dispatch=none"
57+
steps:
58+
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
59+
with:
60+
submodules: recursive
61+
fetch-depth: 0
62+
- uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0
63+
with:
64+
python-version: '3.9'
65+
- uses: ./.github/meson_actions
66+
67+
basic:
68+
needs: [smoke_test]
69+
runs-on: ubuntu-latest
70+
if: github.event_name != 'push'
71+
strategy:
72+
matrix:
73+
python-version: ["3.9", "pypy3.9-v7.3.12"]
74+
env:
75+
EXPECT_CPU_FEATURES: "SSE SSE2 SSE3 SSSE3 SSE41 POPCNT SSE42 AVX F16C FMA3 AVX2 AVX512F AVX512CD AVX512_KNL AVX512_KNM AVX512_SKX AVX512_CLX AVX512_CNL AVX512_ICL"
76+
steps:
77+
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
78+
with:
79+
submodules: recursive
80+
fetch-depth: 0
81+
- uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0
82+
with:
83+
python-version: ${{ matrix.python-version }}
84+
- uses: ./.github/actions
85+
86+
debug:
87+
needs: [smoke_test]
88+
runs-on: ubuntu-latest
89+
if: github.event_name != 'push'
90+
env:
91+
USE_DEBUG: 1
92+
steps:
93+
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
94+
with:
95+
submodules: recursive
96+
fetch-depth: 0
97+
- uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0
98+
with:
99+
python-version: '3.11'
100+
101+
- uses: ./.github/actions
102+
103+
full:
104+
# Build a wheel, install it, then run the full test suite with code coverage
105+
needs: [smoke_test]
106+
runs-on: ubuntu-22.04
107+
steps:
108+
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
109+
with:
110+
submodules: recursive
111+
fetch-depth: 0
112+
- uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0
113+
with:
114+
python-version: '3.9'
115+
- name: Install build and test dependencies from PyPI
116+
run: |
117+
pip install -r build_requirements.txt
118+
pip install -r test_requirements.txt
119+
- name: Install gfortran and OpenBLAS (MacPython build)
120+
run: |
121+
set -xe
122+
sudo apt install gfortran libgfortran5
123+
target=$(python tools/openblas_support.py)
124+
sudo cp -r $target/lib/* /usr/lib
125+
sudo cp $target/include/* /usr/include
126+
- name: Build a wheel
127+
run: |
128+
python -m build --wheel --no-isolation --skip-dependency-check
129+
pip install dist/numpy*.whl
130+
- name: Run full test suite
131+
run: |
132+
cd tools
133+
pytest --pyargs numpy --cov-report=html:build/coverage
134+
# TODO: gcov
135+
136+
benchmark:
137+
needs: [smoke_test]
138+
runs-on: ubuntu-latest
139+
if: github.event_name != 'push'
140+
env:
141+
PYTHONOPTIMIZE: 2
142+
BLAS: None
143+
LAPACK: None
144+
ATLAS: None
145+
NPY_BLAS_ORDER: mkl,blis,openblas,atlas,blas
146+
NPY_LAPACK_ORDER: MKL,OPENBLAS,ATLAS,LAPACK
147+
USE_ASV: 1
148+
steps:
149+
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
150+
with:
151+
submodules: recursive
152+
fetch-depth: 0
153+
- uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0
154+
with:
155+
python-version: '3.9'
156+
- uses: ./.github/actions
157+
158+
relaxed_strides_debug:
159+
needs: [smoke_test]
160+
runs-on: ubuntu-latest
161+
if: github.event_name != 'push'
162+
env:
163+
CHECK_BLAS: 1
164+
NPY_USE_BLAS_ILP64: 1
165+
NPY_RELAXED_STRIDES_DEBUG: 1
166+
steps:
167+
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
168+
with:
169+
submodules: recursive
170+
fetch-depth: 0
171+
- uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0
172+
with:
173+
python-version: '3.11'
174+
- uses: ./.github/actions
175+
176+
sdist:
177+
needs: [smoke_test]
178+
runs-on: ubuntu-latest
179+
if: github.event_name != 'push'
180+
steps:
181+
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
182+
with:
183+
submodules: recursive
184+
fetch-depth: 0
185+
- uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0
186+
with:
187+
python-version: '3.11'
188+
- name: Install gfortran and OpenBLAS (MacPython build)
189+
run: |
190+
set -xe
191+
sudo apt install gfortran libgfortran5
192+
target=$(python tools/openblas_support.py)
193+
sudo cp -r $target/lib/* /usr/lib
194+
sudo cp $target/include/* /usr/include
195+
- name: Build a wheel via an sdist
196+
run: |
197+
pip install build
198+
python -m build
199+
pip install dist/numpy*.whl
200+
- name: Install test dependencies
201+
run: |
202+
pip install -r test_requirements.txt
203+
pip install ninja
204+
- name: Run test suite
205+
run: |
206+
cd tools
207+
pytest --pyargs numpy -m "not slow"
208+

.github/workflows/linux_blas.yml

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
name: BLAS tests (Linux)
2+
3+
# This file is meant for testing different BLAS/LAPACK flavors and build
4+
# options on Linux. All other yml files for Linux will only test without BLAS
5+
# (mostly because that's easier and faster to build) or with the same 64-bit
6+
# OpenBLAS build that is used in the wheel jobs.
7+
#
8+
# Jobs and their purpose:
9+
#
10+
# - openblas64_setuppy:
11+
# This job uses the default 64-bit build of OpenBLAS with the
12+
# `numpy.distutils`-based build. It can be removed once we remove
13+
# support for those builds.
14+
# - openblas32_stable_nightly:
15+
# Uses the 32-bit OpenBLAS builds, both the latest stable release and a
16+
# nightly build.
17+
#
18+
# TODO: coverage here is limited, we should add non-OpenBLAS libraries and
19+
# exercise the BLAS-related build options (see `meson_options.txt`).
20+
21+
on:
22+
pull_request:
23+
branches:
24+
- main
25+
- maintenance/**
26+
27+
defaults:
28+
run:
29+
shell: bash
30+
31+
concurrency:
32+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
33+
cancel-in-progress: true
34+
35+
permissions:
36+
contents: read # to fetch code (actions/checkout)
37+
38+
jobs:
39+
openblas64_setuppy:
40+
runs-on: ubuntu-latest
41+
if: "github.repository == 'numpy/numpy'"
42+
env:
43+
DOWNLOAD_OPENBLAS: 1
44+
NPY_USE_BLAS_ILP64: 1
45+
steps:
46+
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
47+
with:
48+
submodules: recursive
49+
fetch-depth: 0
50+
- uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0
51+
with:
52+
python-version: '3.11'
53+
- uses: ./.github/actions
54+
55+
openblas32_stable_nightly:
56+
if: "github.repository == 'numpy/numpy'"
57+
runs-on: ubuntu-latest
58+
strategy:
59+
matrix:
60+
USE_NIGHTLY_OPENBLAS: [false, true]
61+
env:
62+
USE_NIGHTLY_OPENBLAS: ${{ matrix.USE_NIGHTLY_OPENBLAS }}
63+
name: "Test Linux (${{ matrix.USE_NIGHTLY_OPENBLAS && 'nightly' || 'stable' }} OpenBLAS)"
64+
steps:
65+
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
66+
with:
67+
submodules: recursive
68+
fetch-depth: 0
69+
- uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0
70+
with:
71+
python-version: '3.11'
72+
73+
- name: Install dependencies
74+
run: |
75+
pip install -r build_requirements.txt
76+
# Install OpenBLAS
77+
set -xe
78+
if [[ $USE_NIGHTLY_OPENBLAS == "true" ]]; then
79+
target=$(python tools/openblas_support.py --nightly)
80+
else
81+
target=$(python tools/openblas_support.py)
82+
fi
83+
sudo cp -r $target/lib/* /usr/lib
84+
sudo cp $target/include/* /usr/include
85+
86+
- name: Build
87+
shell: 'script -q -e -c "bash --noprofile --norc -eo pipefail {0}"'
88+
env:
89+
TERM: xterm-256color
90+
run:
91+
spin build -- --werror
92+
93+
- name: Check build-internal dependencies
94+
run:
95+
ninja -C build -t missingdeps
96+
97+
- name: Check installed test and stub files
98+
run:
99+
python tools/check_installed_files.py $(find ./build-install -path '*/site-packages/numpy')
100+
101+
- name: Test
102+
shell: 'script -q -e -c "bash --noprofile --norc -eo pipefail {0}"'
103+
env:
104+
TERM: xterm-256color
105+
LD_LIBRARY_PATH: "/usr/local/lib/" # to find libopenblas.so.0
106+
107+
run: |
108+
pip install pytest pytest-xdist hypothesis typing_extensions
109+
spin test -j auto

0 commit comments

Comments
 (0)