-
Couldn't load subscription status.
- Fork 52
Overhaul to github actions workflows #56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| 01_crewai_langgraph_redis | ||
| doc2cache_llama3_1 | ||
| semantic_caching_gemini | ||
| 01_collaborative_filtering | ||
| 05_nvidia_ai_rag_redis |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,103 @@ | ||
| name: Tests - Nightly Run | ||
|
|
||
| on: | ||
| schedule: | ||
| - cron: "0 3 * * *" # 3 AM UTC nightly | ||
| workflow_dispatch: | ||
|
|
||
| env: | ||
| PYTHON_VERSION: "3.11" | ||
|
|
||
| jobs: | ||
| # --------------------------------------------------------- | ||
| # 1) Gather all notebooks (except skip-list) | ||
| # --------------------------------------------------------- | ||
| gather_all_notebooks: | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| notebooks: ${{ steps.get_nbs.outputs.notebooks }} | ||
| steps: | ||
| - uses: actions/checkout@v2 | ||
|
|
||
| - id: get_nbs | ||
| run: | | ||
| # 1) Read ignore patterns from .github/ignore-notebooks.txt | ||
| IGNORE_LIST=() | ||
| while IFS= read -r skip_nb || [ -n "$skip_nb" ]; do | ||
| # Skip empty lines or comment lines | ||
| [[ -z "$skip_nb" || "$skip_nb" =~ ^# ]] && continue | ||
| IGNORE_LIST+=("$skip_nb") | ||
| done < .github/ignore-notebooks.txt | ||
| # 2) Find all .ipynb in python-recipes (or your path) | ||
| NBS=$(find python-recipes -name '*.ipynb') | ||
|
|
||
| # 3) Filter out notebooks that match anything in IGNORE_LIST | ||
| FILTERED_NBS=() | ||
| for nb in $NBS; do | ||
| skip=false | ||
| for ignore_nb in "${IGNORE_LIST[@]}"; do | ||
| if [[ "$nb" == *"$ignore_nb"* ]]; then | ||
| skip=true | ||
| break | ||
| fi | ||
| done | ||
|
|
||
| if [ "$skip" = false ]; then | ||
| FILTERED_NBS+=("$nb") | ||
| fi | ||
| done | ||
|
|
||
| # 4) Convert the final array to compact JSON for GitHub Actions | ||
| NB_JSON=$(printf '%s\n' "${FILTERED_NBS[@]}" \ | ||
| | jq -R . \ | ||
| | jq -s -c .) | ||
|
|
||
| # 5) Default to an empty array if there's nothing left | ||
| if [ -z "$NB_JSON" ] || [ "$NB_JSON" = "[]" ]; then | ||
| NB_JSON="[]" | ||
| fi | ||
|
|
||
| echo "All valid notebooks: $NB_JSON" | ||
| echo "notebooks=$NB_JSON" >> $GITHUB_OUTPUT | ||
|
|
||
| # --------------------------------------------------------- | ||
| # 2) Test all notebooks in parallel | ||
| # --------------------------------------------------------- | ||
| test_all_notebooks: | ||
| needs: gather_all_notebooks | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| notebook: ${{ fromJson(needs.gather_all_notebooks.outputs.notebooks) }} | ||
|
|
||
| services: | ||
| redis: | ||
| image: redis/redis-stack-server:latest | ||
| ports: | ||
| - 6379:6379 | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v2 | ||
|
|
||
| # Setup Python | ||
| - uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: ${{ env.PYTHON_VERSION }} | ||
|
|
||
| - name: Create and activate venv | ||
| run: | | ||
| python -m venv venv | ||
| source venv/bin/activate | ||
| pip install --upgrade pip setuptools wheel | ||
| pip install pytest nbval | ||
| - name: Test notebook | ||
| env: | ||
| OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | ||
| COHERE_API_KEY: ${{ secrets.COHERE_API_KEY }} | ||
| run: | | ||
| echo "Testing notebook: ${{ matrix.notebook }}" | ||
| source venv/bin/activate | ||
| pytest --nbval-lax --disable-warnings "${{ matrix.notebook }}" | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,55 +1,110 @@ | ||
| name: Test Suite | ||
| name: Tests - PR/Push | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: | ||
| - main | ||
| push: | ||
| branches: | ||
| - main | ||
| schedule: | ||
| - cron: '0 0 * * 1' # Runs every Monday | ||
| branches: [ main ] | ||
| pull_request: | ||
| branches: [ main ] | ||
|
|
||
| env: | ||
| PYTHON_VERSION: "3.11" | ||
|
|
||
| jobs: | ||
| test: | ||
| name: Python ${{ matrix.python-version }} - ${{ matrix.connection }} [redis-stack ${{matrix.redis-stack-version}}] | ||
| # --------------------------------------------------------- | ||
| # 1) Gather the changed notebooks to produce a matrix list | ||
| # --------------------------------------------------------- | ||
| gather_notebooks: | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| notebooks: ${{ steps.get_nbs.outputs.notebooks }} | ||
| steps: | ||
| - uses: actions/checkout@v2 | ||
|
|
||
| - id: get_nbs | ||
| run: | | ||
| # Compare this commit/PR to 'main' and list changed .ipynb files | ||
| git fetch --depth=1 origin main | ||
| CHANGED_NOTEBOOKS=$(git diff --name-only origin/main | grep '\.ipynb$' || true) | ||
|
|
||
| # 1) Read ignore patterns from .github/ignore-notebooks.txt | ||
| IGNORE_LIST=() | ||
| while IFS= read -r skip_nb || [ -n "$skip_nb" ]; do | ||
| # Skip empty lines or comment lines | ||
| [[ -z "$skip_nb" || "$skip_nb" =~ ^# ]] && continue | ||
| IGNORE_LIST+=("$skip_nb") | ||
| done < .github/ignore-notebooks.txt | ||
|
|
||
| # 2) Filter out notebooks in CHANGED_NOTEBOOKS that match ignore patterns | ||
| FILTERED_NBS=() | ||
| for nb in $CHANGED_NOTEBOOKS; do | ||
| skip=false | ||
|
|
||
| # Check if in ignore list | ||
| for ignore_nb in "${IGNORE_LIST[@]}"; do | ||
| # Partial match: | ||
| if [[ "$nb" == *"$ignore_nb"* ]]; then | ||
| skip=true | ||
| break | ||
| fi | ||
| done | ||
|
|
||
| if [ "$skip" = false ]; then | ||
| FILTERED_NBS+=("$nb") | ||
| fi | ||
| done | ||
|
|
||
| # 3) Build a single-line JSON array | ||
| NB_JSON=$(printf '%s\n' "${FILTERED_NBS[@]}" \ | ||
| | jq -R . \ | ||
| | jq -s -c .) | ||
|
|
||
| # 4) Fallback to an empty array if there's nothing left | ||
| if [ -z "$NB_JSON" ] || [ "$NB_JSON" = "[]" ]; then | ||
| NB_JSON="[]" | ||
| fi | ||
|
|
||
| echo "All valid notebooks: $NB_JSON" | ||
|
|
||
| # 5) Write to $GITHUB_OUTPUT (modern approach instead of ::set-output) | ||
| echo "notebooks=$NB_JSON" >> $GITHUB_OUTPUT | ||
|
|
||
| # --------------------------------------------------------- | ||
| # 2) Test each changed notebook in parallel | ||
| # --------------------------------------------------------- | ||
| test_notebooks: | ||
| needs: gather_notebooks | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| python-version: [3.11] | ||
| connection: ['plain'] | ||
| redis-stack-version: ['latest'] | ||
| notebook: ${{ fromJson(needs.gather_notebooks.outputs.notebooks) }} | ||
|
|
||
| services: | ||
| redis: | ||
| image: redis/redis-stack-server:${{matrix.redis-stack-version}} | ||
| image: redis/redis-stack-server:latest | ||
| ports: | ||
| - 6379:6379 | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v2 | ||
| - name: Set up Python ${{ matrix.python-version }} | ||
| uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
| cache: 'pip' | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| pip install --no-cache-dir -r requirements.txt | ||
|
|
||
| - name: Set Redis version | ||
| run: | | ||
| echo "REDIS_VERSION=${{ matrix.redis-stack-version }}" >> $GITHUB_ENV | ||
|
|
||
| - name: Run notebooks | ||
| if: matrix.connection == 'plain' && matrix.redis-stack-version == 'latest' | ||
| env: | ||
| OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | ||
| LLAMA_CLOUD_API_KEY: ${{ secrets.LLAMA_CLOUD_API_KEY }} | ||
| GCP_REGION: ${{ secrets.GCP_REGION }} | ||
| GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }} | ||
| run: | | ||
| pytest --verbose --nbval-lax python-recipes/RAG/ python-recipes/vector-search python-recipes/redis-intro python-recipes/recommendation-systems python-recipes/agents python-recipes/computer-vision --ignore python-recipes/agents/01_crewai_langgraph_redis.ipynb --ignore python-recipes/RAG/05_nvidia_ai_rag_redis.ipynb --ignore python-recipes/semantic-cache/doc2cache_llama3_1.ipynb | ||
| - uses: actions/checkout@v2 | ||
|
|
||
| # Setup Python | ||
| - uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: ${{ env.PYTHON_VERSION }} | ||
|
|
||
| - name: Create and activate venv | ||
| run: | | ||
| python -m venv venv | ||
| source venv/bin/activate | ||
| pip install --upgrade pip setuptools wheel | ||
| pip install pytest nbval | ||
|
|
||
| - name: Test notebook | ||
| env: | ||
| OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | ||
| COHERE_API_KEY: ${{ secrets.COHERE_API_KEY }} | ||
| run: | | ||
| echo "Testing notebook: ${{ matrix.notebook }}" | ||
| source venv/bin/activate | ||
| pytest --nbval-lax --disable-warnings "${{ matrix.notebook }}" |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,17 +11,6 @@ Open a PR with your addition. We expect the following standards: | |
| 3. New additions should be added to the bottom of the list (unless otherwise noted). | ||
| 4. New additions should not contain any profanity or offensive language. | ||
|
|
||
| ### What it takes to get a Star | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good remove |
||
|
|
||
| When reviewing the PR, we will determine whether a new entry gets a star! | ||
|
|
||
| Examples that: | ||
| - are well-documented and easy to follow | ||
| - pertain to a new or creative use case | ||
| - follow good coding/writing hygiene | ||
|
|
||
| will be considered for getting a special star ⭐. | ||
|
|
||
| ## Updating your Pull Request | ||
|
|
||
| Sometimes, a maintainer will ask you to edit your Pull Request before it is included. This is normally due to spelling errors or because your PR didn't match the list format. | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤌