Skip to content

Commit f52007e

Browse files
update test logic again
1 parent 5ab7a68 commit f52007e

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

.github/workflows/nightly-test.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ jobs:
1616
runs-on: ubuntu-latest
1717
outputs:
1818
notebooks: ${{ steps.get_nbs.outputs.notebooks }}
19+
has_notebooks: ${{ steps.get_nbs.outputs.has_notebooks }}
1920
steps:
2021
- uses: actions/checkout@v2
2122

@@ -53,18 +54,21 @@ jobs:
5354
| jq -R . \
5455
| jq -s -c .)
5556

56-
# 5) Default to an empty array if there's nothing left
57-
if [ -z "$NB_JSON" ] || [ "$NB_JSON" = "[]" ]; then
58-
NB_JSON="[]"
57+
# 5) Output a boolean for gating
58+
if [ "${#FILTERED_NBS[@]}" -gt 0 ]; then
59+
echo "has_notebooks=true" >> $GITHUB_OUTPUT
60+
else
61+
echo "has_notebooks=false" >> $GITHUB_OUTPUT
5962
fi
6063

61-
echo "All valid notebooks: $NB_JSON"
64+
# 6) Also output the JSON array
6265
echo "notebooks=$NB_JSON" >> $GITHUB_OUTPUT
6366

6467
# ---------------------------------------------------------
6568
# 2) Test all notebooks in parallel
6669
# ---------------------------------------------------------
6770
test_all_notebooks:
71+
if: ${{ needs.gather_all_notebooks.outputs.has_notebooks == 'true' }}
6872
needs: gather_all_notebooks
6973
runs-on: ubuntu-latest
7074
strategy:

.github/workflows/test.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ jobs:
1717
runs-on: ubuntu-latest
1818
outputs:
1919
notebooks: ${{ steps.get_nbs.outputs.notebooks }}
20+
has_notebooks: ${{ steps.get_nbs.outputs.has_notebooks }}
2021
steps:
2122
- uses: actions/checkout@v2
2223

@@ -66,29 +67,34 @@ jobs:
6667

6768
echo "All valid notebooks: $NB_JSON"
6869

70+
# 5) Check if there's anything in FILTERED_NBS
71+
if [ "${#FILTERED_NBS[@]}" -gt 0 ]; then
72+
echo "has_notebooks=true" >> $GITHUB_OUTPUT
73+
else
74+
echo "has_notebooks=false" >> $GITHUB_OUTPUT
75+
fi
76+
6977
echo "notebooks=$NB_JSON" >> $GITHUB_OUTPUT
7078

7179
- name: Debug
7280
run: |
73-
echo "${{ steps.get_nbs.outputs.notebooks }}"
74-
echo "${{ fromJson(steps.get_nbs.outputs.notebooks) }}"
75-
echo "${{ fromJson(steps.get_nbs.outputs.notebooks).length }}"
81+
echo "${{ steps.get_nbs.outputs.has_notebooks }}"
82+
7683
7784
7885
7986
# ---------------------------------------------------------
8087
# 2) Test each changed notebook in parallel
8188
# ---------------------------------------------------------
8289
test_notebooks:
83-
if: ${{ fromJson(needs.gather_notebooks.outputs.notebooks).length > 0 }}
90+
if: ${{ needs.gather_notebooks.outputs.has_notebooks == 'true' }}
8491
needs: gather_notebooks
8592
runs-on: ubuntu-latest
8693
strategy:
8794
fail-fast: false
8895
matrix:
8996
notebook: ${{ fromJson(needs.gather_notebooks.outputs.notebooks) }}
9097

91-
9298
services:
9399
redis:
94100
image: redis/redis-stack-server:latest

0 commit comments

Comments
 (0)