Add ninja-build to benchmarks job #14
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 like relaxed-strides. | |
on: | |
push: | |
branches: | |
# coverage comparison in the "full" step needs to run on main after merges | |
- ci-fix-linux | |
pull_request: | |
branches: | |
- main | |
- maintenance/** | |
defaults: | |
run: | |
shell: bash | |
env: | |
DOWNLOAD_OPENBLAS: 1 | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
permissions: | |
contents: read # to fetch code (actions/checkout) | |
jobs: | |
lint: | |
if: github.repository == 'numpy/numpy' && github.event_name != 'push' | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
steps: | |
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 | |
with: | |
submodules: recursive | |
fetch-depth: 0 | |
- uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 | |
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: | |
if: "github.repository == 'numpy/numpy'" | |
runs-on: ubuntu-latest | |
env: | |
MESON_ARGS: "-Dallow-noblas=true -Dcpu-baseline=none -Dcpu-dispatch=none" | |
steps: | |
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 | |
with: | |
submodules: recursive | |
fetch-depth: 0 | |
- uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 | |
with: | |
python-version: '3.9' | |
- uses: ./.github/meson_actions | |
basic: | |
needs: [smoke_test] | |
runs-on: ubuntu-latest | |
if: github.event_name != 'push' | |
strategy: | |
matrix: | |
python-version: ["3.9", "pypy3.9-v7.3.12"] | |
env: | |
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" | |
steps: | |
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 | |
with: | |
submodules: recursive | |
fetch-depth: 0 | |
- uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- uses: ./.github/actions | |
debug: | |
needs: [smoke_test] | |
runs-on: ubuntu-latest | |
if: github.event_name != 'push' | |
steps: | |
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 | |
with: | |
submodules: recursive | |
fetch-depth: 0 | |
- name: Install debug Python | |
run: | | |
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@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 | |
with: | |
submodules: recursive | |
fetch-depth: 0 | |
- uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 | |
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 OpenBLAS (MacPython build) | |
run: | | |
set -xe | |
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 | |
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@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 | |
with: | |
submodules: recursive | |
fetch-depth: 0 | |
- uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 | |
with: | |
python-version: '3.9' | |
- name: Install dependencies | |
run: | | |
sudo apt-get install libopenblas-dev ninja-build | |
pip install spin cython asv | |
- name: Install NumPy | |
run: | | |
spin build | |
- name: Run benchmarks | |
run: | | |
spin bench | |
if grep -q Traceback asv-output.log; then | |
echo "Some benchmarks have errors!" | |
exit 1 | |
fi | |
relaxed_strides_debug: | |
needs: [smoke_test] | |
runs-on: ubuntu-latest | |
if: github.event_name != 'push' | |
env: | |
CHECK_BLAS: 1 | |
NPY_USE_BLAS_ILP64: 1 | |
NPY_RELAXED_STRIDES_DEBUG: 1 | |
steps: | |
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 | |
with: | |
submodules: recursive | |
fetch-depth: 0 | |
- uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 | |
with: | |
python-version: '3.11' | |
- uses: ./.github/actions | |
sdist: | |
needs: [smoke_test] | |
runs-on: ubuntu-latest | |
if: github.event_name != 'push' | |
steps: | |
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 | |
with: | |
submodules: recursive | |
fetch-depth: 0 | |
- uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 | |
with: | |
python-version: '3.11' | |
- name: Install gfortran and OpenBLAS (MacPython build) | |
run: | | |
set -xe | |
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@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 | |
with: | |
submodules: recursive | |
fetch-depth: 0 | |
- uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 | |
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'" |