mirror of
https://github.com/leptos-rs/leptos
synced 2024-11-12 23:57:09 +00:00
parent
5740c9b76b
commit
cc32a3e863
1 changed files with 31 additions and 41 deletions
|
@ -48,9 +48,9 @@ jq -R -s -c 'split("\n")[:-1]')
|
||||||
echo "CARGO_MAKE_CRATE_WORKSPACE_MEMBERS = $examples"
|
echo "CARGO_MAKE_CRATE_WORKSPACE_MEMBERS = $examples"
|
||||||
'''
|
'''
|
||||||
|
|
||||||
[tasks.test-info]
|
[tasks.test-runner-report]
|
||||||
workspace = false
|
workspace = false
|
||||||
description = "report ci test runners for each example - Option [all]"
|
description = "report ci test runners for each example - OPTION: [all]"
|
||||||
script = '''
|
script = '''
|
||||||
BOLD="\e[1m"
|
BOLD="\e[1m"
|
||||||
GREEN="\e[0;32m"
|
GREEN="\e[0;32m"
|
||||||
|
@ -59,63 +59,53 @@ YELLOW="\e[0;33m"
|
||||||
RESET="\e[0m"
|
RESET="\e[0m"
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "${YELLOW}CI test runners by example...${RESET}"
|
echo "${YELLOW}Test Runner Report${RESET}"
|
||||||
|
echo "${ITALIC}Pass the option \"all\" to show all the examples${RESET}"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
examples=$(ls |
|
makefile_paths=$(find . -name Makefile.toml -not -path '*/target/*' |
|
||||||
grep -v README.md |
|
sed 's%./%%' |
|
||||||
grep -v Makefile.toml |
|
sed 's%/Makefile.toml%%' |
|
||||||
grep -v cargo-make |
|
grep -v Makefile.toml |
|
||||||
grep -v gtk |
|
sort -u)
|
||||||
sort -u |
|
|
||||||
awk '{print $0 ", "}')
|
|
||||||
|
|
||||||
example_root_dir=$(pwd)
|
start_path=$(pwd)
|
||||||
|
|
||||||
for example_dir in $examples
|
for path in $makefile_paths; do
|
||||||
do
|
cd $path
|
||||||
clean_name=$(echo $example_dir | sed 's%,%%')
|
|
||||||
cd $clean_name
|
|
||||||
|
|
||||||
c_tests=$(grep -rl --fixed-strings "#[test]" | wc -l)
|
|
||||||
rs_tests=$(grep -rl --fixed-strings "#[rstest]" | wc -l)
|
|
||||||
w_configs=$(grep -rl "\/wasm-test.toml\"" | wc -l)
|
|
||||||
pw_configs=$(grep -rl "\/playwright-test.toml\"" | wc -l)
|
|
||||||
cl_configs=$(grep -rl "\/cargo-leptos-test.toml\"" | wc -l)
|
|
||||||
|
|
||||||
test_runner=
|
test_runner=
|
||||||
|
|
||||||
if [ $c_tests -gt 0 ]; then
|
test_count=$(grep -rl -E "#\[(test|rstest)\]" | wc -l)
|
||||||
|
if [ $test_count -gt 0 ]; then
|
||||||
test_runner="-C"
|
test_runner="-C"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $rs_tests -gt 0 ]; then
|
while read -r line; do
|
||||||
test_runner=$test_runner"-R"
|
case $line in
|
||||||
fi
|
*"wasm-test.toml"*)
|
||||||
|
test_runner=$test_runner"-W"
|
||||||
|
;;
|
||||||
|
*"playwright-test.toml"*)
|
||||||
|
test_runner=$test_runner"-P"
|
||||||
|
;;
|
||||||
|
*"cargo-leptos-test.toml"*)
|
||||||
|
test_runner=$test_runner"-L"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done <"./Makefile.toml"
|
||||||
|
|
||||||
if [ $w_configs -gt 0 ]; then
|
|
||||||
test_runner=$test_runner"-W"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ $pw_configs -gt 0 ]; then
|
|
||||||
test_runner=$test_runner"-P"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ $cl_configs -gt 0 ]; then
|
|
||||||
test_runner=$test_runner"-L"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -z "$1" ]; then
|
if [ ! -z "$1" ]; then
|
||||||
# Show all examples
|
# Show all examples
|
||||||
echo "$clean_name ${BOLD}${test_runner}${RESET}"
|
echo "$path ${BOLD}${test_runner}${RESET}"
|
||||||
elif [ ! -z $test_runner ]; then
|
elif [ ! -z $test_runner ]; then
|
||||||
# Filter out examples that do not run tests in `ci`
|
# Filter out examples that do not run tests in `ci`
|
||||||
echo "$clean_name ${BOLD}${test_runner}${RESET}"
|
echo "$path ${BOLD}${test_runner}${RESET}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd $example_root_dir
|
cd ${start_path}
|
||||||
done
|
done
|
||||||
echo
|
echo
|
||||||
echo "${ITALIC}Test Runners: C = Cargo Test, L = Cargo Leptos Test, P = Playwright Test, R = RS Test, W = WASM Test${RESET}"
|
echo "${ITALIC}Runners: C = Cargo Test, L = Cargo Leptos Test, P = Playwright Test, W = WASM Test${RESET}"
|
||||||
echo
|
echo
|
||||||
'''
|
'''
|
||||||
|
|
Loading…
Reference in a new issue