Skip to content

test on nightly dependencies #69

test on nightly dependencies

test on nightly dependencies #69

---
# Workflow to test against the latest nightly releases of development versions of our dependencies
name: test on nightly dependencies
on:
push:
branches:
- main
# commits message must include "[test nightly]" to trigger the workflow on PR
pull_request:
branches:
- '*'
schedule:
# Run every monday at 8am UTC
- cron: 0 8 * * 1
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test_nightly:
# 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'
runs-on: ubuntu-latest
steps:
- name: Checkout nilearn
uses: actions/checkout@v4
with:
# If pull request, checkout HEAD commit with all commit history
ref: ${{ github.event.pull_request.head.sha }}
- name: For PRs check if commit message contains [test nightly]
id: check-commit-msg
run: |
set -e -x
commit_msg=$(git log -2 --format=oneline);
if [ "$GITHUB_REF_NAME" == "main" ]; then
echo "run test on nightly releases of nilearn dependencies"
echo "skip=false" >> $GITHUB_OUTPUT
else
if [[ $commit_msg == *"[test nightly]"* ]]; then
echo "run test on nightly releases of nilearn dependencies"
echo "skip=false" >> $GITHUB_OUTPUT
else
echo "skip test on nightly releases of nilearn dependencies"
echo "skip=true" >> $GITHUB_OUTPUT
fi;
fi;
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Install and run ruff checks for NPY NPY201
# see https://numpy.org/devdocs/numpy_2_0_migration_guide.html#ruff-plugin
# TODO remove when nilearn only use numpy >= 2.0.0
run: |
python -m pip install ruff>0.1.8
ruff check --preview --select NPY201 .
- name: Install tox
if: steps.check-commit-msg.outputs.skip == 'false'
run: python -m pip install tox
- name: Run test suite
if: steps.check-commit-msg.outputs.skip == 'false'
id: nightly
continue-on-error: true
run: tox run -e test_nightly -- nilearn
- name: Create issue
# Do not open issues when on a PR
# because the result will be visible in the PR CI report
if: ${{ github.event_name != 'pull_request' && steps.nightly.outcome != 'success' }}
uses: JasonEtco/create-an-issue@v2.9.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ref: ${{ github.ref }}
run_id: ${{ github.run_id }}
repository: ${{ github.repository }}
with:
filename: .github/nightly_failure.md
update_existing: true
search_existing: open
- name: Return failure
if: ${{ steps.check-commit-msg.outputs.skip == 'false' && steps.nightly.outcome != 'success' }}
run: exit 1