Image registration tutorial #229
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@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v4.6.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 |