-
Notifications
You must be signed in to change notification settings - Fork 189
Add test execution step to SDK build workflow #1247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
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.
WalkthroughThe change adds a new "Run Tests" step to the SDK build validation CI workflow that executes language-specific test commands for each SDK entry in the build matrix. The step conditionally runs tests based on SDK type: npm test for web/node/cli/react-native SDKs with placeholder-test fallback handling, and respective test invocations for flutter, swift, android, kotlin, php, python, ruby, dart, go, and dotnet. The implementation includes detection logic to skip test execution when tests are not configured for a particular SDK, emitting informative messages instead. Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Pre-merge checks and finishing touches✅ Passed checks (2 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
.github/workflows/sdk-build-validation.yml (2)
252-258: Improve clarity of find command precedence in Python test detection.The
find . -maxdepth 2 -name "test_*.py" -o -name "*_test.py"command is functionally correct, but the operator precedence could be clearer with explicit grouping. Whilefindapplies-maxdepthglobally, parentheses would make this intent obvious to future maintainers.python) - if [ -d "tests" ] || find . -maxdepth 2 -name "test_*.py" -o -name "*_test.py" 2>/dev/null | grep -q .; then + if [ -d "tests" ] || find . -maxdepth 2 \( -name "test_*.py" -o -name "*_test.py" \) 2>/dev/null | grep -q .; then python -m pytest else echo "No pytest tests found" fi
231-237: Android test detection assumes project-specific directory structure.The checks for
library/src/testandapp/src/testare tailored to the Appwrite Android SDK's layout. This works for generated SDKs following this structure but won't detect tests in other directory arrangements. As long as the SDK generator produces this structure consistently, this is acceptable; document this assumption if it's not obvious from context.Consider adding a comment in the workflow to document why these specific paths are checked, making it clearer for future maintainers why standard Gradle paths like
src/test(used for Kotlin) weren't chosen here.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/sdk-build-validation.yml(1 hunks)
🔇 Additional comments (2)
.github/workflows/sdk-build-validation.yml (2)
201-296: Solid test execution strategy with appropriate detection logic for each language.The step structure mirrors the build logic above and uses sound heuristics to detect and run tests per SDK. Test failures will correctly cause workflow failures, while non-existent tests are gracefully skipped with informative messages.
205-216: Node.js placeholder detection is a reasonable heuristic with known limitations.The grep pattern
'"test".*"echo.*no test'targets generated SDKs with placeholder test scripts. Be aware this will not detect all placeholder formats (e.g., if a generated SDK uses a different error message structure). If you observe false negatives (placeholder tests running) during CI runs, you may need to expand this pattern or adjust the SDK generator to use a consistent placeholder format.Can you confirm whether the generated SDKs consistently use
"echo.*no test"placeholders, or whether additional patterns should be detected?

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.
What does this PR do?
This PR adds a "Run Tests" step to the
sdk-build-validation.ymlGitHub Actions workflow. The new step implements conditional test execution for various SDKs (web, node, cli, react-native, flutter, apple, swift, android, kotlin, php, python, ruby, dart, go, dotnet) generated during the CI build process.For each SDK, the code checks for the presence of test files or configurations and runs the appropriate test commands:
npm testif a valid test script exists inpackage.jsonflutter testif Dart test files are found in thetestdirectoryswift testif Swift test files are found in the Tests directory./gradlew testif test directories exist./gradlew testifsrc/testdirectory existsvendor/bin/phpunit tests/if PHPUnit is configuredpython -m pytestif test files are foundbundle exec rake testorbundle exec rspecbased on configurationdart testif test files are foundgo test Documents.if Go test files are founddotnet testif test SDK is configured in project filesIf no tests are found for a particular SDK, the step outputs an appropriate message and continues without failing the build.
Test Plan
Push this change to a branch and create a PR to trigger the workflow. Verify that the "Run Tests" step executes for all matrix combinations and produces expected output (either test results or "No tests found" messages).
action: https://github.com/Fellmonkey/sdk-generator/actions/runs/19081542717/job/54511219611
Related PRs and Issues
#1221 - used a prototype for automatic test execution with CI
Have you read the Contributing Guidelines on issues?
Yes
Summary by CodeRabbit