forked from numpy/numpy
-
Notifications
You must be signed in to change notification settings - Fork 5
240 lines (227 loc) · 7.73 KB
/
linux.yml
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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
name: Linux tests
# This file is meant for testing across supported Python versions, build types
# and interpreters (PyPy, python-dbg, a pre-release Python in summer time),
# build-via-sdist, run benchmarks, measure code coverage, and other build
# options.
on:
push:
branches:
# coverage comparison in the "full" step needs to run on main after merges
- main
- fix-strtold_l-check
pull_request:
branches:
- main
- maintenance/**
defaults:
run:
shell: bash
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
contents: read # to fetch code (actions/checkout)
jobs:
lint:
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
submodules: recursive
fetch-depth: 0
- uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1
with:
python-version: '3.9'
- name: Install linter requirements
run:
python -m pip install -r linter_requirements.txt
- name: Run linter on PR diff
run:
python tools/linter.py --branch origin/${{ github.base_ref }}
smoke_test:
runs-on: ubuntu-latest
env:
MESON_ARGS: "-Dallow-noblas=true -Dcpu-baseline=none -Dcpu-dispatch=none"
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
submodules: recursive
fetch-depth: 0
- uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1
with:
python-version: '3.9'
- uses: ./.github/meson_actions
pypy:
needs: [smoke_test]
runs-on: ubuntu-latest
if: github.event_name != 'push'
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
submodules: recursive
fetch-depth: 0
- uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1
with:
python-version: 'pypy3.9-v7.3.12'
- name: Setup using scipy-openblas
run: |
python -m pip install scipy-openblas32 spin
spin config-openblas --with-scipy-openblas=32
- uses: ./.github/meson_actions
debug:
needs: [smoke_test]
runs-on: ubuntu-latest
if: github.event_name != 'push'
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
submodules: recursive
fetch-depth: 0
- name: Install debug Python
run: |
sudo apt-get update
sudo apt-get install python3-dbg ninja-build
- name: Build NumPy and install into venv
run: |
python3-dbg -m venv venv
source venv/bin/activate
pip install -U pip
pip install . -v -Csetup-args=-Dbuildtype=debug -Csetup-args=-Dallow-noblas=true
- name: Install test dependencies
run: |
source venv/bin/activate
pip install -r test_requirements.txt
- name: Run test suite
run: |
source venv/bin/activate
cd tools
pytest --pyargs numpy -m "not slow"
full:
# Build a wheel, install it, then run the full test suite with code coverage
needs: [smoke_test]
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
submodules: recursive
fetch-depth: 0
- uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1
with:
python-version: '3.9'
- name: Install build and test dependencies from PyPI
run: |
pip install -r build_requirements.txt
pip install -r test_requirements.txt
- name: Install gfortran and setup OpenBLAS (MacPython build)
run: |
set -xe
sudo apt update
sudo apt install gfortran libgfortran5
pip install scipy-openblas32
spin config-openblas --with-scipy-openblas=32
- name: Build a wheel
env:
PKG_CONFIG_PATH: ${{ github.workspace }}/.openblas
run: |
python -m build --wheel --no-isolation --skip-dependency-check
pip install dist/numpy*.whl
- name: Run full test suite
run: |
cd tools
pytest --pyargs numpy --cov-report=html:build/coverage
# TODO: gcov
benchmark:
needs: [smoke_test]
runs-on: ubuntu-latest
if: github.event_name != 'push'
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
submodules: recursive
fetch-depth: 0
- uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1
with:
python-version: '3.9'
- name: Install build and benchmarking dependencies
run: |
sudo apt-get update
sudo apt-get install libopenblas-dev ninja-build
pip install spin cython asv virtualenv packaging
- name: Install NumPy
run: |
spin build -- -Dcpu-dispatch=none
# Ensure to keep the below steps as single-line bash commands (it's a
# workaround for asv#1333, and it may have side-effects on multi-line commands)
- name: Appease asv's need for machine info
shell: 'script -q -e -c "bash --noprofile --norc -eo pipefail {0}"'
run: |
asv machine --yes --config benchmarks/asv.conf.json
- name: Run benchmarks
shell: 'script -q -e -c "bash --noprofile --norc -eo pipefail {0}"'
run: |
spin bench --quick
sdist:
needs: [smoke_test]
runs-on: ubuntu-latest
if: github.event_name != 'push'
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
submodules: recursive
fetch-depth: 0
- uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1
with:
python-version: '3.11'
- name: Install gfortran and setup OpenBLAS (MacPython build)
run: |
set -xe
sudo apt update
sudo apt install gfortran libgfortran5
target=$(python tools/openblas_support.py)
sudo cp -r $target/lib/* /usr/lib
sudo cp $target/include/* /usr/include
- name: Build a wheel via an sdist
run: |
pip install build
python -m build
pip install dist/numpy*.whl
- name: Install test dependencies
run: |
pip install -r test_requirements.txt
pip install ninja
- name: Run test suite
run: |
cd tools
pytest --pyargs numpy -m "not slow"
custom_checks:
needs: [smoke_test]
runs-on: ubuntu-latest
if: github.event_name != 'push'
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
submodules: recursive
fetch-depth: 0
- uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1
with:
python-version: '3.11'
- name: Install build and test dependencies from PyPI
run: |
pip install -r build_requirements.txt
pip install -r test_requirements.txt
pip install vulture
- name: Build and install NumPy
run: |
# Install using the fastests way to build (no BLAS, no SIMD)
spin build -j2 -- -Dallow-noblas=true -Dcpu-baseline=none -Dcpu-dispatch=none
- name: Check build-internal dependencies
run: |
ninja -C build -t missingdeps
- name: Check installed test and stub files
run: |
python tools/check_installed_files.py $(find ./build-install -path '*/site-packages/numpy')
- name: Check for unreachable code paths in Python modules
run: |
# Need the explicit `bash -c` here because `grep` returns exit code 1 for no matches
bash -c "! vulture . --min-confidence 100 --exclude doc/,numpy/distutils/,vendored-meson/ | grep 'unreachable'"