Skip to content

Commit

Permalink
[MAINT] allow possiblity to skip doc build or test in CI via specific…
Browse files Browse the repository at this point in the history
… commit message (nilearn#4783)
  • Loading branch information
Remi-Gau authored Nov 25, 2024
1 parent e897ec4 commit b6bfb71
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 9 deletions.
9 changes: 0 additions & 9 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
# GitHub Actions Specification

## Skip CI

You can decide to skip CI at any time by including the tag "[skip ci]" in your commit message.
For more information, see: https://docs.github.com/en/actions/managing-workflow-runs/skipping-workflow-runs

```bash
$ git commit -m "[skip ci] commit message"
```

## Automatically assign issue

### assign.yml
Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
# Full builds are always run on "main".
# This is done every time there is a push on "main" and every week.
#
# Most of this workflow is skipped if "[skip doc]" is in the commit message.
#
# Data is cached after the get_data job to be passed to the build_docs job.
# Data can be cached and restore across attempts of a run of this workflow.
# Data can be cached and restored across run of this workflow.
Expand Down Expand Up @@ -56,10 +58,27 @@ jobs:
with:
args: --validate

check_skip_flags:
name: Check skip flags
runs-on: ubuntu-latest
steps:
- name: Get repo
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Check head git commit message
run: |
headCommitMsg=$(git show -s --format=%s)
if [[ $headCommitMsg == *"[skip doc]"* ]]; then
echo "skipping tests"
exit 1
fi
get_data:
# This prevents this workflow from running on a fork.
# To test this workflow on a fork, uncomment the following line.
if: github.repository == 'nilearn/nilearn'
needs: [check_skip_flags]
runs-on: ubuntu-latest
defaults:
run:
Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/test_with_tox.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
---
#
# Most of this workflow is skipped if "[skip test]" is in the commit message.
name: test

on:
Expand All @@ -18,7 +20,25 @@ env:
FORCE_COLOR: true

jobs:

check_skip_flags:
name: Check skip flags
runs-on: ubuntu-latest
steps:
- name: Get repo
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Check head git commit message
run: |
headCommitMsg=$(git show -s --format=%s)
if [[ $headCommitMsg == *"[skip test]"* ]]; then
echo "skipping tests"
exit 1
fi
test_and_coverage:
needs: check_skip_flags
if: github.repository == 'nilearn/nilearn'
name: 'Test with ${{ matrix.py }} on ${{ matrix.os }}: ${{ matrix.description }}'
runs-on: ${{ matrix.os }}
Expand Down
18 changes: 18 additions & 0 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,24 @@ learn how to use those tools to build documentation.

.. _git_repo:


Continuous integration
----------------------

Please note that if one of the following markers appear in the latest commit message, the following actions are taken.

============================ ===================
Commit Message Marker Action Taken by CI
============================ ===================
[skip ci] Gtihub CI is skipped completely. Several other options are also possible, see `github documentation <https://docs.github.com/en/actions/managing-workflow-runs-and-deployments/managing-workflow-runs/skipping-workflow-runs>`_).
[skip test] Skip running the tests.
[skip doc] Skip building the doc.
[test nightly] Run tests on the nightly build of Nilearn's dependencies.
[full doc] Run a full build of the documentation (meaning that all examples will be run).
[example] name_of_example.py Run partial documentation build but will run the requested example.
[force download] Force a download of all the dataset required for the build of the documentation.
============================ ===================

Setting up your environment
===========================

Expand Down

0 comments on commit b6bfb71

Please sign in to comment.