Add github action for testing notebooks #65
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: Run tests | |
on: | |
pull_request: | |
jobs: | |
run_notebooks: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4.1.7 | |
- name: Get changed files | |
id: changed-files | |
uses: tj-actions/changed-files@v45 | |
# To compare changes between the current commit and the last pushed remote commit set `since_last_remote_commit: true`. e.g | |
# with: | |
# since_last_remote_commit: true | |
with: | |
files: | | |
**.ipynb | |
- name: Start docker and test container | |
if: steps.changed-files.outputs.any_changed == 'true' | |
env: | |
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} | |
run: | | |
chmod +x ./tests/launch-test-environment.sh | |
./tests/launch-test-environment.sh | |
shell: bash | |
- name: Test all changed files | |
if: steps.changed-files.outputs.any_changed == 'true' | |
env: | |
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} | |
run: | | |
for file in ${ALL_CHANGED_FILES}; do | |
echo "$file" | |
docker exec jupyter papermill ../$file /dev/null --execution-timeout=1200 --log-level ERROR | |
done | |
- name: Stop docker and test container | |
if: steps.changed-files.outputs.any_changed == 'true' | |
env: | |
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} | |
run: | | |
docker compose --profile all-services down -v | |
shell: bash | |