-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add workflow to run all in directory
- Loading branch information
Showing
3 changed files
with
66 additions
and
1 deletion.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
name: "Test: All Notebooks" | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
directory: | ||
description: 'Directory to search for notebooks' | ||
required: true | ||
default: 'docs' | ||
type: string | ||
|
||
jobs: | ||
list-notebooks: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
matrix: ${{ steps.set-matrix.outputs.matrix }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Find all *.ipynb files | ||
id: set-matrix | ||
run: | | ||
# Get list of changed .ipynb files | ||
NOTEBOOKS=$(find ${{ inputs.directory }} -name "*.ipynb" | jq -R -s -c 'split("\n")[:-1]') | ||
echo "matrix={\"notebook\":$NOTEBOOKS}" >> $GITHUB_OUTPUT | ||
test-notebooks: | ||
needs: list-notebooks | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
max-parallel: 10 | ||
matrix: ${{ fromJSON(needs.list-notebooks.outputs.matrix) }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.11' | ||
|
||
- name: Install dependencies | ||
run: pip install nbformat | ||
|
||
- id: convert | ||
name: Convert test notebook into tmpdir script | ||
run: | | ||
python .github/scripts/convert-notebook.py ${{ matrix.notebook }} | ||
- name: View setup script notebook content | ||
shell: bash | ||
run: | | ||
cat ${{ steps.convert.outputs.script_path }} | ||
- name: View converted notebook content | ||
shell: bash | ||
run: | | ||
cat ${{ steps.convert.outputs.notebook_path }} | ||
- name: Run the converted notebook | ||
shell: bash | ||
run: | | ||
bash ${{ steps.convert.outputs.script_path }} | ||
env: | ||
PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }} | ||
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} |
File renamed without changes.