chore: trigger pipeline #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test 🧪 | |
on: | |
push: | |
branches: | |
- test-shell-issues | |
workflow_dispatch: | |
jobs: | |
test: | |
name: Test 🔍 | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repo 🛎 | |
uses: actions/checkout@v4 | |
- name: Check only affected modules 🎯 | |
run: | | |
# Bash script run | |
if ! command -v git > /dev/null 2>&1 | |
then | |
echo "git could not be found" | |
exit 0 | |
fi | |
if ! command -v grep > /dev/null 2>&1 | |
then | |
echo "grep could not be found" | |
exit 0 | |
fi | |
if ! command -v sed > /dev/null 2>&1 | |
then | |
echo "sed could not be found" | |
exit 0 | |
fi | |
# # Exit early if tag is on commit message even if it set to true | |
# test_all=$( git log -1 --pretty=%B | grep -F "[run-all-tests]" ) | |
# if [ -z "$test_all" ] | |
# then { | |
# echo "Last commit message forces to test everything." | |
# exit 0 | |
# } fi | |
# test_dir="tests/testthat/" | |
# # Get the list of R files that have changed | |
# # https://github.com/cloudnativeto/envoy/blob/de67446fa8af973761bb4716f5143d73643baf8b/.github/workflows/get_build_targets.sh_bak#L9 | |
# files=$(git diff --name-only HEAD FETCH_HEAD -- $test_dir R/*.R) | |
# if [ -n "$files" ] | |
# then { | |
# echo "No R files affected: test everything." | |
# exit 0 | |
# } fi | |
# # 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 (parenthesis to not match arguments) | |
# test_files=$(grep -l "$base_name(" "$test_dir"test-shinytest2-*.R) | |
# td=$TESTING_DEPTH | |
# # Modify in place so that only modified modules are tested. | |
# if [ -n "$test_files" ] && [ -z "$test_all" ]; | |
# then { | |
# sed -i 's/skip_if_too_deep(5)/skip_if_too_deep(3)/g' "$test_files" | |
# TESTING_DEPTH=3 | |
# echo "Testing with shinytest2 for $test_files"; | |
# } else { | |
# # Flag for helpers | |
# helper_modified="yes" | |
# git restore $test_dir | |
# echo "Run all tests" | |
# break; | |
# } fi | |
# # R file without corresponding test file: reset the testing depth | |
# if [ -n "$helper_modified" ] || [ -n "$test_all" ]; | |
# then { | |
# echo "Skip step or helper modifications detected." | |
# TESTING_DEPTH=$td; | |
# } fi | |
# done | |
shell: bash |