Skip to content

Commit 48cac2d

Browse files
committed
refactor: Ensure notebooks use a fresh environment in GH actions
1 parent bf96b5e commit 48cac2d

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

.github/workflows/nightly-test.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
[[ -z "$skip_nb" || "$skip_nb" =~ ^# ]] && continue
3333
IGNORE_LIST+=("$skip_nb")
3434
done < .github/ignore-notebooks.txt
35-
35+
3636
# 3) Filter out notebooks that match anything in IGNORE_LIST
3737
FILTERED_NBS=()
3838
for nb in $NBS; do
@@ -47,16 +47,16 @@ jobs:
4747
FILTERED_NBS+=("$nb")
4848
fi
4949
done
50-
50+
5151
# 4) Stuff into a single-line JSON array
5252
NB_JSON=$(printf '%s\n' "${FILTERED_NBS[@]}" \
5353
| jq -R . \
5454
| jq -s -c .)
55-
55+
5656
if [ -z "$NB_JSON" ] || [ "$NB_JSON" = "[]" ]; then
5757
NB_JSON="[]"
5858
fi
59-
59+
6060
echo "All valid notebooks: $NB_JSON"
6161
6262
# 5) Check if there's anything in FILTERED_NBS
@@ -65,7 +65,7 @@ jobs:
6565
else
6666
echo "has_notebooks=false" >> $GITHUB_OUTPUT
6767
fi
68-
68+
6969
echo "notebooks=$NB_JSON" >> $GITHUB_OUTPUT
7070
7171
# ---------------------------------------------------------
@@ -99,7 +99,7 @@ jobs:
9999
python -m venv venv
100100
source venv/bin/activate
101101
pip install --upgrade pip setuptools wheel
102-
pip install pytest nbval
102+
pip install --no-cache-dir pytest nbval
103103
104104
- name: Test notebook
105105
env:

.github/workflows/test.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ jobs:
2727
# 1) Compare this commit/PR to 'main' and list changed notebooks
2828
git fetch --depth=1 origin main
2929
CHANGED_NOTEBOOKS=$(git diff --name-only origin/main | grep '\.ipynb$' || true)
30-
30+
3131
# 2) Load notebooks to ignore
3232
IGNORE_LIST=()
3333
while IFS= read -r skip_nb || [ -n "$skip_nb" ]; do
3434
# Skip empty lines or comment lines
3535
[[ -z "$skip_nb" || "$skip_nb" =~ ^# ]] && continue
3636
IGNORE_LIST+=("$skip_nb")
3737
done < .github/ignore-notebooks.txt
38-
38+
3939
# 3) Filter out ignored notebooks
4040
FILTERED_NBS=()
4141
for nb in $CHANGED_NOTEBOOKS; do
@@ -52,16 +52,16 @@ jobs:
5252
FILTERED_NBS+=("$nb")
5353
fi
5454
done
55-
55+
5656
# 4) Stuff into a single-line JSON array
5757
NB_JSON=$(printf '%s\n' "${FILTERED_NBS[@]}" \
5858
| jq -R . \
5959
| jq -s -c .)
60-
60+
6161
if [ -z "$NB_JSON" ] || [ "$NB_JSON" = "[]" ]; then
6262
NB_JSON="[]"
6363
fi
64-
64+
6565
echo "All valid notebooks: $NB_JSON"
6666
6767
# 5) Check if there's anything in FILTERED_NBS
@@ -104,7 +104,7 @@ jobs:
104104
python -m venv venv
105105
source venv/bin/activate
106106
pip install --upgrade pip setuptools wheel
107-
pip install pytest nbval
107+
pip install --no-cache-dir pytest nbval
108108
109109
- name: Test notebook
110110
env:

0 commit comments

Comments
 (0)