fix: code review sync #202
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: Test (Integration) | |
| on: | |
| pull_request: | |
| types: [synchronize, opened, reopened] | |
| push: | |
| branches: | |
| - main | |
| - production | |
| permissions: | |
| contents: read | |
| jobs: | |
| integration-test: | |
| runs-on: ubuntu-latest | |
| services: | |
| postgres: | |
| image: postgres:16 | |
| env: | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: postgres | |
| POSTGRES_DB: sweetr_test | |
| ports: | |
| - 5433:5432 | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 2s | |
| --health-timeout 5s | |
| --health-retries 10 | |
| dragonfly: | |
| image: docker.dragonflydb.io/dragonflydb/dragonfly | |
| ports: | |
| - 6379:6379 | |
| options: >- | |
| --ulimit memlock=-1 | |
| --health-cmd "redis-cli ping | grep -q PONG" | |
| --health-interval 2s | |
| --health-timeout 5s | |
| --health-retries 10 | |
| env: | |
| SUPERUSER_DATABASE_URL: postgresql://postgres:postgres@localhost:5433/sweetr_test | |
| DATABASE_URL: postgresql://app_user:app_user@localhost:5433/sweetr_test | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Create app_user | |
| run: | | |
| PGPASSWORD=postgres psql -h localhost -p 5433 -U postgres -d sweetr_test <<-EOSQL | |
| CREATE USER app_user WITH PASSWORD 'app_user'; | |
| GRANT CONNECT ON DATABASE sweetr_test TO app_user; | |
| GRANT USAGE ON SCHEMA public TO app_user; | |
| REVOKE CREATE ON SCHEMA public FROM app_user; | |
| REVOKE CREATE ON SCHEMA public FROM PUBLIC; | |
| GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA public TO app_user; | |
| GRANT USAGE, SELECT ON ALL SEQUENCES IN SCHEMA public TO app_user; | |
| ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT, INSERT, UPDATE, DELETE ON TABLES TO app_user; | |
| ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT USAGE, SELECT ON SEQUENCES TO app_user; | |
| EOSQL | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build | |
| run: npm run build | |
| - name: Run Integration Tests | |
| run: npm run test:integration | |
| working-directory: apps/api | |
| env: | |
| DATABASE_URL: ${{ env.DATABASE_URL }} | |
| SUPERUSER_DATABASE_URL: ${{ env.SUPERUSER_DATABASE_URL }} | |
| USE_SELF_SIGNED_SSL: false | |
| JWT_SECRET: test-secret | |
| BULLMQ_ENABLED: false | |
| REDIS_CONNECTION_STRING: redis://localhost:6379 | |
| FRONTEND_URL: http://localhost:5173 | |
| GITHUB_CLIENT_SECRET: test | |
| GITHUB_CLIENT_ID: test | |
| GITHUB_APP_HANDLE: test | |
| GITHUB_APP_ID: test | |
| GITHUB_APP_PRIVATE_KEY: test | |
| GITHUB_WEBHOOK_SECRET: test |