Skip to content

Commit 146b84b

Browse files
committed
Try add identify tests step to workflow
1 parent 5170307 commit 146b84b

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

.github/workflows/build-tests-artifact.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,58 @@ jobs:
3636
echo "Files copied to _Tests_:"
3737
ls -la _Tests_/
3838
39+
- name: Identify tests
40+
run: |
41+
set -euo pipefail
42+
echo "Searching for test DLLs in _Tests_ folder..."
43+
44+
tests_dir="_Tests_"
45+
if [ ! -d "$tests_dir" ]; then
46+
echo "✗ $tests_dir folder not found"
47+
exit 1
48+
fi
49+
50+
# Prepare output file
51+
out_file="$tests_dir/TestDlls.txt"
52+
: > "$out_file"
53+
54+
found=0
55+
shopt -s nullglob
56+
for dll in "$tests_dir"/*.dll; do
57+
base=$(basename "$dll" .dll)
58+
59+
# Skip known non-test DLLs by name patterns
60+
case "$base" in
61+
NUnit_Engine|TestSetup_Engine|testhost|testcentric.engine.metadata|\
62+
Microsoft.*|System.*|nunit3.*|NUnit3.*|Newtonsoft.*|NuGet.*)
63+
continue ;;
64+
*_oM|*_Engine)
65+
continue ;;
66+
esac
67+
68+
# Check for test frameworks by scanning binary strings
69+
if command -v strings >/dev/null 2>&1; then
70+
if strings -a "$dll" 2>/dev/null | grep -qiE '(^|/)nunit\.framework|xunit|mstest\.testframework'; then
71+
echo "$base.dll" >> "$out_file"
72+
echo " ✓ $base.dll"
73+
found=$((found+1))
74+
fi
75+
else
76+
if grep -a -qiE 'nunit\.framework|xunit|mstest\.testframework' "$dll"; then
77+
echo "$base.dll" >> "$out_file"
78+
echo " ✓ $base.dll"
79+
found=$((found+1))
80+
fi
81+
fi
82+
done
83+
84+
if [ "$found" -eq 0 ]; then
85+
echo "✗ No test DLLs found in $tests_dir"
86+
exit 1
87+
fi
88+
89+
echo "✓ Wrote $found test DLL name(s) to $out_file"
90+
3991
- name: Upload Tests artifact
4092
uses: actions/upload-artifact@v4
4193
with:

0 commit comments

Comments
 (0)