Skip to content

Commit

Permalink
update test logic again
Browse files Browse the repository at this point in the history
  • Loading branch information
tylerhutcherson committed Feb 12, 2025
1 parent 5ab7a68 commit f52007e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
12 changes: 8 additions & 4 deletions .github/workflows/nightly-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
runs-on: ubuntu-latest
outputs:
notebooks: ${{ steps.get_nbs.outputs.notebooks }}
has_notebooks: ${{ steps.get_nbs.outputs.has_notebooks }}
steps:
- uses: actions/checkout@v2

Expand Down Expand Up @@ -53,18 +54,21 @@ jobs:
| 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="[]"
# 5) Output a boolean for gating
if [ "${#FILTERED_NBS[@]}" -gt 0 ]; then
echo "has_notebooks=true" >> $GITHUB_OUTPUT
else
echo "has_notebooks=false" >> $GITHUB_OUTPUT
fi

echo "All valid notebooks: $NB_JSON"
# 6) Also output the JSON array
echo "notebooks=$NB_JSON" >> $GITHUB_OUTPUT

# ---------------------------------------------------------
# 2) Test all notebooks in parallel
# ---------------------------------------------------------
test_all_notebooks:
if: ${{ needs.gather_all_notebooks.outputs.has_notebooks == 'true' }}
needs: gather_all_notebooks
runs-on: ubuntu-latest
strategy:
Expand Down
16 changes: 11 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
runs-on: ubuntu-latest
outputs:
notebooks: ${{ steps.get_nbs.outputs.notebooks }}
has_notebooks: ${{ steps.get_nbs.outputs.has_notebooks }}
steps:
- uses: actions/checkout@v2

Expand Down Expand Up @@ -66,29 +67,34 @@ jobs:

echo "All valid notebooks: $NB_JSON"

# 5) Check if there's anything in FILTERED_NBS
if [ "${#FILTERED_NBS[@]}" -gt 0 ]; then
echo "has_notebooks=true" >> $GITHUB_OUTPUT
else
echo "has_notebooks=false" >> $GITHUB_OUTPUT
fi

echo "notebooks=$NB_JSON" >> $GITHUB_OUTPUT

- name: Debug
run: |
echo "${{ steps.get_nbs.outputs.notebooks }}"
echo "${{ fromJson(steps.get_nbs.outputs.notebooks) }}"
echo "${{ fromJson(steps.get_nbs.outputs.notebooks).length }}"
echo "${{ steps.get_nbs.outputs.has_notebooks }}"
# ---------------------------------------------------------
# 2) Test each changed notebook in parallel
# ---------------------------------------------------------
test_notebooks:
if: ${{ fromJson(needs.gather_notebooks.outputs.notebooks).length > 0 }}
if: ${{ needs.gather_notebooks.outputs.has_notebooks == 'true' }}
needs: gather_notebooks
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
notebook: ${{ fromJson(needs.gather_notebooks.outputs.notebooks) }}


services:
redis:
image: redis/redis-stack-server:latest
Expand Down

0 comments on commit f52007e

Please sign in to comment.