Merge pull request #537 from databuddy-analytics/staging #994
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: CI | |
| on: | |
| push: | |
| branches: [main] | |
| paths-ignore: | |
| - "**.md" | |
| - "docs/**" | |
| - ".github/FUNDING.yml" | |
| pull_request: | |
| branches: [main, staging] | |
| paths-ignore: | |
| - "**.md" | |
| - "docs/**" | |
| - ".github/FUNDING.yml" | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ci-${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name || github.repository }}-${{ github.head_ref || github.ref_name }} | |
| cancel-in-progress: true | |
| jobs: | |
| lint: | |
| name: Lint | |
| runs-on: blacksmith-2vcpu-ubuntu-2404 | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7 | |
| - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2 | |
| with: | |
| bun-version: "1.3.14" | |
| - uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5 | |
| with: | |
| path: ~/.bun/install/cache | |
| key: ${{ runner.os }}-bun-${{ hashFiles('bun.lock') }} | |
| restore-keys: ${{ runner.os }}-bun- | |
| - run: bun install --frozen-lockfile --ignore-scripts | |
| - run: bun run lint | |
| typecheck: | |
| name: Check Types | |
| runs-on: blacksmith-4vcpu-ubuntu-2404 | |
| timeout-minutes: 15 | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7 | |
| - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2 | |
| with: | |
| bun-version: "1.3.14" | |
| - uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5 | |
| with: | |
| path: ~/.bun/install/cache | |
| key: ${{ runner.os }}-bun-${{ hashFiles('bun.lock') }} | |
| restore-keys: ${{ runner.os }}-bun- | |
| - run: bun install --frozen-lockfile --ignore-scripts | |
| - run: bun run --cwd apps/docs postinstall | |
| - run: bun run check-types | |
| test: | |
| name: Test | |
| runs-on: blacksmith-4vcpu-ubuntu-2404 | |
| timeout-minutes: 15 | |
| env: | |
| TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} | |
| TURBO_TEAM: ${{ vars.TURBO_TEAM }} | |
| DATABASE_URL: postgresql://postgres:postgres@localhost:5432/databuddy_test | |
| REDIS_URL: redis://localhost:6379 | |
| REDIS_HOST: localhost | |
| REDIS_PORT: 6379 | |
| REDPANDA_BROKER: localhost:9092 | |
| REDPANDA_USER: test-redpanda-user | |
| REDPANDA_PASSWORD: test-redpanda-password | |
| DATABUDDY_API_KEY: test-databuddy-api-key | |
| DATABUDDY_WEBSITE_ID: test-databuddy-website-id | |
| BETTER_AUTH_SECRET: test-auth-secret-for-ci-testing-only | |
| BETTER_AUTH_URL: http://localhost:3000 | |
| 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 | |
| RESEND_API_KEY: test-resend-api-key | |
| RECAPTCHA_SECRET_KEY: test-recaptcha-secret-key | |
| VERCEL_CLIENT_ID: test-vercel-client-id | |
| VERCEL_CLIENT_SECRET: test-vercel-client-secret | |
| AUTUMN_SECRET_KEY: test-autumn-secret-key | |
| NEXT_PUBLIC_API_URL: http://localhost:3000/api | |
| EMAIL_API_KEY: test-email-api-key | |
| IP_HASH_SALT: test-ip-hash-salt | |
| services: | |
| redis: | |
| image: redis:7-alpine | |
| ports: | |
| - 6379:6379 | |
| options: >- | |
| --health-cmd "redis-cli ping" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| postgres: | |
| image: postgres:17-alpine | |
| env: | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: postgres | |
| POSTGRES_DB: databuddy_test | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd "pg_isready -U postgres" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7 | |
| with: | |
| fetch-depth: 2 | |
| - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2 | |
| with: | |
| bun-version: "1.3.14" | |
| - uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5 | |
| with: | |
| path: ~/.bun/install/cache | |
| key: ${{ runner.os }}-bun-${{ hashFiles('bun.lock') }} | |
| restore-keys: ${{ runner.os }}-bun- | |
| - uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5 | |
| with: | |
| path: .turbo | |
| key: ${{ runner.os }}-turbo-${{ github.sha }} | |
| restore-keys: ${{ runner.os }}-turbo- | |
| - run: bun install --frozen-lockfile --ignore-scripts | |
| - name: Push test schema | |
| run: cd packages/db && bunx drizzle-kit push | |
| - name: Test | |
| env: | |
| NODE_ENV: test | |
| run: bun run test | |
| - name: Insights integration | |
| env: | |
| NODE_ENV: test | |
| INSIGHTS_INTEGRATION_TESTS: "true" | |
| BULLMQ_REDIS_URL: redis://localhost:6379/4 | |
| run: bun run --cwd apps/insights test:integration | |
| - name: Uptime router integration | |
| env: | |
| NODE_ENV: test | |
| UPTIME_ROUTER_INTEGRATION: "true" | |
| BULLMQ_REDIS_URL: redis://localhost:6379/3 | |
| run: cd apps/api && bun test src/integration/uptime-handlers.test.ts |