|
| 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 doc |
| 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.12-dev' |
| 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 | + - name: Run test suite |
| 204 | + run: | |
| 205 | + cd doc |
| 206 | + pytest --pyargs numpy -m "not slow" |
| 207 | +
|
0 commit comments