From 2ab17a4c3afffdf4437c8ed03051f708aa8d88ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Melissa=20Weber=20Mendon=C3=A7a?= Date: Fri, 19 Apr 2024 15:21:37 -0300 Subject: [PATCH 1/3] CI, MAINT: Add docs-only and lint-only options to CI Borrows logic from SciPy CI Co-authored-by: Lucas Colley --- .github/workflows/commit_message.yml | 35 +++++++++++++++++++ .github/workflows/cygwin.yml | 5 +++ .github/workflows/linux.yml | 20 +++++++---- .github/workflows/linux_blas.yml | 13 +++++++ .../workflows/linux_compiler_sanitizers.yml | 6 ++++ .github/workflows/linux_musl.yml | 5 +++ .github/workflows/linux_qemu.yml | 5 +++ .github/workflows/linux_simd.yml | 5 +++ .github/workflows/macos.yml | 6 ++++ .github/workflows/mypy.yml | 5 +++ .github/workflows/windows.yml | 5 +++ 11 files changed, 103 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/commit_message.yml diff --git a/.github/workflows/commit_message.yml b/.github/workflows/commit_message.yml new file mode 100644 index 000000000000..3718f5b38973 --- /dev/null +++ b/.github/workflows/commit_message.yml @@ -0,0 +1,35 @@ +name: Skip tag checker + +on: + workflow_call: + outputs: + message: + description: "Skip tag checker" + value: ${{ jobs.check_skip_tags.outputs.message }} + +permissions: + contents: read + +jobs: + check_skip_tags: + name: Check for skips + runs-on: ubuntu-latest + outputs: + message: ${{ steps.skip_check.outputs.message }} + steps: + - name: Checkout numpy + uses: actions/checkout@v4.1.1 + # Gets the correct commit message for pull request + with: + ref: ${{ github.event.pull_request.head.sha }} + - name: Check for skips + id: skip_check + run: | + set -xe + COMMIT_MSG=$(git log --no-merges -1) + RUN="1" + if [[ "$COMMIT_MSG" == *"[docs only]"* ]]; then + RUN="0" + fi + echo "message=$RUN" >> $GITHUB_OUTPUT + echo github.ref ${{ github.ref }} diff --git a/.github/workflows/cygwin.yml b/.github/workflows/cygwin.yml index ebf3792cc153..8cbb9c45fa51 100644 --- a/.github/workflows/cygwin.yml +++ b/.github/workflows/cygwin.yml @@ -13,7 +13,12 @@ permissions: contents: read # to fetch code (actions/checkout) jobs: + get_commit_message: + name: Get commit message + uses: ./.github/workflows/commit_message.yml + cygwin_build_test: + needs: get_commit_message runs-on: windows-latest # To enable this workflow on a fork, comment out: if: github.repository == 'numpy/numpy' diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 3c59b639baa1..f68ac2eb4b10 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -27,6 +27,11 @@ permissions: contents: read # to fetch code (actions/checkout) jobs: + + get_commit_message: + name: Get commit message + uses: ./.github/workflows/commit_message.yml + lint: # To enable this job and subsequent jobs on a fork, comment out: if: github.repository == 'numpy/numpy' && github.event_name != 'push' @@ -50,6 +55,7 @@ jobs: smoke_test: # To enable this job on a fork, comment out: if: github.repository == 'numpy/numpy' + needs: get_commit_message runs-on: ubuntu-latest env: MESON_ARGS: "-Dallow-noblas=true -Dcpu-baseline=none -Dcpu-dispatch=none" @@ -67,7 +73,7 @@ jobs: - uses: ./.github/meson_actions pypy: - needs: [smoke_test] + needs: [smoke_test, get_commit_message] runs-on: ubuntu-latest if: github.event_name != 'push' steps: @@ -85,7 +91,7 @@ jobs: - uses: ./.github/meson_actions debug: - needs: [smoke_test] + needs: [smoke_test, get_commit_message] runs-on: ubuntu-latest if: github.event_name != 'push' steps: @@ -115,7 +121,7 @@ jobs: full: # Build a wheel, install it, then run the full test suite with code coverage - needs: [smoke_test] + needs: [smoke_test, get_commit_message] runs-on: ubuntu-22.04 steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 @@ -151,7 +157,7 @@ jobs: # TODO: gcov benchmark: - needs: [smoke_test] + needs: [smoke_test, get_commit_message] runs-on: ubuntu-latest if: github.event_name != 'push' steps: @@ -182,7 +188,7 @@ jobs: spin bench --quick sdist: - needs: [smoke_test] + needs: [smoke_test, get_commit_message] runs-on: ubuntu-latest if: github.event_name != 'push' steps: @@ -215,7 +221,7 @@ jobs: pytest --pyargs numpy -m "not slow" array_api_tests: - needs: [smoke_test] + needs: [smoke_test, get_commit_message] runs-on: ubuntu-latest if: github.event_name != 'push' steps: @@ -252,7 +258,7 @@ jobs: pytest array_api_tests -v -c pytest.ini --ci --max-examples=2 --derandomize --disable-deadline --skips-file ${GITHUB_WORKSPACE}/tools/ci/array-api-skips.txt custom_checks: - needs: [smoke_test] + needs: [smoke_test, get_commit_message] runs-on: ubuntu-latest if: github.event_name != 'push' steps: diff --git a/.github/workflows/linux_blas.yml b/.github/workflows/linux_blas.yml index 3b23072dccfa..c40a516a65ee 100644 --- a/.github/workflows/linux_blas.yml +++ b/.github/workflows/linux_blas.yml @@ -53,9 +53,14 @@ permissions: contents: read # to fetch code (actions/checkout) jobs: + get_commit_message: + name: Get commit message + uses: ./.github/workflows/commit_message.yml + openblas32_stable_nightly: # To enable this workflow on a fork, comment out: if: github.repository == 'numpy/numpy' + needs: get_commit_message runs-on: ubuntu-latest strategy: fail-fast: false @@ -119,6 +124,7 @@ jobs: openblas_no_pkgconfig_fedora: if: github.repository == 'numpy/numpy' + needs: get_commit_message runs-on: ubuntu-latest container: fedora:39 name: "OpenBLAS (Fedora, no pkg-config, LP64/ILP64)" @@ -154,6 +160,7 @@ jobs: flexiblas_fedora: if: github.repository == 'numpy/numpy' + needs: get_commit_message runs-on: ubuntu-latest container: fedora:39 name: "FlexiBLAS (LP64, ILP64 on Fedora)" @@ -189,6 +196,7 @@ jobs: openblas_cmake: if: github.repository == 'numpy/numpy' + needs: get_commit_message runs-on: ubuntu-latest name: "OpenBLAS with CMake" steps: @@ -217,6 +225,7 @@ jobs: netlib-debian: if: github.repository == 'numpy/numpy' + needs: get_commit_message runs-on: ubuntu-latest name: "Debian libblas/liblapack" steps: @@ -246,6 +255,7 @@ jobs: netlib-split: if: github.repository == 'numpy/numpy' + needs: get_commit_message runs-on: ubuntu-latest container: opensuse/tumbleweed name: "OpenSUSE Netlib BLAS/LAPACK" @@ -277,6 +287,7 @@ jobs: mkl: if: github.repository == 'numpy/numpy' + needs: get_commit_message runs-on: ubuntu-latest name: "MKL (LP64, ILP64, SDL)" steps: @@ -340,6 +351,7 @@ jobs: blis: if: github.repository == 'numpy/numpy' + needs: get_commit_message runs-on: ubuntu-latest name: "BLIS" steps: @@ -376,6 +388,7 @@ jobs: atlas: if: github.repository == 'numpy/numpy' + needs: get_commit_message runs-on: ubuntu-latest name: "ATLAS" steps: diff --git a/.github/workflows/linux_compiler_sanitizers.yml b/.github/workflows/linux_compiler_sanitizers.yml index d54dd1415950..b083132e283d 100644 --- a/.github/workflows/linux_compiler_sanitizers.yml +++ b/.github/workflows/linux_compiler_sanitizers.yml @@ -21,9 +21,15 @@ permissions: contents: read # to fetch code (actions/checkout) jobs: + + get_commit_message: + name: Get commit message + uses: ./.github/workflows/commit_message.yml + clang_sanitizers: # To enable this workflow on a fork, comment out: if: github.repository == 'numpy/numpy' + needs: get_commit_message runs-on: ubuntu-latest steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 diff --git a/.github/workflows/linux_musl.yml b/.github/workflows/linux_musl.yml index ee33632c2343..19d2ae49463e 100644 --- a/.github/workflows/linux_musl.yml +++ b/.github/workflows/linux_musl.yml @@ -17,10 +17,15 @@ permissions: jobs: + get_commit_message: + name: Get commit message + uses: ./.github/workflows/commit_message.yml + musllinux_x86_64: runs-on: ubuntu-latest # To enable this workflow on a fork, comment out: if: github.repository == 'numpy/numpy' + needs: get_commit_message container: # Use container used for building musllinux wheels # it has git installed, all the pythons, etc diff --git a/.github/workflows/linux_qemu.yml b/.github/workflows/linux_qemu.yml index d4d6fe4a4989..a68db72d5521 100644 --- a/.github/workflows/linux_qemu.yml +++ b/.github/workflows/linux_qemu.yml @@ -27,9 +27,14 @@ permissions: contents: read jobs: + get_commit_message: + name: Get commit message + uses: ./.github/workflows/commit_message.yml + linux_qemu: # To enable this workflow on a fork, comment out: if: github.repository == 'numpy/numpy' + needs: get_commit_message runs-on: ubuntu-22.04 continue-on-error: true strategy: diff --git a/.github/workflows/linux_simd.yml b/.github/workflows/linux_simd.yml index f2f50fbe4684..8f4ac4817b18 100644 --- a/.github/workflows/linux_simd.yml +++ b/.github/workflows/linux_simd.yml @@ -51,9 +51,14 @@ permissions: contents: read # to fetch code (actions/checkout) jobs: + get_commit_message: + name: Get commit message + uses: ./.github/workflows/commit_message.yml + baseline_only: # To enable this workflow on a fork, comment out: if: github.repository == 'numpy/numpy' + needs: get_commit_message runs-on: ubuntu-latest env: MESON_ARGS: "-Dallow-noblas=true -Dcpu-dispatch=none" diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 7c759631c863..d62a13636c52 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -17,10 +17,15 @@ concurrency: cancel-in-progress: true jobs: + get_commit_message: + name: Get commit message + uses: ./.github/workflows/commit_message.yml + x86_conda: name: macOS x86-64 conda # To enable this workflow on a fork, comment out: if: github.repository == 'numpy/numpy' + needs: get_commit_message runs-on: macos-13 strategy: fail-fast: false @@ -105,6 +110,7 @@ jobs: accelerate: name: Accelerate (LP64, ILP64) - ${{ matrix.build_runner[1] }} if: github.repository == 'numpy/numpy' + needs: get_commit_message runs-on: ${{ matrix.build_runner[0] }} strategy: fail-fast: false diff --git a/.github/workflows/mypy.yml b/.github/workflows/mypy.yml index be9874a9f7eb..d1b2b17c5080 100644 --- a/.github/workflows/mypy.yml +++ b/.github/workflows/mypy.yml @@ -37,9 +37,14 @@ permissions: contents: read # to fetch code (actions/checkout) jobs: + get_commit_message: + name: Get commit message + uses: ./.github/workflows/commit_message.yml + mypy: # To enable this workflow on a fork, comment out: if: github.repository == 'numpy/numpy' + needs: get_commit_message name: "MyPy" runs-on: ${{ matrix.os_python[0] }} strategy: diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index f6e0f1b3a5ca..1d61b33633ed 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -14,8 +14,12 @@ permissions: contents: read # to fetch code (actions/checkout) jobs: + get_commit_message: + name: Get commit message + uses: ./.github/workflows/commit_message.yml python64bit_openblas: name: x86-64, LP64 OpenBLAS + needs: get_commit_message runs-on: windows-2019 # To enable this job on a fork, comment out: if: github.repository == 'numpy/numpy' @@ -83,6 +87,7 @@ jobs: runs-on: windows-2019 # To enable this job on a fork, comment out: if: github.repository == 'numpy/numpy' + needs: get_commit_message steps: - name: Checkout uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 From 4aa250f1e1c0c519f37cd6c2046c62fb32f84b02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Melissa=20Weber=20Mendon=C3=A7a?= Date: Fri, 19 Apr 2024 15:25:37 -0300 Subject: [PATCH 2/3] DOC, MAINT: Add docs on docs-only and lint-only CI skip options --- azure-pipelines.yml | 2 +- doc/source/dev/development_workflow.rst | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 2393a96d3f86..c3083f78f763 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -28,7 +28,7 @@ stages: git_log=`git log --max-count=1 --skip=1 --pretty=format:"%B" | tr "\n" " "` echo "##vso[task.setvariable variable=log]$git_log" - bash: echo "##vso[task.setvariable variable=RET]false" - condition: or(contains(variables.log, '[skip azp]'), contains(variables.log, '[azp skip]'), contains(variables.log, '[skip ci]'), contains(variables.log, '[ci skip]')) + condition: or(contains(variables.log, '[skip azp]'), contains(variables.log, '[azp skip]'), contains(variables.log, '[skip ci]'), contains(variables.log, '[ci skip]'), contains(variables.log, '[docs only]'), contains(variables.log, '[lint only]')) - bash: echo "##vso[task.setvariable variable=start_main;isOutput=true]$RET" name: result diff --git a/doc/source/dev/development_workflow.rst b/doc/source/dev/development_workflow.rst index d3ee762445e6..72cd8dee3fe4 100644 --- a/doc/source/dev/development_workflow.rst +++ b/doc/source/dev/development_workflow.rst @@ -177,6 +177,8 @@ Standard acronyms to start the commit message with are:: TYP: static typing REL: related to releasing numpy +.. skip-ci:: + Commands to skip continuous integration ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -223,6 +225,10 @@ these fragments in each commit message of a PR: uploads. `See the configuration file for these checks. `__ +* ``[docs only]``: Run only the documentation check + + This is useful if you are only making changes to the documentation. + Test building wheels ~~~~~~~~~~~~~~~~~~~~ From da952fa561792f1c924e8c59c9504ced0d009e24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Melissa=20Weber=20Mendon=C3=A7a?= Date: Sat, 20 Apr 2024 09:21:03 -0300 Subject: [PATCH 3/3] DOC: Fix link to skip-ci section [skip azp][skip cirrus][skip actions] --- doc/source/dev/development_workflow.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/dev/development_workflow.rst b/doc/source/dev/development_workflow.rst index 72cd8dee3fe4..bcaf8af1d8d8 100644 --- a/doc/source/dev/development_workflow.rst +++ b/doc/source/dev/development_workflow.rst @@ -177,7 +177,7 @@ Standard acronyms to start the commit message with are:: TYP: static typing REL: related to releasing numpy -.. skip-ci:: +.. _skip-ci: Commands to skip continuous integration ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~