name: CI on: push: branches: - main - dev/* pull_request: branches: - main - dev/* jobs: lint: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: pnpm/action-setup@v2 - uses: actions/setup-node@v3 with: node-version: 22.x cache: pnpm - name: Install run: pnpm install - name: Lint run: pnpm run lint build: runs-on: ${{ matrix.os }} strategy: matrix: node-version: [22.x] os: [ubuntu-latest, macos-latest, windows-latest] fail-fast: false steps: - uses: actions/checkout@v3 - name: Install pnpm uses: pnpm/action-setup@v2 - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} cache: pnpm - name: Install run: pnpm install - run: npm run build codecov: runs-on: macos-latest steps: - uses: actions/checkout@v3 - uses: pnpm/action-setup@v2 - uses: actions/setup-node@v3 with: node-version: 22.x cache: pnpm - name: Install run: pnpm install - name: Install Playwright Browsers run: npx playwright install --with-deps chromium - name: Build run: npm run build - name: Test run: npm run coverage - name: Upload coverage to Codecov uses: codecov/codecov-action@v4 with: token: ${{secrets.CODECOV_TOKEN}} fail_ci_if_error: true flags: unittests e2e: runs-on: macos-latest strategy: matrix: node-version: [22.x] shard: [1/4, 2/4, 3/4, 4/4] fail-fast: false steps: - uses: actions/checkout@v3 with: lfs: true - name: Install pnpm uses: pnpm/action-setup@v2 - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} cache: pnpm - name: Install dependencies run: pnpm install --frozen-lockfile - name: Get installed Playwright version id: playwright-version run: echo "PLAYWRIGHT_VERSION=$(node -e "console.log(require('./package.json').devDependencies['@playwright/test'])")" >> $GITHUB_ENV - name: Cache Playwright browsers uses: actions/cache@v3 id: playwright-cache with: path: | ~/.cache/ms-playwright key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }} - name: Install Playwright Browsers if: steps.playwright-cache.outputs.cache-hit != 'true' timeout-minutes: 15 run: | echo "๐Ÿ”ง Installing Playwright chromium browser..." npx playwright install chromium npx playwright install-deps chromium echo "โœ… Playwright installation completed" - name: Build project run: npm run build - name: Pull baseline images run: git lfs pull - name: Verify browser installation run: | echo "๐Ÿ” Verifying browser installation..." ls -la ~/.cache/ms-playwright/ || echo "Browser cache directory not found" find ~/.cache/ms-playwright -name "*headless_shell*" || echo "Headless shell not found" - name: Create artifact folders run: | mkdir -p e2e/test-results mkdir -p e2e/diff mkdir -p playwright-report - name: Run Playwright Tests run: | echo "๐Ÿงช Starting e2e visual regression tests..." echo "๐Ÿ“Š Test environment: ${{ runner.os }} - Node ${{ matrix.node-version }}" start_time=$(date +%s) npx playwright test --shard=${{ matrix.shard }} --reporter=list,github exit_code=$? end_time=$(date +%s) duration=$((end_time - start_time)) if [ $exit_code -eq 0 ]; then echo "โœ… E2E tests completed successfully in ${duration}s!" else echo "โŒ E2E tests failed in ${duration}s with exit code $exit_code" exit $exit_code fi env: CI: true PLAYWRIGHT_FORCE_TTY: 1 - name: Upload test results if: failure() || cancelled() uses: actions/upload-artifact@v4 with: name: playwright-test-results-${{ strategy.job-index }}-${{ github.run_number }} path: | e2e/test-results/ !e2e/test-results/**/*.webm retention-days: 7 if-no-files-found: ignore - name: Upload download images if: failure() || cancelled() uses: actions/upload-artifact@v4 with: name: playwright-downloads-${{ strategy.job-index }}-${{ github.run_number }} path: e2e/downloads/ retention-days: 7 if-no-files-found: ignore - name: Upload diff images if: failure() || cancelled() uses: actions/upload-artifact@v4 with: name: playwright-diffs-${{ strategy.job-index }}-${{ github.run_number }} path: e2e/diff/ retention-days: 7 if-no-files-found: ignore - name: Upload HTML report if: failure() || cancelled() uses: actions/upload-artifact@v4 with: name: playwright-report-${{ strategy.job-index }}-${{ github.run_number }} path: playwright-report/ retention-days: 7 if-no-files-found: ignore