@@ -1359,22 +1359,44 @@ jobs:
13591359 echo "✅ Multi-arch manifest created for ${REPO}:${VERSION} and ${REPO}:latest"
13601360
13611361 # ═══════════════════════════════════════════════════════════════════════════
1362- # SDK TESTS - Run TypeScript and Dart SDK test suites
1362+ # INTEGRATION TESTS - Smoke + TypeScript SDK + Dart SDK against Docker image
13631363 # ═══════════════════════════════════════════════════════════════════════════
1364- sdk_tests :
1365- name : Test TypeScript and Dart SDKs
1364+ integration_tests :
1365+ name : Integration Tests (Docker)
13661366 runs-on : ubuntu-latest
1367- needs : read_version
1367+ needs :
1368+ - docker
1369+ - read_version
1370+ if : ${{ github.event_name == 'push' || github.event.inputs.docker_push == 'true' }}
1371+ continue-on-error : true
1372+ env :
1373+ DOCKER_REPO_INPUT : ${{ github.event.inputs.docker_repo }}
13681374
13691375 steps :
13701376 - name : Checkout
13711377 uses : actions/checkout@v4
13721378
1373- - name : Setup Rust
1379+ - name : Set Docker repo
1380+ id : vars
1381+ shell : bash
1382+ run : |
1383+ set -euo pipefail
1384+ DOCKER_REPO="${DOCKER_REPO_INPUT:-}"
1385+ if [[ -z "$DOCKER_REPO" ]]; then
1386+ DOCKER_REPO="jamals86/kalamdb"
1387+ fi
1388+ echo "docker_repo=$DOCKER_REPO" >> "$GITHUB_OUTPUT"
1389+
1390+ - name : Setup Rust (for smoke tests)
13741391 uses : dtolnay/rust-toolchain@stable
13751392 with :
13761393 toolchain : ${{ env.RUST_VERSION }}
1377- targets : wasm32-unknown-unknown
1394+
1395+ - name : Cache Rust
1396+ uses : Swatinem/rust-cache@v2
1397+ with :
1398+ shared-key : integration-tests
1399+ cache-on-failure : true
13781400
13791401 - name : Setup Node 20
13801402 uses : actions/setup-node@v4
@@ -1405,75 +1427,129 @@ jobs:
14051427 https://rustwasm.github.io/wasm-pack/installer/init.sh | sh
14061428 wasm-pack --version
14071429
1408- - name : Start KalamDB server
1430+ - name : Pull and start KalamDB Docker container
14091431 shell : bash
1410- working-directory : backend
14111432 run : |
14121433 set -euo pipefail
1413- cp server.example.toml server.toml
1414- sed -i 's|jwt_secret = ".*"|jwt_secret = "sdk-test-secret-key-minimum-32-characters-long"|g' server.toml
1415-
1416- cargo run --bin kalamdb-server > ../sdk-tests-server.log 2>&1 &
1417- SERVER_PID=$!
1418- echo "SERVER_PID=$SERVER_PID" >> "$GITHUB_ENV"
1419-
1434+ VERSION="${{ needs.read_version.outputs.version }}"
1435+ DOCKER_REPO="${{ steps.vars.outputs.docker_repo }}"
1436+ IMAGE="${DOCKER_REPO}:${VERSION}-amd64"
1437+ JWT_SECRET="sdk-test-secret-key-minimum-32-characters-long"
1438+
1439+ echo "🐳 Pulling image: $IMAGE"
1440+ docker pull "$IMAGE"
1441+
1442+ echo "🚀 Starting container..."
1443+ docker run -d \
1444+ --name kalamdb-integration-test \
1445+ -p 8080:8080 \
1446+ -e KALAMDB_SERVER_HOST=0.0.0.0 \
1447+ -e KALAMDB_JWT_SECRET="${JWT_SECRET}" \
1448+ -e KALAMDB_ROOT_PASSWORD="kalamdb123" \
1449+ -e KALAMDB_LOG_LEVEL=info \
1450+ "$IMAGE"
1451+
1452+ # Persist for downstream steps
1453+ echo "KALAMDB_JWT_SECRET=${JWT_SECRET}" >> "$GITHUB_ENV"
1454+
1455+ echo "⏳ Waiting for server to be ready..."
14201456 for i in {1..60}; do
14211457 if curl -sf http://localhost:8080/health > /dev/null 2>&1; then
1422- echo "✅ Server is ready"
1458+ echo "✅ Server is ready (${i}s) "
14231459 exit 0
14241460 fi
1425- if ! kill -0 "$SERVER_PID" 2>/dev/null; then
1426- echo "❌ Server process exited early"
1427- cat sdk-tests-server.log || true
1461+ if ! docker inspect kalamdb-integration-test \
1462+ --format='{{.State.Running}}' 2>/dev/null | grep -q true; then
1463+ echo "❌ Container stopped unexpectedly"
1464+ docker logs kalamdb-integration-test || true
14281465 exit 1
14291466 fi
1467+ echo " Waiting... ($i/60)"
14301468 sleep 1
14311469 done
14321470
14331471 echo "❌ Timed out waiting for server"
1434- cat sdk-tests-server.log || true
1472+ docker logs kalamdb-integration-test || true
14351473 exit 1
14361474
1475+ - name : Run smoke tests
1476+ id : smoke_tests
1477+ shell : bash
1478+ env :
1479+ KALAMDB_SERVER_URL : " http://localhost:8080"
1480+ KALAMDB_ROOT_PASSWORD : " kalamdb123"
1481+ run : |
1482+ set -euo pipefail
1483+ cd cli
1484+ if cargo test --features e2e-tests --test smoke 2>&1 | tee ../smoke-test-output.txt; then
1485+ echo "smoke_tests_passed=true" >> "$GITHUB_OUTPUT"
1486+ echo "✅ All smoke tests passed!"
1487+ else
1488+ echo "smoke_tests_passed=false" >> "$GITHUB_OUTPUT"
1489+ echo "⚠️ Some smoke tests failed"
1490+ fi
1491+
14371492 - name : Run TypeScript SDK tests
1493+ id : ts_tests
14381494 shell : bash
14391495 working-directory : link/sdks/typescript
1496+ env :
1497+ KALAMDB_URL : " http://localhost:8080"
1498+ KALAMDB_USER : " admin"
1499+ KALAMDB_PASSWORD : " kalamdb123"
14401500 run : |
14411501 set -euo pipefail
14421502 chmod +x ./test.sh
14431503 ./test.sh
14441504
14451505 - name : Run Dart SDK tests
1506+ id : dart_tests
14461507 shell : bash
14471508 working-directory : link/sdks/dart
1509+ env :
1510+ KALAM_URL : " http://localhost:8080"
1511+ KALAM_USER : " admin"
1512+ KALAM_PASS : " kalamdb123"
14481513 run : |
14491514 set -euo pipefail
14501515 chmod +x ./test.sh
14511516 ./test.sh
14521517
1453- - name : Stop KalamDB server
1518+ - name : Stop Docker container
14541519 if : always()
14551520 shell : bash
14561521 run : |
1457- set -euo pipefail
1458- if [[ -n "${SERVER_PID:-}" ]] && kill -0 "$SERVER_PID" 2>/dev/null; then
1459- kill "$SERVER_PID" || true
1460- fi
1522+ docker logs kalamdb-integration-test 2>/dev/null > docker-server.log || true
1523+ docker stop kalamdb-integration-test 2>/dev/null || true
1524+ docker rm kalamdb-integration-test 2>/dev/null || true
14611525
1462- - name : Upload SDK test server log
1526+ - name : Upload test results
14631527 if : always()
14641528 uses : actions/upload-artifact@v4
14651529 with :
1466- name : sdk-tests-server-log
1467- path : sdk-tests-server.log
1530+ name : integration-test-results
1531+ path : |
1532+ smoke-test-output.txt
1533+ docker-server.log
14681534 if-no-files-found : ignore
14691535
1536+ - name : Report test status
1537+ if : always()
1538+ shell : bash
1539+ run : |
1540+ if [[ "${{ steps.smoke_tests.outputs.smoke_tests_passed }}" == "true" ]]; then
1541+ echo "::notice::✅ Smoke tests passed"
1542+ else
1543+ echo "::warning::⚠️ Some smoke tests failed — check integration-test-results artifact"
1544+ fi
1545+
14701546 # ═══════════════════════════════════════════════════════════════════════════
14711547 # NPM PUBLISH - Publish TypeScript SDK to npm registry
14721548 # ═══════════════════════════════════════════════════════════════════════════
14731549 publish_npm :
14741550 name : Publish TypeScript SDK to npm
14751551 runs-on : ubuntu-latest
1476- needs : [read_version, sdk_tests ]
1552+ needs : [read_version, integration_tests ]
14771553 if : ${{ github.event_name == 'push' || github.event.inputs.npm_publish == 'true' }}
14781554
14791555 steps :
@@ -1568,7 +1644,7 @@ jobs:
15681644 publish_dart :
15691645 name : Publish Dart SDK to pub.dev
15701646 runs-on : ubuntu-latest
1571- needs : [read_version, sdk_tests ]
1647+ needs : [read_version, integration_tests ]
15721648 if : ${{ github.event_name == 'push' || github.event.inputs.dart_publish == 'true' }}
15731649
15741650 steps :
0 commit comments