Skip to content

WIP add workflows

WIP add workflows #17

name: "Test notebooks"
on: [pull_request, workflow_dispatch]
jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- 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 pytest
- name: Get changed files
id: changed-files
run: |
if ${{ github.event_name == 'pull_request' }}; then
echo "changed_files=$(git diff --name-only HEAD^ HEAD | xargs)" >> $GITHUB_OUTPUT
fi
- name: List changed files
run: |
for file in ${{ steps.changed-files.outputs.changed_files }}; do
echo "$file was changed"
done
- 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: 'Run tests'
run: python -m pytest tests
env:
HAS_ANY_FILE_CHANGED: "${{ steps.changed-files-all.outputs.test_any_changed }}"
LIST_OF_FILE_CHANGED: "${{ steps.changed-files-all.outputs.test_all_changed_files }}"
HAS_ANY_IPYNB_CHANGED: "${{ steps.changed-files-ipynb.outputs.test_any_changed }}"
LIST_OF_IPYNB_CHANGED: "${{ steps.changed-files-ipynb.outputs.test_all_changed_files }}"