Integration Tests #63
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: Integration Tests | |
| on: | |
| pull_request: | |
| branches: [ main, master ] | |
| push: | |
| branches: [ main, master ] | |
| schedule: | |
| # Run every Tuesday at 01:00 Beijing time (UTC+8) | |
| # Monday 17:00 UTC = Tuesday 01:00 CST | |
| - cron: '0 17 * * 1' | |
| workflow_dispatch: | |
| inputs: | |
| greptimedb_version: | |
| description: 'GreptimeDB Docker image tag' | |
| required: false | |
| default: 'latest' | |
| jobs: | |
| test: | |
| name: Run Integration Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| cache: 'maven' | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.8' | |
| - name: Set up uv | |
| uses: astral-sh/setup-uv@v3 | |
| with: | |
| version: "latest" | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.24' | |
| cache-dependency-path: go-tests/go.sum | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18' | |
| - name: Install Python dependencies | |
| run: | | |
| cd python-tests | |
| uv sync | |
| uv run python -c "import mysql.connector; print(f'mysql-connector-python {mysql.connector.__version__}')" | |
| uv run python -c "import psycopg2; print(f'psycopg2 {psycopg2.__version__}')" | |
| - name: Install Go dependencies | |
| run: | | |
| cd go-tests | |
| go mod download | |
| go mod verify | |
| go version | |
| - name: Start GreptimeDB | |
| run: | | |
| docker run -d \ | |
| -p 127.0.0.1:4000-4003:4000-4003 \ | |
| -v "$(pwd)/greptimedb_data:/greptimedb_data" \ | |
| --name greptime \ | |
| greptime/greptimedb:${{ inputs.greptimedb_version || 'latest' }} standalone start \ | |
| --http-addr 0.0.0.0:4000 \ | |
| --rpc-addr 0.0.0.0:4001 \ | |
| --mysql-addr 0.0.0.0:4002 \ | |
| --postgres-addr 0.0.0.0:4003 \ | |
| --user-provider=static_user_provider:cmd:greptime_user=greptime_pwd | |
| docker ps | |
| - name: Wait for GreptimeDB to be ready | |
| run: | | |
| echo "Waiting for GreptimeDB..." | |
| for i in {1..60}; do | |
| if curl -sf http://localhost:4000/health > /dev/null; then | |
| echo "✅ GreptimeDB is ready" | |
| exit 0 | |
| fi | |
| sleep 2 | |
| done | |
| echo "❌ GreptimeDB failed to start" | |
| docker logs greptime | |
| exit 1 | |
| - name: Run integration tests | |
| run: ./run_tests.sh | |
| env: | |
| DB_NAME: test_db | |
| MYSQL_HOST: 127.0.0.1 | |
| MYSQL_PORT: 4002 | |
| POSTGRES_HOST: 127.0.0.1 | |
| POSTGRES_PORT: 4003 | |
| HTTP_HOST: 127.0.0.1 | |
| HTTP_PORT: 4000 | |
| GREPTIME_USERNAME: greptime_user | |
| GREPTIME_PASSWORD: greptime_pwd | |
| - name: Collect logs on failure | |
| if: failure() | |
| run: docker logs greptime || true | |
| - name: Upload test logs on failure | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-logs | |
| path: | | |
| java-tests/target/surefire-reports/ | |
| python-tests/.pytest_cache/ | |
| go-tests/*.log | |
| otel-tests/nodejs/npm-debug.log | |
| **/test-output/ | |
| retention-days: 7 | |
| - name: Cleanup | |
| if: always() | |
| run: | | |
| docker stop greptime || true | |
| docker rm greptime || true |