diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index 3b53e360..05646db0 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -5,6 +5,10 @@ on: pull_request: workflow_dispatch: +concurrency: + group: verify-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + jobs: check: name: Check @@ -17,11 +21,18 @@ jobs: - name: Clone repository uses: actions/checkout@v6 + - name: Setup pnpm + uses: pnpm/action-setup@v5 + with: + run_install: false + version: 10.28.1 + - name: Setup Node.js uses: actions/setup-node@v6 - - - name: Setup pnpm - run: corepack enable pnpm + with: + node-version: 24.12.0 + cache: pnpm + cache-dependency-path: pnpm-lock.yaml - name: Install dependencies run: pnpm install @@ -53,6 +64,9 @@ jobs: e2e: name: E2E Tests (${{ matrix.shard }}/${{ strategy.job-total }}) runs-on: ubuntu-latest + container: + image: mcr.microsoft.com/playwright:v1.58.0-noble + options: --user 1001 timeout-minutes: 15 permissions: contents: read @@ -65,45 +79,22 @@ jobs: - name: Clone repository uses: actions/checkout@v6 - - name: Setup Node.js - uses: actions/setup-node@v6 - - name: Setup pnpm - run: corepack enable pnpm - - - name: Get pnpm store directory - id: pnpm-cache - run: echo "dir=$(pnpm store path)" >> $GITHUB_OUTPUT + uses: pnpm/action-setup@v5 + with: + run_install: false + version: 10.28.1 - - name: Cache pnpm dependencies - uses: actions/cache@v4 + - name: Setup Node.js + uses: actions/setup-node@v6 with: - path: ${{ steps.pnpm-cache.outputs.dir }} - key: pnpm-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }} - restore-keys: pnpm-${{ runner.os }}- + node-version: 24.12.0 + cache: pnpm + cache-dependency-path: pnpm-lock.yaml - name: Install dependencies run: pnpm install - - name: Get Playwright version - id: playwright-version - run: echo "version=$(pnpm exec playwright --version | cut -d' ' -f2)" >> $GITHUB_OUTPUT - - - name: Cache Playwright browsers - id: playwright-cache - uses: actions/cache@v4 - with: - path: ~/.cache/ms-playwright - key: playwright-${{ runner.os }}-${{ steps.playwright-version.outputs.version }} - - - name: Install Playwright browsers - if: steps.playwright-cache.outputs.cache-hit != 'true' - run: pnpm exec playwright install chromium --with-deps - - - name: Install Playwright system deps - if: steps.playwright-cache.outputs.cache-hit == 'true' - run: pnpm exec playwright install-deps chromium - - name: Run Playwright tests run: pnpm run test:e2e --shard=${{ matrix.shard }}/3 diff --git a/playwright.config.ts b/playwright.config.ts index b9437203..4ef1c164 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -1,15 +1,18 @@ import { defineConfig, devices } from '@playwright/test' +const isCI = !!process.env.CI +const webServerUrl = isCI ? 'http://localhost:5173' : 'https://localhost:5173' + export default defineConfig({ testDir: './e2e', fullyParallel: true, - forbidOnly: !!process.env.CI, - retries: process.env.CI ? 1 : 1, // Retry once due to testnet flakiness - workers: process.env.CI ? 4 : undefined, + forbidOnly: isCI, + retries: isCI ? 1 : 1, // Retry once due to testnet flakiness + workers: isCI ? 4 : undefined, timeout: 180000, // 3 min default timeout for testnet transactions reporter: 'html', use: { - baseURL: 'https://localhost:5173', + baseURL: webServerUrl, ignoreHTTPSErrors: true, trace: 'on-first-retry', }, @@ -20,10 +23,10 @@ export default defineConfig({ }, ], webServer: { - command: process.env.CI ? 'VITE_E2E=true pnpm run dev 2>/dev/null' : 'pnpm run dev 2>/dev/null', - url: 'https://localhost:5173', + command: isCI ? 'VITE_E2E=true VITE_USE_HTTP=true pnpm run dev' : 'pnpm run dev 2>/dev/null', + url: webServerUrl, ignoreHTTPSErrors: true, - reuseExistingServer: !process.env.CI, + reuseExistingServer: !isCI, stdout: 'ignore', stderr: 'ignore', }, diff --git a/vite.config.ts b/vite.config.ts index ddbda55a..08ed63aa 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -12,8 +12,16 @@ export default defineConfig(({ mode }) => { for (const key of Object.keys(env)) { if (!(key in process.env)) process.env[key] = env[key] } + + const useHttp = process.env.CI === 'true' || process.env.VITE_USE_HTTP === 'true' + return { - plugins: [syncTips(), vocs(), react(), mkcert(), tempoNode()], + plugins: [syncTips(), vocs(), react(), ...(useHttp ? [] : [mkcert()]), tempoNode()], + server: useHttp + ? { + host: 'localhost', + } + : undefined, } })