name: CI Merge Queue on: merge_group: pull_request: types: [labeled, synchronize, opened, reopened] permissions: contents: read concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} jobs: e2e-test: if: > github.event_name == 'merge_group' || (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'run-merge-queue')) runs-on: ubuntu-latest-8-cores timeout-minutes: 30 env: NODE_OPTIONS: "--max-old-space-size=10240" services: postgres: image: postgres:18 env: POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres ports: - 5432:5432 options: >- --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 redis: image: redis ports: - 6379:6379 steps: - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 with: fetch-depth: 10 - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 with: node-version: lts/* - name: Install dependencies uses: ./.github/actions/yarn-install - name: Restore Nx build cache uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 (restore) with: key: v4-e2e-build-${{ github.ref_name }}-${{ github.sha }} restore-keys: | v4-e2e-build-${{ github.ref_name }}- v4-e2e-build-main- path: | .nx node_modules/.cache packages/*/node_modules/.cache - name: Build twenty-shared run: npx nx build twenty-shared - name: Install Playwright Browsers run: npx nx setup twenty-e2e-testing - name: Setup environment files run: | cp packages/twenty-front/.env.example packages/twenty-front/.env npx nx reset:env:e2e-testing-server twenty-server - name: Build frontend run: NODE_ENV=production npx nx build twenty-front - name: Build server run: npx nx build twenty-server - name: Save Nx build cache if: always() uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 (save) with: key: v4-e2e-build-${{ github.ref_name }}-${{ github.sha }} path: | .nx node_modules/.cache packages/*/node_modules/.cache - name: Create and setup database run: | PGPASSWORD=postgres psql -h localhost -p 5432 -U postgres -d postgres -c 'CREATE DATABASE "default";' PGPASSWORD=postgres psql -h localhost -p 5432 -U postgres -d postgres -c 'CREATE DATABASE "test";' npx nx run twenty-server:database:reset - name: Start server run: | npx nx start twenty-server & echo "Waiting for server to be ready..." timeout 60 bash -c 'until curl -s http://localhost:3000/health; do sleep 2; done' - name: Start frontend run: | npm_config_yes=true npx serve -s packages/twenty-front/build -l 3001 & echo "Waiting for frontend to be ready..." timeout 60 bash -c 'until curl -s http://localhost:3001; do sleep 2; done' - name: Start worker run: | npx nx run twenty-server:worker & echo "Worker started" - name: Run Playwright tests run: npx nx test twenty-e2e-testing - name: Upload Playwright results if: always() uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 with: name: playwright-results path: | packages/twenty-e2e-testing/run_results/ packages/twenty-e2e-testing/test-results/ retention-days: 7 ci-merge-queue-status-check: if: always() && !cancelled() timeout-minutes: 5 runs-on: ubuntu-latest needs: [e2e-test] steps: - name: Fail job if any needs failed if: contains(needs.*.result, 'failure') run: exit 1