fix: register plugin definition before installation to avoid FK viola… #67
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 | |
| pull_request: | |
| workflow_dispatch: | |
| concurrency: | |
| group: ci-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| static: | |
| name: Static Gateway | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| filter: tree:0 | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v5 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 24 | |
| cache: pnpm | |
| - name: Install Dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Codegen Check | |
| run: MOON_OUTPUT_STYLE=buffer-only-failure pnpm moon run root:codegen-check --quiet | |
| - name: Format Check (affected) | |
| run: MOON_OUTPUT_STYLE=buffer-only-failure pnpm moon ci :fmt-check --quiet | |
| - name: Typecheck (affected) | |
| run: MOON_OUTPUT_STYLE=buffer-only-failure pnpm moon ci :typecheck --quiet | |
| - name: Lint (affected) | |
| run: MOON_OUTPUT_STYLE=buffer-only-failure pnpm moon ci :lint --quiet | |
| unit-tests: | |
| name: Unit Tests | |
| needs: static | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| filter: tree:0 | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v5 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 24 | |
| cache: pnpm | |
| - name: Install Dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Run Unit Tests (affected) | |
| run: MOON_OUTPUT_STYLE=buffer-only-failure pnpm moon ci :test-unit --quiet | |
| integration-tests: | |
| name: Integration Tests | |
| needs: static | |
| runs-on: ubuntu-latest | |
| services: | |
| postgres: | |
| image: pgvector/pgvector:pg18 | |
| env: | |
| POSTGRES_USER: user | |
| POSTGRES_PASSWORD: pass | |
| POSTGRES_DB: cat | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd "pg_isready -U user -d cat" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| filter: tree:0 | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v5 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 24 | |
| cache: pnpm | |
| - name: Install Dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Run Integration Tests (affected) | |
| env: | |
| TEST_DATABASE_URL: "postgres://user:pass@localhost:5432/cat" | |
| run: MOON_OUTPUT_STYLE=buffer-only-failure pnpm moon ci :test-integration --quiet | |
| e2e-tests: | |
| name: E2E Tests | |
| needs: static | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| services: | |
| redis: | |
| image: redis | |
| ports: | |
| - 6379:6379 | |
| options: >- | |
| --health-cmd "redis-cli ping" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| postgres: | |
| image: pgvector/pgvector:pg18 | |
| env: | |
| POSTGRES_USER: user | |
| POSTGRES_PASSWORD: pass | |
| POSTGRES_DB: cat | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd "pg_isready -U user -d cat" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| filter: tree:0 | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v5 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 24 | |
| cache: pnpm | |
| - name: Install Dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Install Playwright Browsers | |
| run: pnpm exec playwright install --with-deps | |
| - name: Build & Load Plugins | |
| run: | | |
| pnpm build-plugins | |
| pnpm load-plugins | |
| - name: Build App | |
| run: MOON_OUTPUT_STYLE=buffer-only-failure pnpm moon run app:build --quiet | |
| env: | |
| DATABASE_URL: postgresql://user:pass@localhost:5432/cat?schema=public | |
| REDIS_URL: redis://localhost:6379 | |
| - name: Run App | |
| working-directory: apps/app | |
| run: | | |
| pnpm exec tsx scripts/copy-drizzle.ts | |
| NODE_ENV=production node dist/server/index.mjs > ../../app.log 2>&1 & | |
| env: | |
| PORT: 3000 | |
| DATABASE_URL: postgresql://user:pass@localhost:5432/cat?schema=public | |
| REDIS_URL: redis://localhost:6379 | |
| - name: Wait for Healthcheck | |
| timeout-minutes: 1 | |
| run: | | |
| echo "Waiting for service to be healthy..." | |
| RETRIES=30 | |
| until curl --output /dev/null --silent --head --fail http://localhost:3000/_health; do | |
| printf '.' | |
| sleep 2 | |
| RETRIES=$((RETRIES-1)) | |
| if [ $RETRIES -le 0 ]; then | |
| echo "Timeout waiting for service!" | |
| echo "================ APPLICATION LOGS ================" | |
| cat app.log | |
| echo "==================================================" | |
| exit 1 | |
| fi | |
| done | |
| echo "Server is up!" | |
| - name: Run E2E Tests | |
| run: MOON_OUTPUT_STYLE=buffer-only-failure pnpm moon run app-e2e:test-e2e --quiet | |
| env: | |
| PORT: 3000 | |
| DATABASE_URL: postgresql://user:pass@localhost:5432/cat?schema=public | |
| REDIS_URL: redis://localhost:6379 | |
| E2E_SKIP_DB_CHECK: "true" | |
| - name: Upload Playwright Report | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: playwright-report | |
| path: apps/app-e2e/playwright-report/ | |
| retention-days: 30 |