aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaxim Yurchuk <maxim-yurchuk@ydb.tech>2024-10-17 18:28:36 +0300
committerGitHub <noreply@github.com>2024-10-17 18:28:36 +0300
commitd8f0f3fe28b2b3de3697fad6349a063e64bb13e6 (patch)
tree7c5374e198d56f343c9489b6a7df2ab08cec175b
parent192e3bc75aaa9e35b38de2b0c2833aa50600bddf (diff)
downloadydb-d8f0f3fe28b2b3de3697fad6349a063e64bb13e6.tar.gz
Script for showing unreachable targets (#10453)
-rwxr-xr-x.github/scripts/find_unreachable_targets_from_root.sh25
1 files changed, 25 insertions, 0 deletions
diff --git a/.github/scripts/find_unreachable_targets_from_root.sh b/.github/scripts/find_unreachable_targets_from_root.sh
new file mode 100755
index 0000000000..0d799014e9
--- /dev/null
+++ b/.github/scripts/find_unreachable_targets_from_root.sh
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+# Used to find targets without RECURSE/RECURCE_FOR_TESTS/.. paths from ydb/ya.make
+# TODO: run this check in CI
+
+set -e
+
+# find all modules+tests from ydb/ya.make
+./ya make -Gj0 -ttt ydb --build release -k --cache-tests --build-all > output_dump
+cat output_dump | jq '.graph[]' | jq 'select( ."node-type"=="test")' | jq -r ".kv.path" | sort | uniq | sed -E 's/\/[^/]*$//g;/^null$/d' | sort | uniq | { grep "^ydb" || true; } > tests.txt
+cat output_dump | jq '.graph[]' | jq -r 'select( ."target_properties"."module_type" != null) | select( ( ."target_properties"."module_tag" // "-" | strings | contains("proto") ) | not ) | .target_properties.module_dir' | sort | uniq | { grep "^ydb" || true; } > modules.txt
+cat modules.txt tests.txt | (echo 'RECURSE(';cat;echo ')') > ya.make
+
+
+# find all modules+tests from generated ya.make, which contains all paths as RECURSE from previous step
+./ya make -Gj0 -ttt . --build release -k --cache-tests --build-all > output_dump2
+cat output_dump2 | jq '.graph[]' | jq 'select( ."node-type"=="test")' | jq -r ".kv.path" | sort | uniq | sed -E 's/\/[^/]*$//g;/^null$/d' | sort | uniq | { grep "^ydb" || true; } > tests2.txt
+cat output_dump2 | jq '.graph[]' | jq -r 'select( ."target_properties"."module_type" != null) | select( ( ."target_properties"."module_tag" // "-" | strings | contains("proto") ) | not ) | .target_properties.module_dir' | sort | uniq | { grep "^ydb" || true; } > modules2.txt
+
+# put all targets together
+cat modules.txt tests.txt | sort | uniq > targets.txt
+cat modules2.txt tests2.txt | sort | uniq > targets2.txt
+
+# print targets which need to be fixes
+comm -13 targets.txt targets2.txt