feat: models in infra #33
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: Tests | |
| on: | |
| push: | |
| branches: [main, staging] | |
| pull_request: | |
| branches: [main, staging] | |
| jobs: | |
| test: | |
| name: Run Tests | |
| runs-on: ubuntu-latest | |
| services: | |
| postgres: | |
| image: postgres:16 | |
| env: | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: postgres | |
| POSTGRES_DB: databuddy_test | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| redis: | |
| image: redis:7-alpine | |
| ports: | |
| - 6379:6379 | |
| options: >- | |
| --health-cmd "redis-cli ping" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| clickhouse: | |
| image: clickhouse/clickhouse-server:latest | |
| ports: | |
| - 8123:8123 | |
| - 9000:9000 | |
| env: | |
| CLICKHOUSE_DB: databuddy_test | |
| options: >- | |
| --health-cmd "clickhouse-client --query 'SELECT 1'" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - name: Install dependencies | |
| run: bun install | |
| - name: Run tests | |
| env: | |
| # Database URLs | |
| DATABASE_URL: postgresql://postgres:postgres@localhost:5432/databuddy_test | |
| POSTGRES_URL: postgresql://postgres:postgres@localhost:5432/databuddy_test | |
| # Redis URL | |
| REDIS_URL: redis://localhost:6379 | |
| REDIS_HOST: localhost | |
| REDIS_PORT: 6379 | |
| # ClickHouse URLs | |
| CLICKHOUSE_URL: http://localhost:8123 | |
| CLICKHOUSE_HOST: localhost | |
| CLICKHOUSE_PORT: 8123 | |
| CLICKHOUSE_DATABASE: databuddy_test | |
| # Test environment | |
| NODE_ENV: test | |
| # Better Auth secrets (use dummy values for tests) | |
| BETTER_AUTH_SECRET: test-auth-secret-for-ci-testing-only | |
| BETTER_AUTH_URL: http://localhost:3000 | |
| # OAuth providers (use dummy values for tests) | |
| GITHUB_CLIENT_ID: test-github-client-id | |
| GITHUB_CLIENT_SECRET: test-github-client-secret | |
| GOOGLE_CLIENT_ID: test-google-client-id | |
| GOOGLE_CLIENT_SECRET: test-google-client-secret | |
| # External services (use dummy values for tests) | |
| RESEND_API_KEY: test-resend-api-key | |
| VERCEL_CLIENT_ID: test-vercel-client-id | |
| VERCEL_CLIENT_SECRET: test-vercel-client-secret | |
| # Dashboard-specific (use dummy values for tests) | |
| AUTUMN_SECRET_KEY: test-autumn-secret-key | |
| NEXT_PUBLIC_API_URL: http://localhost:3000/api | |
| # Other API keys (use dummy values for tests) | |
| EMAIL_API_KEY: test-email-api-key | |
| IP_HASH_SALT: test-ip-hash-salt | |
| run: bun test | |
| - name: Upload coverage reports | |
| if: always() | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| files: ./coverage/coverage-final.json | |
| fail_ci_if_error: false | |
| token: ${{ secrets.CODECOV_TOKEN }} | |