Skip to content

Commit

Permalink
Add script to change testing depth of some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
llrs-roche committed Jan 28, 2025
1 parent 261b61f commit 62dee69
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/build-check-install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,37 @@ jobs:
path: "${{ inputs.additional-caches }}"
key: additional-caches-${{ runner.os }}

- name: Check only affected modules
if: startsWith(${{ github.event.repository.name }}, "teal.modules.") && github.event_name == 'pull_request'
run: |
# Get the list of files that have changed
files=$(git diff --name-only main..)
# Base directories
src_dir="R/"
test_dir="tests/testthat/"
# Loop through each modified file and determine which tests to run
for file in $files; do
# Extract the base name of the file, examples:
# tests/testthat/test-shinytest2-foo.R -> foo
# R/foo.R -> foo
base_name=$(basename "$file" .R | sed s/test-shinytest2-//g)
# Find matching test files
test_files=$(grep -l "$base_name" "$test_dir"test-shinytest2-*.R)
if [ -z "$test_files" ]; then
echo "No test files found for modified file about $base_name."
else
echo "${file} matches ${test_files}"
sed -i 's/skip_if_too_deep(5)/skip_if_too_deep(3)/g' "$test_files"
fi
done
TESTING_DEPTH=3
shell: bash

- name: Build R package 🏗
run: |
if [ "${{ inputs.additional-env-vars }}" != "" ]
Expand Down

0 comments on commit 62dee69

Please sign in to comment.