diff --git a/.gitea/workflows/ui-regression.yml b/.gitea/workflows/ui-regression.yml new file mode 100644 index 0000000..e09241e --- /dev/null +++ b/.gitea/workflows/ui-regression.yml @@ -0,0 +1,167 @@ +name: ui-regression + +on: + push: + branches: + - main + - master + paths: + - admin/** + - frontend/** + - playwright-smoke/** + - .gitea/workflows/ui-regression.yml + pull_request: + paths: + - admin/** + - frontend/** + - playwright-smoke/** + - .gitea/workflows/ui-regression.yml + workflow_dispatch: + +jobs: + playwright-regression: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: 10 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 22 + cache: pnpm + cache-dependency-path: | + frontend/pnpm-lock.yaml + admin/pnpm-lock.yaml + playwright-smoke/pnpm-lock.yaml + + - name: Install frontend deps + working-directory: frontend + run: pnpm install --frozen-lockfile + + - name: Install admin deps + working-directory: admin + run: pnpm install --frozen-lockfile + + - name: Install Playwright deps + working-directory: playwright-smoke + run: pnpm install --frozen-lockfile + + - name: Install Playwright browsers + working-directory: playwright-smoke + run: pnpm exec playwright install --with-deps chromium + + - name: Typecheck Playwright suite + working-directory: playwright-smoke + run: pnpm exec tsc -p tsconfig.json --noEmit + + - name: Prepare Playwright artifact folders + run: | + rm -rf playwright-smoke/.artifacts + mkdir -p playwright-smoke/.artifacts/frontend + mkdir -p playwright-smoke/.artifacts/admin + + - name: Run frontend UI regression suite + id: ui_frontend + working-directory: playwright-smoke + continue-on-error: true + run: pnpm test:frontend + + - name: Collect frontend Playwright artifacts + if: always() + run: | + if [ -d playwright-smoke/playwright-report ]; then + cp -R playwright-smoke/playwright-report playwright-smoke/.artifacts/frontend/playwright-report + fi + if [ -d playwright-smoke/test-results ]; then + cp -R playwright-smoke/test-results playwright-smoke/.artifacts/frontend/test-results + fi + rm -rf playwright-smoke/playwright-report playwright-smoke/test-results + + - name: Run admin UI regression suite + id: ui_admin + working-directory: playwright-smoke + continue-on-error: true + run: pnpm test:admin + + - name: Collect admin Playwright artifacts + if: always() + run: | + if [ -d playwright-smoke/playwright-report ]; then + cp -R playwright-smoke/playwright-report playwright-smoke/.artifacts/admin/playwright-report + fi + if [ -d playwright-smoke/test-results ]; then + cp -R playwright-smoke/test-results playwright-smoke/.artifacts/admin/test-results + fi + + - name: Upload frontend HTML report + if: always() + uses: actions/upload-artifact@v4 + with: + name: playwright-html-report-frontend + path: playwright-smoke/.artifacts/frontend/playwright-report + retention-days: 14 + if-no-files-found: ignore + + - name: Upload admin HTML report + if: always() + uses: actions/upload-artifact@v4 + with: + name: playwright-html-report-admin + path: playwright-smoke/.artifacts/admin/playwright-report + retention-days: 14 + if-no-files-found: ignore + + - name: Upload frontend raw results + if: always() + uses: actions/upload-artifact@v4 + with: + name: playwright-raw-results-frontend + path: playwright-smoke/.artifacts/frontend/test-results + retention-days: 14 + if-no-files-found: ignore + + - name: Upload admin raw results + if: always() + uses: actions/upload-artifact@v4 + with: + name: playwright-raw-results-admin + path: playwright-smoke/.artifacts/admin/test-results + retention-days: 14 + if-no-files-found: ignore + + - name: Upload frontend failure screenshots / videos / traces + if: steps.ui_frontend.outcome != 'success' + uses: actions/upload-artifact@v4 + with: + name: playwright-failure-artifacts-frontend + path: | + playwright-smoke/.artifacts/frontend/test-results/**/*.png + playwright-smoke/.artifacts/frontend/test-results/**/*.webm + playwright-smoke/.artifacts/frontend/test-results/**/*.zip + playwright-smoke/.artifacts/frontend/test-results/**/error-context.md + retention-days: 21 + if-no-files-found: ignore + + - name: Upload admin failure screenshots / videos / traces + if: steps.ui_admin.outcome != 'success' + uses: actions/upload-artifact@v4 + with: + name: playwright-failure-artifacts-admin + path: | + playwright-smoke/.artifacts/admin/test-results/**/*.png + playwright-smoke/.artifacts/admin/test-results/**/*.webm + playwright-smoke/.artifacts/admin/test-results/**/*.zip + playwright-smoke/.artifacts/admin/test-results/**/error-context.md + retention-days: 21 + if-no-files-found: ignore + + - name: Mark workflow failed when any suite failed + if: steps.ui_frontend.outcome != 'success' || steps.ui_admin.outcome != 'success' + run: exit 1