summaryrefslogtreecommitdiff
path: root/.github/workflows
diff options
context:
space:
mode:
authorStefan van der Walt <stefanv@berkeley.edu>2022-11-21 11:09:07 -0800
committerStefan van der Walt <stefanv@berkeley.edu>2022-11-21 11:09:07 -0800
commit74cf6b856dd0d5e78f472cde9b4f54c82e3f0133 (patch)
tree7ce709ed03855ecacc113ccfe970cce0594aad0f /.github/workflows
parent211e40c87b8e97cb3102223e6733b9bd6d2eeee3 (diff)
parent5d32b8d63ab9a376c095f142b86bb55cdfbb95ff (diff)
downloadnumpy-74cf6b856dd0d5e78f472cde9b4f54c82e3f0133.tar.gz
Merge remote-tracking branch 'origin/main' into meson
Diffstat (limited to '.github/workflows')
-rw-r--r--.github/workflows/build_test.yml408
-rw-r--r--.github/workflows/circleci.yml24
-rw-r--r--.github/workflows/emscripten.yml75
-rw-r--r--.github/workflows/wheels.yml212
4 files changed, 719 insertions, 0 deletions
diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml
new file mode 100644
index 000000000..515a92fee
--- /dev/null
+++ b/.github/workflows/build_test.yml
@@ -0,0 +1,408 @@
+name: Build_Test
+
+on:
+ push:
+ branches:
+ - main
+ - maintenance/**
+ pull_request:
+ branches:
+ - main
+ - maintenance/**
+
+defaults:
+ run:
+ shell: bash
+
+env:
+ DOWNLOAD_OPENBLAS: 1
+ PYTHON_VERSION: 3.8
+
+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.ref != 'refs/heads/main' && !contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[skip github]')"
+ runs-on: ubuntu-latest
+ continue-on-error: true
+ steps:
+ - uses: actions/checkout@v3
+ with:
+ submodules: recursive
+ fetch-depth: 0
+ - uses: actions/setup-python@v4
+ with:
+ python-version: ${{ env.PYTHON_VERSION }}
+ - 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' && !contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[skip github]')"
+ runs-on: ubuntu-latest
+ env:
+ WITHOUT_SIMD: 1
+ steps:
+ - uses: actions/checkout@v3
+ with:
+ submodules: recursive
+ fetch-depth: 0
+ - uses: actions/setup-python@v4
+ with:
+ python-version: ${{ env.PYTHON_VERSION }}
+ - uses: ./.github/actions
+
+ basic:
+ needs: [smoke_test]
+ runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ python-version: ["3.9", "3.10", "3.11-dev"]
+ 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@v3
+ with:
+ submodules: recursive
+ fetch-depth: 0
+ - uses: actions/setup-python@v4
+ with:
+ python-version: ${{ matrix.python-version }}
+ - uses: ./.github/actions
+
+ old_gcc:
+ needs: [smoke_test]
+ # provides GCC 7, 8
+ runs-on: ubuntu-20.04
+ steps:
+ - uses: actions/checkout@v3
+ with:
+ submodules: recursive
+ fetch-depth: 0
+ # comes with python3.6
+ - name: Install Python3.8
+ run: |
+ sudo apt update
+ # for add-apt-repository
+ sudo apt install software-properties-common -y
+ sudo add-apt-repository ppa:deadsnakes/ppa -y
+ sudo apt install python3.8-dev -y
+ sudo ln -s /usr/bin/python3.8 /usr/bin/pythonx
+ pythonx -m pip install --upgrade pip setuptools wheel
+ pythonx -m pip install -r test_requirements.txt
+ - name: Install Compilers
+ run: sudo apt install g++-7 g++-8 -y
+ - name: Build gcc-7
+ run: |
+ export CC=/usr/bin/gcc-7
+ export CXX=/usr/bin/g++-7
+ rm -rf build && pythonx setup.py install --user
+ - name: Runtests gcc-7
+ run: pythonx runtests.py -n
+ - name: Build gcc-8
+ run: |
+ export CC=/usr/bin/gcc-8
+ export CXX=/usr/bin/g++-8
+ rm -rf build && pythonx setup.py install --user
+ - name: Runtests gcc-8
+ run: pythonx runtests.py -n
+
+ without_optimizations:
+ needs: [smoke_test]
+ runs-on: ubuntu-latest
+ env:
+ WITHOUT_OPTIMIZATIONS: 1
+ steps:
+ - uses: actions/checkout@v3
+ with:
+ submodules: recursive
+ fetch-depth: 0
+ - uses: actions/setup-python@v4
+ with:
+ python-version: ${{ env.PYTHON_VERSION }}
+ - uses: ./.github/actions
+
+ without_avx512:
+ needs: [smoke_test]
+ runs-on: ubuntu-latest
+ env:
+ CPU_DISPATCH: "max -xop -fma4 -avx512f -avx512cd -avx512_knl -avx512_knm -avx512_skx -avx512_clx -avx512_cnl -avx512_icl"
+ steps:
+ - uses: actions/checkout@v3
+ with:
+ submodules: recursive
+ fetch-depth: 0
+ - uses: actions/setup-python@v4
+ with:
+ python-version: ${{ env.PYTHON_VERSION }}
+ - uses: ./.github/actions
+
+ without_avx512_avx2_fma3:
+ needs: [smoke_test]
+ runs-on: ubuntu-latest
+ env:
+ CPU_DISPATCH: "SSSE3 SSE41 POPCNT SSE42 AVX F16C"
+ steps:
+ - uses: actions/checkout@v3
+ with:
+ submodules: recursive
+ fetch-depth: 0
+ - uses: actions/setup-python@v4
+ with:
+ python-version: ${{ env.PYTHON_VERSION }}
+ - uses: ./.github/actions
+
+ debug:
+ needs: [smoke_test]
+ runs-on: ubuntu-20.04
+ env:
+ USE_DEBUG: 1
+ steps:
+ - uses: actions/checkout@v3
+ with:
+ submodules: recursive
+ fetch-depth: 0
+ - uses: actions/setup-python@v4
+ with:
+ python-version: ${{ env.PYTHON_VERSION }}
+ - uses: ./.github/actions
+
+ blas64:
+ needs: [smoke_test]
+ runs-on: ubuntu-latest
+ env:
+ NPY_USE_BLAS_ILP64: 1
+ steps:
+ - uses: actions/checkout@v3
+ with:
+ submodules: recursive
+ fetch-depth: 0
+ - uses: actions/setup-python@v4
+ with:
+ python-version: ${{ env.PYTHON_VERSION }}
+ - uses: ./.github/actions
+
+ full:
+ needs: [smoke_test]
+ runs-on: ubuntu-22.04
+ env:
+ USE_WHEEL: 1
+ RUN_FULL_TESTS: 1
+ RUN_COVERAGE: 1
+ INSTALL_PICKLE5: 1
+ steps:
+ - uses: actions/checkout@v3
+ with:
+ submodules: recursive
+ fetch-depth: 0
+ - uses: actions/setup-python@v4
+ with:
+ python-version: ${{ env.PYTHON_VERSION }}
+ - uses: ./.github/actions
+
+ benchmark:
+ needs: [smoke_test]
+ runs-on: ubuntu-latest
+ env:
+ PYTHONOPTIMIZE: 2
+ BLAS: None
+ LAPACK: None
+ ATLAS: None
+ NPY_BLAS_ORDER: mkl,blis,openblas,atlas,blas
+ NPY_LAPACK_ORDER: MKL,OPENBLAS,ATLAS,LAPACK
+ USE_ASV: 1
+ steps:
+ - uses: actions/checkout@v3
+ with:
+ submodules: recursive
+ fetch-depth: 0
+ - uses: actions/setup-python@v4
+ with:
+ python-version: ${{ env.PYTHON_VERSION }}
+ - uses: ./.github/actions
+
+ relaxed_strides_debug:
+ needs: [smoke_test]
+ runs-on: ubuntu-latest
+ env:
+ CHECK_BLAS: 1
+ NPY_USE_BLAS_ILP64: 1
+ NPY_RELAXED_STRIDES_DEBUG: 1
+ steps:
+ - uses: actions/checkout@v3
+ with:
+ submodules: recursive
+ fetch-depth: 0
+ - uses: actions/setup-python@v4
+ with:
+ python-version: ${{ env.PYTHON_VERSION }}
+ - uses: ./.github/actions
+
+ use_wheel:
+ needs: [smoke_test]
+ runs-on: ubuntu-latest
+ env:
+ USE_WHEEL: 1
+ steps:
+ - uses: actions/checkout@v3
+ with:
+ submodules: recursive
+ fetch-depth: 0
+ - uses: actions/setup-python@v4
+ with:
+ python-version: ${{ env.PYTHON_VERSION }}
+ - uses: ./.github/actions
+
+ no_array_func:
+ needs: [smoke_test]
+ runs-on: ubuntu-latest
+ env:
+ NUMPY_EXPERIMENTAL_ARRAY_FUNCTION: 0
+ steps:
+ - uses: actions/checkout@v3
+ with:
+ submodules: recursive
+ fetch-depth: 0
+ - uses: actions/setup-python@v4
+ with:
+ python-version: ${{ env.PYTHON_VERSION }}
+ - uses: ./.github/actions
+
+ no_openblas:
+ needs: [smoke_test]
+ runs-on: ubuntu-latest
+ env:
+ BLAS: None
+ LAPACK: None
+ ATLAS: None
+ DOWNLOAD_OPENBLAS: ''
+ steps:
+ - uses: actions/checkout@v3
+ with:
+ submodules: recursive
+ fetch-depth: 0
+ - uses: actions/setup-python@v4
+ with:
+ python-version: ${{ env.PYTHON_VERSION }}
+ - uses: ./.github/actions
+
+ pypy38:
+ needs: [smoke_test]
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v3
+ with:
+ submodules: recursive
+ fetch-depth: 0
+ - uses: actions/setup-python@v4
+ with:
+ python-version: pypy-3.8-v7.3.9
+ - uses: ./.github/actions
+
+ sdist:
+ needs: [smoke_test]
+ runs-on: ubuntu-latest
+ env:
+ USE_SDIST: 1
+ steps:
+ - uses: actions/checkout@v3
+ with:
+ submodules: recursive
+ fetch-depth: 0
+ - uses: actions/setup-python@v4
+ with:
+ python-version: ${{ env.PYTHON_VERSION }}
+ - uses: ./.github/actions
+
+ armv7_simd_test:
+ needs: [smoke_test]
+ # make sure this (20.04) matches the base docker image (focal) below
+ runs-on: ubuntu-20.04
+ steps:
+ - uses: actions/checkout@v3
+ with:
+ submodules: recursive
+ fetch-depth: 0
+ - name: Initialize binfmt_misc for qemu-user-static
+ run: |
+ docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
+ - name: Creates new container
+ run: |
+ # use x86_64 cross-compiler to speed up the build
+ sudo apt update
+ sudo apt install -y gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf
+
+ # Keep the `test_requirements.txt` dependency-subset synced
+ docker run --name the_container --interactive -v /:/host arm32v7/ubuntu:focal /bin/bash -c "
+ apt update &&
+ apt install -y git python3 python3-dev python3-pip &&
+ pip3 install cython==0.29.30 setuptools\<49.2.0 hypothesis==6.23.3 pytest==6.2.5 'typing_extensions>=4.2.0' &&
+ ln -s /host/lib64 /lib64 &&
+ ln -s /host/lib/x86_64-linux-gnu /lib/x86_64-linux-gnu &&
+ ln -s /host/usr/arm-linux-gnueabihf /usr/arm-linux-gnueabihf &&
+ rm -rf /usr/lib/gcc/arm-linux-gnueabihf && ln -s /host/usr/lib/gcc-cross/arm-linux-gnueabihf /usr/lib/gcc/arm-linux-gnueabihf &&
+ rm -f /usr/bin/arm-linux-gnueabihf-gcc && ln -s /host/usr/bin/arm-linux-gnueabihf-gcc /usr/bin/arm-linux-gnueabihf-gcc &&
+ rm -f /usr/bin/arm-linux-gnueabihf-g++ && ln -s /host/usr/bin/arm-linux-gnueabihf-g++ /usr/bin/arm-linux-gnueabihf-g++ &&
+ rm -f /usr/bin/arm-linux-gnueabihf-ar && ln -s /host/usr/bin/arm-linux-gnueabihf-ar /usr/bin/arm-linux-gnueabihf-ar &&
+ rm -f /usr/bin/arm-linux-gnueabihf-as && ln -s /host/usr/bin/arm-linux-gnueabihf-as /usr/bin/arm-linux-gnueabihf-as &&
+ rm -f /usr/bin/arm-linux-gnueabihf-ld && ln -s /host/usr/bin/arm-linux-gnueabihf-ld /usr/bin/arm-linux-gnueabihf-ld &&
+ rm -f /usr/bin/arm-linux-gnueabihf-ld.bfd && ln -s /host/usr/bin/arm-linux-gnueabihf-ld.bfd /usr/bin/arm-linux-gnueabihf-ld.bfd
+ "
+ docker commit the_container the_container
+ - name: Build
+ run: |
+ sudo docker run --name the_build --interactive -v $(pwd):/numpy -v /:/host the_container /bin/bash -c "
+ uname -a &&
+ gcc --version &&
+ g++ --version &&
+ python3 --version &&
+ git config --global --add safe.directory /numpy
+ cd /numpy &&
+ python3 setup.py install
+ "
+ docker commit the_build the_build
+ - name: Run SIMD Tests
+ run: |
+ docker run --rm --interactive -v $(pwd):/numpy the_build /bin/bash -c "
+ cd /numpy && python3 runtests.py -n -v -- -k test_simd
+ "
+
+ sde_simd_avx512_test:
+ # Intel Software Development Emulator (SDE) is used to run a given program
+ # on a specific instruction set architecture and capture various performance details.
+ # see https://www.intel.com/content/www/us/en/developer/articles/tool/software-development-emulator.html
+ needs: [smoke_test]
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v3
+ with:
+ submodules: recursive
+ fetch-depth: 0
+ - uses: actions/setup-python@v4
+ with:
+ python-version: ${{ env.PYTHON_VERSION }}
+ - name: Install Intel SDE
+ run: |
+ curl -o /tmp/sde.tar.xz https://downloadmirror.intel.com/732268/sde-external-9.7.0-2022-05-09-lin.tar.xz
+ mkdir /tmp/sde && tar -xvf /tmp/sde.tar.xz -C /tmp/sde/
+ sudo mv /tmp/sde/* /opt/sde && sudo ln -s /opt/sde/sde64 /usr/bin/sde
+ - name: Install dependencies
+ run: python -m pip install -r test_requirements.txt
+ - name: Build
+ run: python setup.py build
+ --simd-test="\$werror AVX512F AVX512_KNL AVX512_KNM AVX512_SKX AVX512_CLX AVX512_CNL AVX512_ICL"
+ install
+ # KNM implies KNL
+ - name: Run SIMD tests (Xeon PHI)
+ run: sde -knm -- python runtests.py -n -v -- -k test_simd
+ # ICL implies SKX, CLX and CNL
+ - name: Run SIMD tests (Ice Lake)
+ run: sde -icl -- python runtests.py -n -v -- -k test_simd
diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml
new file mode 100644
index 000000000..de191d068
--- /dev/null
+++ b/.github/workflows/circleci.yml
@@ -0,0 +1,24 @@
+# To enable this workflow on a fork, comment out:
+#
+# if: github.repository == 'numpy/numpy'
+
+name: CircleCI artifact redirector
+
+permissions:
+ contents: read # to fetch code (actions/checkout)
+
+on: [status]
+jobs:
+ circleci_artifacts_redirector_job:
+ runs-on: ubuntu-latest
+ name: Run CircleCI artifacts redirector
+ permissions:
+ pull-requests: write
+ # if: github.repository == 'numpy/numpy'
+ steps:
+ - name: GitHub Action step
+ uses: larsoner/circleci-artifacts-redirector-action@master
+ with:
+ repo-token: ${{ secrets.GITHUB_TOKEN }}
+ artifact-path: 0/doc/build/html/index.html
+ circleci-jobs: build
diff --git a/.github/workflows/emscripten.yml b/.github/workflows/emscripten.yml
new file mode 100644
index 000000000..68b0c932c
--- /dev/null
+++ b/.github/workflows/emscripten.yml
@@ -0,0 +1,75 @@
+# To enable this workflow on a fork, comment out:
+#
+# if: github.repository == 'numpy/numpy'
+name: Test Emscripten/Pyodide build
+
+on:
+ pull_request:
+ branches:
+ - main
+ - maintenance/**
+
+concurrency:
+ group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
+ cancel-in-progress: true
+
+permissions:
+ contents: read # to fetch code (actions/checkout)
+
+jobs:
+ build-wasm-emscripten:
+ runs-on: ubuntu-latest
+ if: github.repository == 'numpy/numpy'
+ env:
+ PYODIDE_VERSION: 0.22.0a3
+ # PYTHON_VERSION and EMSCRIPTEN_VERSION are determined by PYODIDE_VERSION.
+ # The appropriate versions can be found in the Pyodide repodata.json
+ # "info" field, or in Makefile.envs:
+ # https://github.com/pyodide/pyodide/blob/main/Makefile.envs#L2
+ PYTHON_VERSION: 3.10.2
+ EMSCRIPTEN_VERSION: 3.1.24
+ NODE_VERSION: 18
+ steps:
+ - name: Checkout numpy
+ uses: actions/checkout@v3
+ with:
+ submodules: true
+ # versioneer.py requires the latest tag to be reachable. Here we
+ # fetch the complete history to get access to the tags.
+ # A shallow clone can work when the following issue is resolved:
+ # https://github.com/actions/checkout/issues/338
+ fetch-depth: 0
+
+ - name: set up python
+ id: setup-python
+ uses: actions/setup-python@v4
+ with:
+ python-version: ${{ env.PYTHON_VERSION }}
+
+ - uses: mymindstorm/setup-emsdk@v11
+ with:
+ version: ${{ env.EMSCRIPTEN_VERSION }}
+ actions-cache-folder: emsdk-cache
+
+ - name: Install pyodide-build
+ run: pip install pyodide-build==$PYODIDE_VERSION
+
+ - name: Build
+ run: CFLAGS=-g2 LDFLAGS=-g2 pyodide build
+
+ - name: set up node
+ uses: actions/setup-node@v3
+ with:
+ node-version: ${{ env.NODE_VERSION }}
+
+ - name: Set up Pyodide virtual environment
+ run: |
+ pyodide venv .venv-pyodide
+ source .venv-pyodide/bin/activate
+ pip install dist/*.whl
+ pip install -r test_requirements.txt
+ - name: Test
+ run: |
+ source .venv-pyodide/bin/activate
+ cd ..
+ python numpy/runtests.py -n -vv
diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml
new file mode 100644
index 000000000..a716139c4
--- /dev/null
+++ b/.github/workflows/wheels.yml
@@ -0,0 +1,212 @@
+# Workflow to build and test wheels.
+# To work on the wheel building infrastructure on a fork, comment out:
+#
+# if: github.repository == 'numpy/numpy'
+#
+# in the get_commit_message job. Be sure to include [wheel build] in your commit
+# message to trigger the build. All files related to wheel building are located
+# at tools/wheels/
+# Alternatively, you can add labels to the pull request in order to trigger wheel
+# builds.
+# The labels that trigger builds are:
+# 36 - Build(for changes to the building process,
+# 14 - Release(ensure wheels build before release)
+name: Wheel builder
+
+on:
+ schedule:
+ # ┌───────────── minute (0 - 59)
+ # │ ┌───────────── hour (0 - 23)
+ # │ │ ┌───────────── day of the month (1 - 31)
+ # │ │ │ ┌───────────── month (1 - 12 or JAN-DEC)
+ # │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT)
+ # │ │ │ │ │
+ - cron: "42 1 * * 4"
+ push:
+ pull_request:
+ types: [labeled, opened, synchronize, reopened]
+ workflow_dispatch:
+
+concurrency:
+ group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
+ cancel-in-progress: true
+
+permissions:
+ contents: read # to fetch code (actions/checkout)
+
+jobs:
+ get_commit_message:
+ name: Get commit message
+ runs-on: ubuntu-latest
+ if: github.repository == 'numpy/numpy'
+ outputs:
+ message: ${{ steps.commit_message.outputs.message }}
+ steps:
+ - name: Checkout numpy
+ uses: actions/checkout@v3
+ # Gets the correct commit message for pull request
+ with:
+ ref: ${{ github.event.pull_request.head.sha }}
+ - name: Get commit message
+ id: commit_message
+ run: |
+ set -xe
+ COMMIT_MSG=$(git log --no-merges -1 --oneline)
+ echo "message=$COMMIT_MSG" >> $GITHUB_OUTPUT
+ echo github.ref ${{ github.ref }}
+
+ build_wheels:
+ name: Build wheel for ${{ matrix.python }}-${{ matrix.buildplat[1] }}
+ needs: get_commit_message
+ if: >-
+ contains(needs.get_commit_message.outputs.message, '[wheel build]') ||
+ github.event_name == 'schedule' ||
+ github.event_name == 'workflow_dispatch' ||
+ (github.event_name == 'pull_request' &&
+ (contains(github.event.pull_request.labels.*.name, '36 - Build') ||
+ contains(github.event.pull_request.labels.*.name, '14 - Release'))) ||
+ (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && ( ! endsWith(github.ref, 'dev0')))
+ runs-on: ${{ matrix.buildplat[0] }}
+ strategy:
+ # Ensure that a wheel builder finishes even if another fails
+ fail-fast: false
+ matrix:
+ # Github Actions doesn't support pairing matrix values together, let's improvise
+ # https://github.com/github/feedback/discussions/7835#discussioncomment-1769026
+ buildplat:
+ - [ubuntu-20.04, manylinux_x86_64]
+ - [macos-12, macosx_*]
+ - [windows-2019, win_amd64]
+ - [windows-2019, win32]
+ # TODO: uncomment PyPy 3.9 builds once PyPy
+ # re-releases a new minor version
+ # NOTE: This needs a bump of cibuildwheel version, also, once that happens.
+ python: ["cp38", "cp39", "cp310", "cp311", "pp38"] #, "pp39"]
+ exclude:
+ # Don't build PyPy 32-bit windows
+ - buildplat: [windows-2019, win32]
+ python: "pp38"
+ - buildplat: [windows-2019, win32]
+ python: "pp39"
+ env:
+ IS_32_BIT: ${{ matrix.buildplat[1] == 'win32' }}
+ IS_PUSH: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }}
+ IS_SCHEDULE_DISPATCH: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
+ steps:
+ - name: Checkout numpy
+ uses: actions/checkout@v3
+ with:
+ submodules: true
+ # versioneer.py requires the latest tag to be reachable. Here we
+ # fetch the complete history to get access to the tags.
+ # A shallow clone can work when the following issue is resolved:
+ # https://github.com/actions/checkout/issues/338
+ fetch-depth: 0
+
+ # Used to push the built wheels
+ - uses: actions/setup-python@v4
+ with:
+ python-version: "3.x"
+
+ - name: setup rtools for 32-bit
+ run: |
+ echo "PLAT=i686" >> $env:GITHUB_ENV
+ echo "MSYSTEM=MINGW32" >> $env:GITHUB_ENV
+ echo "PATH=$env:RTOOLS40_HOME\mingw32\bin;$env:PATH" >> $env:GITHUB_ENV
+ gfortran --version
+ if: ${{ matrix.buildplat[1] == 'win32' }}
+
+ - name: Build wheels
+ uses: pypa/cibuildwheel@v2.11.2
+ env:
+ CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }}
+
+ - uses: actions/upload-artifact@v3
+ with:
+ name: ${{ matrix.python }}-${{ startsWith(matrix.buildplat[1], 'macosx') && 'macosx' || matrix.buildplat[1] }}
+ path: ./wheelhouse/*.whl
+
+ - name: Upload wheels
+ if: success()
+ shell: bash
+ env:
+ NUMPY_STAGING_UPLOAD_TOKEN: ${{ secrets.NUMPY_STAGING_UPLOAD_TOKEN }}
+ NUMPY_NIGHTLY_UPLOAD_TOKEN: ${{ secrets.NUMPY_NIGHTLY_UPLOAD_TOKEN }}
+ run: |
+ source tools/wheels/upload_wheels.sh
+ set_upload_vars
+ # trigger an upload to
+ # https://anaconda.org/scipy-wheels-nightly/numpy
+ # for cron jobs or "Run workflow" (restricted to main branch).
+ # Tags will upload to
+ # https://anaconda.org/multibuild-wheels-staging/numpy
+ # The tokens were originally generated at anaconda.org
+ upload_wheels
+ build_sdist:
+ name: Build sdist
+ needs: get_commit_message
+ if: >-
+ contains(needs.get_commit_message.outputs.message, '[wheel build]') ||
+ github.event_name == 'schedule' ||
+ github.event_name == 'workflow_dispatch' ||
+ (github.event_name == 'pull_request' &&
+ (contains(github.event.pull_request.labels.*.name, '36 - Build') ||
+ contains(github.event.pull_request.labels.*.name, '14 - Release'))) ||
+ (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && ( ! endsWith(github.ref, 'dev0')))
+ runs-on: ubuntu-latest
+ env:
+ IS_PUSH: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }}
+ IS_SCHEDULE_DISPATCH: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
+ steps:
+ - name: Checkout numpy
+ uses: actions/checkout@v3
+ with:
+ submodules: true
+ # versioneer.py requires the latest tag to be reachable. Here we
+ # fetch the complete history to get access to the tags.
+ # A shallow clone can work when the following issue is resolved:
+ # https://github.com/actions/checkout/issues/338
+ fetch-depth: 0
+ # Used to push the built wheels
+ - uses: actions/setup-python@v4
+ with:
+ # Build sdist on lowest supported Python
+ python-version: "3.8"
+ - name: Build sdist
+ run: |
+ python setup.py sdist
+ - name: Test the sdist
+ run: |
+ # TODO: Don't run test suite, and instead build wheels from sdist
+ # Depends on pypa/cibuildwheel#1020
+ python -m pip install dist/*.gz
+ pip install -r test_requirements.txt
+ cd .. # Can't import numpy within numpy src directory
+ python -c "import numpy; print(numpy.__version__); numpy.test();"
+
+ - name: Check README rendering for PyPI
+ run: |
+ python -mpip install twine
+ twine check dist/*
+
+ - uses: actions/upload-artifact@v3
+ with:
+ name: sdist
+ path: ./dist/*
+
+ - name: Upload sdist
+ if: success()
+ shell: bash
+ env:
+ NUMPY_STAGING_UPLOAD_TOKEN: ${{ secrets.NUMPY_STAGING_UPLOAD_TOKEN }}
+ NUMPY_NIGHTLY_UPLOAD_TOKEN: ${{ secrets.NUMPY_NIGHTLY_UPLOAD_TOKEN }}
+ run: |
+ source tools/wheels/upload_wheels.sh
+ set_upload_vars
+ # trigger an upload to
+ # https://anaconda.org/scipy-wheels-nightly/numpy
+ # for cron jobs or "Run workflow" (restricted to main branch).
+ # Tags will upload to
+ # https://anaconda.org/multibuild-wheels-staging/numpy
+ # The tokens were originally generated at anaconda.org
+ upload_wheels