Skip to content

Commit 090c572

Browse files
committed
Add test execution step to SDK build workflow
Introduces a 'Run Tests' job to the build validation workflow for multiple SDKs. The step conditionally runs tests for each SDK based on the presence of test files or configuration, providing feedback if no tests are found or configured.
1 parent cd71267 commit 090c572

File tree

1 file changed

+97
-0
lines changed

1 file changed

+97
-0
lines changed

.github/workflows/sdk-build-validation.yml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,3 +197,100 @@ jobs:
197197
exit 1
198198
;;
199199
esac
200+
201+
- name: Run Tests
202+
working-directory: examples/${{ matrix.sdk }}
203+
run: |
204+
case "${{ matrix.sdk }}" in
205+
web|node|cli|react-native)
206+
if [ -f "package.json" ] && grep -q '"test"' package.json; then
207+
# Check if test script is not a placeholder/error message
208+
if grep -q '"test".*"echo.*no test' package.json; then
209+
echo "No tests configured (placeholder script found)"
210+
else
211+
npm test
212+
fi
213+
else
214+
echo "No tests configured in package.json"
215+
fi
216+
;;
217+
flutter)
218+
if [ -d "test" ] && find test -name "*_test.dart" 2>/dev/null | grep -q .; then
219+
flutter test
220+
else
221+
echo "No Flutter tests found"
222+
fi
223+
;;
224+
apple|swift)
225+
if [ -d "Tests" ] && find Tests -name "*.swift" 2>/dev/null | grep -q .; then
226+
swift test
227+
else
228+
echo "No Swift tests found"
229+
fi
230+
;;
231+
android)
232+
if [ -d "library/src/test" ] || [ -d "app/src/test" ]; then
233+
./gradlew test
234+
else
235+
echo "No Android tests found"
236+
fi
237+
;;
238+
kotlin)
239+
if [ -d "src/test" ]; then
240+
./gradlew test
241+
else
242+
echo "No Kotlin tests found"
243+
fi
244+
;;
245+
php)
246+
if [ -f "vendor/bin/phpunit" ] && [ -d "tests" ]; then
247+
vendor/bin/phpunit tests/
248+
else
249+
echo "No PHPUnit tests configured"
250+
fi
251+
;;
252+
python)
253+
if [ -d "tests" ] || find . -maxdepth 2 -name "test_*.py" -o -name "*_test.py" 2>/dev/null | grep -q .; then
254+
python -m pytest
255+
else
256+
echo "No pytest tests found"
257+
fi
258+
;;
259+
ruby)
260+
if [ -d "test" ] || [ -d "spec" ]; then
261+
if [ -f "Rakefile" ] && grep -q "test" Rakefile; then
262+
bundle exec rake test
263+
elif [ -d "spec" ]; then
264+
bundle exec rspec
265+
else
266+
echo "No Ruby tests configured"
267+
fi
268+
else
269+
echo "No Ruby tests found"
270+
fi
271+
;;
272+
dart)
273+
if [ -d "test" ] && find test -name "*_test.dart" 2>/dev/null | grep -q .; then
274+
dart test
275+
else
276+
echo "No Dart tests found"
277+
fi
278+
;;
279+
go)
280+
if find . -name "*_test.go" 2>/dev/null | grep -q .; then
281+
go test ./...
282+
else
283+
echo "No Go tests found"
284+
fi
285+
;;
286+
dotnet)
287+
if find . -name "*.csproj" -exec grep -l "Microsoft.NET.Test.Sdk" {} \; 2>/dev/null | grep -q .; then
288+
dotnet test
289+
else
290+
echo "No .NET tests configured"
291+
fi
292+
;;
293+
*)
294+
echo "No tests for SDK: ${{ matrix.sdk }}"
295+
;;
296+
esac

0 commit comments

Comments
 (0)