feat: adding workflow file to run notebooks #1
This file contains hidden or 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: Running Notebooks | |
| on: | |
| pull_request: | |
| schedule: | |
| - cron: '0 0 */14 * *' # Every 14 days at midnight UTC | |
| workflow_dispatch: | |
| env: | |
| OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
| HF_API_TOKEN: ${{ secrets.HUGGINGFACE_API_KEY }} | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v3 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.10' | |
| - name: Install dependencies and kernel | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install nbconvert nbformat papermill ipykernel | |
| python -m ipykernel install --user | |
| - name: Run notebooks (using skip file) | |
| run: | | |
| SKIP_FILE=".github/workflows/skip_notebooks" | |
| mapfile -t SKIP_LIST < "$SKIP_FILE" | |
| for notebook in $(find . -name "*.ipynb"); do | |
| skip=false | |
| for skip_item in "${SKIP_LIST[@]}"; do | |
| if [[ "$notebook" == "$skip_item" ]]; then | |
| echo "Skipping $notebook" | |
| skip=true | |
| break | |
| fi | |
| done | |
| if ! $skip; then | |
| echo "Testing $notebook" | |
| papermill "$notebook" /dev/null | |
| fi | |
| done |