Submission by mnsh12 for HW1, HW2, HW3 and HW4_QClass2024-broken links removed #71
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 notebooks" | |
on: [pull_request, workflow_dispatch] | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
- name: "Install dependencies" | |
run: | | |
python -m pip install -U -r requirements.txt | |
python -m pip install -U -r requirements_tests.txt | |
- name: Get changed files - all | |
id: changed-files-all | |
uses: tj-actions/changed-files@v44 | |
- name: Get changed files - ipynb | |
id: changed-files-ipynb | |
uses: tj-actions/changed-files@v44 | |
with: | |
files: | | |
**.ipynb | |
- name: Set environment variables | |
run: | | |
if [ "${{ github.event_name }}" == 'pull_request' ]; then | |
echo "SHOULD_TEST_ALL_FILES=false" >> $GITHUB_ENV | |
echo "HAS_ANY_FILE_CHANGED=${{ steps.changed-files-all.outputs.any_changed }}" >> $GITHUB_ENV | |
echo "LIST_OF_FILE_CHANGED=${{ steps.changed-files-all.outputs.all_changed_files }}" >> $GITHUB_ENV | |
echo "HAS_ANY_IPYNB_CHANGED=${{ steps.changed-files-ipynb.outputs.any_changed }}" >> $GITHUB_ENV | |
echo "LIST_OF_IPYNB_CHANGED=${{ steps.changed-files-ipynb.outputs.all_changed_files }}" >> $GITHUB_ENV | |
elif [ "${{ github.event_name }}" == 'workflow_dispatch' ]; then | |
echo "SHOULD_TEST_ALL_FILES=true" >> $GITHUB_ENV | |
echo "HAS_ANY_FILE_CHANGED=None" >> $GITHUB_ENV | |
echo "LIST_OF_FILE_CHANGED=None" >> $GITHUB_ENV | |
echo "HAS_ANY_IPYNB_CHANGED=None" >> $GITHUB_ENV | |
echo "LIST_OF_IPYNB_CHANGED=None" >> $GITHUB_ENV | |
fi | |
- name: "Run tests" | |
run: python -m pytest tests | |
env: | |
JUPYTER_PLATFORM_DIRS: "1" |