Skip to content

[WIP] Use individual notebook requirements #260

[WIP] Use individual notebook requirements

[WIP] Use individual notebook requirements #260

Workflow file for this run

name: Test utility scripts
on:
pull_request:
branches:
- main
types:
# We want this workflow triggered if the 'infrastructure' label is added
# or present when PR is updated
- opened
- reopened
- synchronize
- labeled
jobs:
notebooks:
# get_modified_tutorials.py
name: "Test get_modified_tutorials.py script"
runs-on: ubuntu-latest
if: contains(github.event.pull_request.labels.*.name, 'infrastructure')
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python
uses: actions/[email protected]
with:
python-version: 3.9
- name: Install dependencies and setup
run: |
sudo apt-get install pandoc
python -m pip install -U pip
python -m pip install gitpython
git config --global user.email "[email protected]"
git config --global user.name "Botty McBotface"
# Make sure if a file is removed, it does not appear in the modified list:
- name: Test 1a - removed (staged)
run: |
git rm tutorials/FITS-header/FITS-header.ipynb
MODIFIED=$(python .github/get_modified_tutorials.py --main-branch origin/main)
[ ! -z "$MODIFIED" ] && exit 1 || echo "Success!"
git reset --hard HEAD
- name: Test 1b - removed and committed
run: |
git rm tutorials/FITS-header/FITS-header.ipynb
git commit -m "TEST COMMIT"
MODIFIED=$(python .github/get_modified_tutorials.py --main-branch origin/main)
[ ! -z "$MODIFIED" ] && exit 1 || echo "Success!"
git reset --hard HEAD~1
# Make sure if a file is modified, it appears in the modified list:
- name: Test 2a - edited
run: |
echo "TEST" >> tutorials/FITS-header/FITS-header.ipynb
MODIFIED=$(python .github/get_modified_tutorials.py --main-branch origin/main)
[ "$MODIFIED" != "tutorials/FITS-header/FITS-header.ipynb" ] && exit 1 || echo "Success!"
git reset --hard HEAD
- name: Test 2b - edited and staged
run: |
echo "TEST" >> tutorials/FITS-header/FITS-header.ipynb
git add tutorials/FITS-header/FITS-header.ipynb
MODIFIED=$(python .github/get_modified_tutorials.py --main-branch origin/main)
[ "$MODIFIED" != "tutorials/FITS-header/FITS-header.ipynb" ] && exit 1 || echo "Success!"
git reset --hard HEAD
- name: Test 2c - edited and committed
run: |
echo "TEST" >> tutorials/FITS-header/FITS-header.ipynb
git add tutorials/FITS-header/FITS-header.ipynb
git commit -m "TEST COMMIT"
MODIFIED=$(python .github/get_modified_tutorials.py --main-branch origin/main)
[ "$MODIFIED" != "tutorials/FITS-header/FITS-header.ipynb" ] && exit 1 || echo "Success!"
git reset --hard HEAD~1
# Make sure if a file is created, it appears in the modified list:
- name: Test 3a - created and staged
run: |
touch tutorials/FITS-header/FITS-header2.ipynb
git add tutorials/FITS-header/FITS-header2.ipynb
MODIFIED=$(python .github/get_modified_tutorials.py --main-branch origin/main)
[ "$MODIFIED" != "tutorials/FITS-header/FITS-header2.ipynb" ] && exit 1 || echo "Success!"
git reset --hard HEAD
- name: Test 3b - created and committed
run: |
touch tutorials/FITS-header/FITS-header2.ipynb
git add tutorials/FITS-header/FITS-header2.ipynb
git commit -m "TEST COMMIT"
MODIFIED=$(python .github/get_modified_tutorials.py --main-branch origin/main)
[ "$MODIFIED" != "tutorials/FITS-header/FITS-header2.ipynb" ] && exit 1 || echo "Success!"
git reset --hard HEAD~1