name: Test on: push: branches: [main] pull_request: branches: [main] jobs: vitest: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: 22 cache: npm - run: npm ci - run: npm run test:run playwright: runs-on: ubuntu-latest needs: vitest services: mongo: image: mongo:7 ports: - 27017:27017 env: MONGODB_URI: mongodb://localhost:27017/ghostguild-test JWT_SECRET: ci-test-jwt-secret NUXT_PUBLIC_COMING_SOON: 'false' NODE_ENV: development ALLOW_DEV_TEST_ENDPOINTS: 'true' steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: 22 cache: npm - run: npm ci - run: npx playwright install --with-deps chromium - run: npm run build - name: Start server run: node .output/server/index.mjs & env: PORT: 3000 - name: Wait for server run: timeout 30 sh -c 'until curl -sf http://localhost:3000; do sleep 1; done' - run: npx playwright test --ignore-snapshots - uses: actions/upload-artifact@v4 if: failure() with: name: playwright-report path: | playwright-report/ e2e/test-results/ retention-days: 7 notify: name: Notify on failure runs-on: ubuntu-latest needs: [vitest, playwright] if: failure() steps: - name: Post to Slack run: | curl -s -X POST "${{ secrets.SLACK_WEBHOOK_URL }}" \ -H 'Content-type: application/json' \ --data "{\"text\":\":x: *Ghost Guild CI failed* on \`${{ github.ref_name }}\`\nCommit: ${{ github.sha }}\n${{ github.server_url }}/${{ github.repository }}/actions\"}" visual: runs-on: ubuntu-latest needs: vitest continue-on-error: true services: mongo: image: mongo:7 ports: - 27017:27017 env: MONGODB_URI: mongodb://localhost:27017/ghostguild-test JWT_SECRET: ci-test-jwt-secret NUXT_PUBLIC_COMING_SOON: 'false' NODE_ENV: development ALLOW_DEV_TEST_ENDPOINTS: 'true' steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: 22 cache: npm - run: npm ci - run: npx playwright install --with-deps chromium - run: npm run build - name: Start server run: node .output/server/index.mjs & env: PORT: 3000 - name: Wait for server run: timeout 30 sh -c 'until curl -sf http://localhost:3000; do sleep 1; done' - run: npx playwright test e2e/visual/ - uses: actions/upload-artifact@v4 if: failure() with: name: visual-diffs path: e2e/test-results/ retention-days: 7