From aacfb2bc2e52d681007d35df1d055d63e9cd9ccb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Tue, 13 May 2025 15:14:11 -0700 Subject: [PATCH 1/2] ENH: only run diffed content --- test.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/test.sh b/test.sh index 63b7714..2934d03 100755 --- a/test.sh +++ b/test.sh @@ -5,10 +5,17 @@ notebook_files=() # Find Markdown files convert. all_markdown_files=$(find tutorials -type f -name "*.md") + if [ $# -gt 0 ]; then - files_to_process="$@" + if [[ "$1" == all ]]; then + files_to_process=$all_markdown_files + else + files_to_process="$@" + fi + else - files_to_process=$all_markdown_files + # We only want to run tests for the notebooks we touched + files_to_process=$(git fetch origin main --depth=1; git diff origin/main --name-only tutorials | grep .md) fi # Identify Markdown files that are Jupytext and convert them all. From 35652573818e7601a66801d4356f09b2a64e27bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Tue, 13 May 2025 16:18:41 -0700 Subject: [PATCH 2/2] Changing defaults to run on all notebooks --- test.sh | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/test.sh b/test.sh index 2934d03..94fe101 100755 --- a/test.sh +++ b/test.sh @@ -7,20 +7,25 @@ notebook_files=() all_markdown_files=$(find tutorials -type f -name "*.md") if [ $# -gt 0 ]; then - if [[ "$1" == all ]]; then - files_to_process=$all_markdown_files + echo "INFO: Testing only a subset of notebooks" + if [[ "$1" == --changed ]]; then + # We only want to run tests for the notebooks we touched compared to `branch` + # provided in the second argument. + branch=$2 + files_to_process=$(git fetch ${branch} --depth=1; git diff ${branch} --name-only tutorials | grep .md) + else files_to_process="$@" fi else - # We only want to run tests for the notebooks we touched - files_to_process=$(git fetch origin main --depth=1; git diff origin/main --name-only tutorials | grep .md) + echo "INFO: Testing all the notebooks" + files_to_process=$all_markdown_files + fi # Identify Markdown files that are Jupytext and convert them all. for file in ${files_to_process}; do - echo loop in $file # Extract the kernel information from the Jupytext Markdown file. kernel_info=$(grep -A 10 '^---$' "$file" | grep -E 'kernelspec') # Skip if no kernel information was found.