Kotlinsdk #839
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: test | |
on: | |
push: | |
branches: main | |
pull_request: | |
branches: main | |
jobs: | |
python: | |
name: Python SDK Tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.9' | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
version: latest | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
- name: Load cached venv | |
id: cached-poetry-dependencies | |
uses: actions/cache@v4 | |
with: | |
path: python-sdk/.venv | |
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }} | |
- name: Install dependencies | |
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | |
working-directory: python-sdk | |
run: poetry install --no-interaction --no-root | |
- name: Install project | |
working-directory: python-sdk | |
run: poetry install --no-interaction | |
- name: Run tests | |
working-directory: python-sdk | |
run: poetry run python -m unittest discover tests -v | |
typescript: | |
name: TypeScript SDK Tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '22' | |
- name: Install protoc | |
uses: arduino/setup-protoc@v3 | |
with: | |
version: "25.x" | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install pnpm | |
uses: pnpm/action-setup@v4 | |
with: | |
version: 10.13.1 | |
- name: Setup pnpm cache | |
uses: actions/cache@v4 | |
with: | |
path: ~/.local/share/pnpm/store | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Install dependencies | |
working-directory: typescript-sdk | |
run: pnpm install --frozen-lockfile | |
- name: Test Build | |
working-directory: typescript-sdk | |
run: pnpm run build | |
- name: Run tests | |
working-directory: typescript-sdk | |
run: pnpm run test | |
kotlin: | |
name: Kotlin SDK Tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '21' | |
distribution: 'temurin' | |
- name: Setup Gradle | |
uses: gradle/gradle-build-action@v3 | |
- name: Run JVM tests | |
working-directory: sdks/community/kotlin/library | |
run: ./gradlew jvmTest --no-daemon --stacktrace | |
- name: Parse test results | |
if: always() | |
working-directory: sdks/community/kotlin/library | |
run: | | |
echo "## Kotlin SDK Test Results Summary" | |
echo "" | |
total_tests=0 | |
total_failures=0 | |
total_errors=0 | |
for module in core client tools; do | |
xml_dir="$module/build/test-results/jvmTest" | |
if [ -d "$xml_dir" ]; then | |
# Sum up test counts from all XML files in the directory | |
module_tests=$(find "$xml_dir" -name "*.xml" -exec grep -h '<testsuite' {} \; | grep -o 'tests="[0-9]*"' | sed 's/tests="\([0-9]*\)"/\1/' | awk '{sum += $1} END {print sum}') | |
module_failures=$(find "$xml_dir" -name "*.xml" -exec grep -h '<testsuite' {} \; | grep -o 'failures="[0-9]*"' | sed 's/failures="\([0-9]*\)"/\1/' | awk '{sum += $1} END {print sum}') | |
module_errors=$(find "$xml_dir" -name "*.xml" -exec grep -h '<testsuite' {} \; | grep -o 'errors="[0-9]*"' | sed 's/errors="\([0-9]*\)"/\1/' | awk '{sum += $1} END {print sum}') | |
# Default to 0 if empty | |
module_tests=${module_tests:-0} | |
module_failures=${module_failures:-0} | |
module_errors=${module_errors:-0} | |
if [ "$module_tests" -gt 0 ]; then | |
echo "✅ kotlin-$module: $module_tests tests, $module_failures failures, $module_errors errors" | |
total_tests=$((total_tests + module_tests)) | |
total_failures=$((total_failures + module_failures)) | |
total_errors=$((total_errors + module_errors)) | |
fi | |
fi | |
done | |
echo "" | |
echo "---" | |
echo "### Overall Results: $total_tests tests, $total_failures failures, $total_errors errors" | |
if [ $total_failures -gt 0 ] || [ $total_errors -gt 0 ]; then | |
echo "❌ Some tests failed" | |
exit 1 | |
elif [ $total_tests -eq 0 ]; then | |
echo "⚠️ No tests were found or executed" | |
exit 1 | |
else | |
echo "✅ All $total_tests tests passed!" | |
fi |