Skip to content

Commit

Permalink
fix CI it/5
Browse files Browse the repository at this point in the history
  • Loading branch information
dengemann committed Mar 22, 2024
1 parent 3138255 commit 5444a13
Showing 1 changed file with 5 additions and 87 deletions.
92 changes: 5 additions & 87 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,96 +1,14 @@
name: CI
on: [workflow_dispatch, pull_request, push]

permissions:
contents: read

inputs:
pre:
description: 'Install prerelease nbdev/execnb from master?'
required: false
default: ''
version:
description: 'Version of python to set up'
required: false
default: '3.9'
skip_test:
description: 'Skip tests?'
required: false
default: ''
flags:
description: 'Space separated list of nbdev test flags to run that are normally ignored'
required: false
default: ''
torch_cpu:
description: "Install PyTorch CPU instead of PyTorch Cuda. Has no effect if PyTorch isn't a requirement. Enabled by defaut."
required: false
default: true

jobs:
test:
name: nbdev-ci
using: composite
runs-on: ubuntu-latest
defaults:
run:
shell: bash -el {0}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ inputs.version }}
cache: pip
cache-dependency-path: settings.ini
- name: Test with nbdev
env:
USE_PRE: ${{ inputs.pre }}
SKIP_TEST: ${{ inputs.skip_test }}
FLAGS: ${{ inputs.flags }}
TORCH_CPU: "${{ inputs.torch_cpu }}"
shell: bash
- run: |
set -ux
python -m pip install --upgrade pip
if [ $USE_PRE ]; then
pip install -U git+https://github.com/fastai/fastcore.git
pip install -U git+https://github.com/fastai/ghapi.git
pip install -U git+https://github.com/fastai/execnb.git
pip install -U git+https://github.com/fastai/nbdev.git
else
pip install -U nbdev
fi
echo "Doing editable install..."
if [ $TORCH_CPU ]; then
test -f setup.py && pip install -e ".[dev]" --extra-index-url https://download.pytorch.org/whl/cpu
else
test -f setup.py && pip install -e ".[dev]"
fi
echo "Check we are starting with clean git checkout"
if [[ `git status --porcelain -uno` ]]; then
git diff
echo "git status is not clean"
false
fi
echo "Trying to strip out notebooks"
nbdev_clean
echo "Check that strip out was unnecessary"
git status -s # display the status to see which nbs need cleaning up
if [[ `git status --porcelain -uno` ]]; then
git status -uno
echo -e "!!! Detected unstripped out notebooks\n!!!Remember to run nbdev_install_hooks"
echo -e "This error can also happen if you are using an older version of nbdev relative to what is in CI. Please try to upgrade nbdev with the command `pip install -U nbdev`"
false
fi
nbdev_export
if [[ `git status --porcelain -uno` ]]; then
echo "::error::Notebooks and library are not in sync. Please run nbdev_export."
git status -uno
git diff
exit 1;
fi
echo "Making sure MNE data dependencies are downloaded"
- uses: actions/checkout@v3 # Check out the code
- name: Install Dependencies
run: |
pip install mne[data]>= 1.3
python -c 'import mne; mne.datasets.sample.data_path(verbose=True)';
python -c 'import mne; mne.datasets.testing.data_path(verbose=True)';
if [ ! $SKIP_TEST ]; then
nbdev_test --flags "$FLAGS"
fi
- uses: fastai/workflows/nbdev-ci@master

0 comments on commit 5444a13

Please sign in to comment.