Use individual notebook requirements #282
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0 | |
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 "bot@robot.com" | |
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 |