Skip to content

PR E2E Tests — stg1 (firefox,chrome,safari,edge) #256

PR E2E Tests — stg1 (firefox,chrome,safari,edge)

PR E2E Tests — stg1 (firefox,chrome,safari,edge) #256

Workflow file for this run

name: PR E2E Tests (Required)
on:
pull_request:
branches: [main]
types: [labeled, synchronize]
paths:
- 'app/**'
- 'components/**'
- 'hooks/**'
- 'lib/**'
- 'store/**'
- 'styles/**'
- 'public/**'
- 'e2e/**'
- 'src-tauri/**'
- '__tests__/**'
- 'package.json'
- 'pnpm-lock.yaml'
- 'next.config.*'
- 'tsconfig*.json'
- 'tailwind.config.*'
- 'postcss.config.*'
- 'vitest.config.*'
- 'playwright.config.*'
run-name: 'PR E2E Tests — stg1 (firefox,chrome,safari,edge)'
permissions:
contents: read
concurrency:
group: pr-e2e-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
# ============================================================
# GATE — only run when the `run-tests` label is present
# ============================================================
gate:
if: |
contains(github.event.pull_request.labels.*.name, 'run-tests') &&
github.event.pull_request.head.repo.full_name == github.repository
runs-on: iblai-stg-runner
steps:
- run: echo "run-tests label detected — proceeding"
# ============================================================
# BUILD APP IMAGE
# ============================================================
build-app-image:
needs: gate
uses: ./.github/workflows/reusable-pr-docker-build.yml
secrets: inherit
with:
dockerfile-path: Dockerfile
build-context: .
image-name: iblai-skills-spa-pro
registry-type: ocir
event-name: pull_request
pr-number: ${{ github.event.pull_request.number }}
# ============================================================
# BUILD PLAYWRIGHT IMAGE
# ============================================================
build-playwright-image:
needs: gate
uses: ./.github/workflows/reusable-pr-docker-build.yml
secrets: inherit
with:
dockerfile-path: e2e/Dockerfile
build-context: .
image-name: ibl-skills-playwright
registry-type: ocir
image-tag: pr-${{ github.event.pull_request.number }}-${{ github.sha }}
event-name: pull_request
pr-number: ${{ github.event.pull_request.number }}
# ============================================================
# RUN PLAYWRIGHT TESTS ON OCI
# ============================================================
run-tests:
needs: [build-app-image, build-playwright-image]
uses: ./.github/workflows/reusable-oci-test-runner.yml
secrets: inherit
with:
domain-number: '1'
app-type: skills
playwright-image: ${{ needs.build-playwright-image.outputs.image-uri }}
max-wait: 10800
total-shards: 1
run-type: main
browsers: 'chrome'
workers: '3'
registry-type: 'ocir'
ec2-host: '32.196.111.179'
ec2-user: 'ubuntu'
runs-on: iblai-stg-runner
ec2-commands: >-
cd /ibl/app/ibl-spa/skills &&
sed -i 's|image: .*|image: ${{ needs.build-app-image.outputs.image-uri }}|' docker-compose.yml &&
docker compose down &&
docker compose up -d
# ============================================================
# SUMMARY
# ============================================================
summary:
needs: [build-playwright-image, build-app-image, run-tests]
if: always()
runs-on: ubuntu-latest
steps:
- name: Results
run: |
echo "# PR E2E Test Results" >> $GITHUB_STEP_SUMMARY
echo "| Step | Result |" >> $GITHUB_STEP_SUMMARY
echo "|------|--------|" >> $GITHUB_STEP_SUMMARY
echo "| Build Playwright | ${{ needs.build-playwright-image.result }} |" >> $GITHUB_STEP_SUMMARY
echo "| Run Tests (firefox,chrome,safari,edge) | ${{ needs.run-tests.result }} |" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "Mode: skip-infra-launch — tests ran against the pre-existing stg1 instance." >> $GITHUB_STEP_SUMMARY
- name: Fail if tests did not pass
if: needs.run-tests.result != 'success'
run: exit 1