diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8fe87f90..6b22d524 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,25 +2,44 @@ name: Build on: [push] +env: + FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true + jobs: build: + name: build (v22.15.1) runs-on: ubuntu-latest - strategy: - matrix: - node-version: [v22.15.1] - steps: - uses: actions/checkout@v6 - uses: pnpm/action-setup@v6 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v6 + - uses: actions/setup-node@v6 + with: + node-version: v22.15.1 + cache: pnpm + - name: Cache node_modules + id: modules-cache + uses: actions/cache@v4 + with: + path: node_modules + key: node-modules-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }} + - name: Install + if: steps.modules-cache.outputs.cache-hit != 'true' + run: pnpm install --frozen-lockfile + env: + CI: true + - name: Typecheck + run: pnpm typecheck + env: + CI: true + - name: Cache dist + id: dist-cache + uses: actions/cache@v4 with: - node-version: ${{ matrix.node-version }} - - name: Install and build - run: | - pnpm install --frozen-lockfile - pnpm typecheck - pnpm build + path: build + key: dist-${{ runner.os }}-${{ hashFiles('src/**', 'public/**', 'index.html', 'vite.config.*', 'tsconfig*', 'pnpm-lock.yaml') }} + - name: Build + if: steps.dist-cache.outputs.cache-hit != 'true' + run: pnpm build env: CI: true diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index e3ca7728..ebb26f4c 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -2,24 +2,33 @@ name: Lint server on: [push] +env: + FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true + jobs: build: + name: build (v22.15.1) runs-on: ubuntu-latest - strategy: - matrix: - node-version: [v22.15.1] - steps: - uses: actions/checkout@v6 - uses: pnpm/action-setup@v6 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v6 + - uses: actions/setup-node@v6 + with: + node-version: v22.15.1 + cache: pnpm + - name: Cache node_modules + id: modules-cache + uses: actions/cache@v4 with: - node-version: ${{ matrix.node-version }} + path: node_modules + key: node-modules-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }} + - name: Install + if: steps.modules-cache.outputs.cache-hit != 'true' + run: pnpm install --frozen-lockfile + env: + CI: true - name: Run lint - run: | - pnpm install --frozen-lockfile - pnpm lint + run: pnpm lint env: CI: true diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index 615a47b9..0ebc246d 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -4,21 +4,46 @@ on: branches: [main] pull_request: branches: [main] +env: + FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true + jobs: test: - timeout-minutes: 60 + timeout-minutes: 15 runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 + - uses: pnpm/action-setup@v6 - uses: actions/setup-node@v6 with: node-version: v22.15.1 - - uses: pnpm/action-setup@v6 + cache: pnpm + - name: Cache node_modules + id: modules-cache + uses: actions/cache@v4 + with: + path: node_modules + key: node-modules-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }} - name: Install dependencies + if: steps.modules-cache.outputs.cache-hit != 'true' run: pnpm install --frozen-lockfile + - name: Cache Playwright browsers + uses: actions/cache@v4 + id: playwright-cache + with: + path: ~/.cache/ms-playwright + key: playwright-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }} - name: Install Playwright Browsers - run: pnpm exec playwright install --with-deps + if: steps.playwright-cache.outputs.cache-hit != 'true' + run: pnpm exec playwright install --with-deps chromium + - name: Cache dist + id: dist-cache + uses: actions/cache@v4 + with: + path: build + key: dist-${{ runner.os }}-${{ hashFiles('src/**', 'public/**', 'index.html', 'vite.config.*', 'tsconfig*', 'pnpm-lock.yaml') }} - name: Build the application + if: steps.dist-cache.outputs.cache-hit != 'true' run: pnpm build - name: Run Playwright tests run: pnpm exec playwright test diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e3bcbb1d..dee4fd71 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,24 +2,33 @@ name: test on: [push] +env: + FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true + jobs: build: + name: build (v22.15.1) runs-on: ubuntu-latest - strategy: - matrix: - node-version: [v22.15.1] - steps: - uses: actions/checkout@v6 - uses: pnpm/action-setup@v6 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v6 + - uses: actions/setup-node@v6 + with: + node-version: v22.15.1 + cache: pnpm + - name: Cache node_modules + id: modules-cache + uses: actions/cache@v4 with: - node-version: ${{ matrix.node-version }} - - name: Web - run: | - pnpm install --frozen-lockfile - pnpm test + path: node_modules + key: node-modules-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }} + - name: Install + if: steps.modules-cache.outputs.cache-hit != 'true' + run: pnpm install --frozen-lockfile + env: + CI: true + - name: Test + run: pnpm test env: CI: true diff --git a/playwright.config.ts b/playwright.config.ts index c757d307..abb30226 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -1,6 +1,5 @@ import { defineConfig, devices } from '@playwright/test'; -// Check if we need to run the mock server based on environment variable or test patterns const shouldRunMockServer = process.env.PLAYWRIGHT_WITH_MOCK === 'true' || process.argv.some((arg) => arg.includes('mock-api.spec.ts')); @@ -9,8 +8,8 @@ export default defineConfig({ testDir: './tests', fullyParallel: true, forbidOnly: !!process.env.CI, - retries: process.env.CI ? 2 : 0, - workers: process.env.CI ? 1 : undefined, + retries: process.env.CI ? 1 : 0, + workers: '100%', reporter: 'html', use: { baseURL: process.env.CI ? 'http://localhost:4173' : 'http://localhost:3000', @@ -22,16 +21,7 @@ export default defineConfig({ name: 'chromium', use: { ...devices['Desktop Chrome'] }, }, - { - name: 'firefox', - use: { ...devices['Desktop Firefox'] }, - }, - { - name: 'webkit', - use: { ...devices['Desktop Safari'] }, - }, ], - // Conditionally start mock server based on test needs webServer: shouldRunMockServer ? [ { @@ -41,7 +31,7 @@ export default defineConfig({ timeout: 120 * 1000, }, { - command: process.env.CI ? 'npm run preview' : 'npm run start', + command: process.env.CI ? 'pnpm run preview' : 'pnpm run start', url: process.env.CI ? 'http://localhost:4173' : 'http://localhost:3000', @@ -50,7 +40,7 @@ export default defineConfig({ }, ] : { - command: process.env.CI ? 'npm run preview' : 'npm run start', + command: process.env.CI ? 'pnpm run preview' : 'pnpm run start', url: process.env.CI ? 'http://localhost:4173' : 'http://localhost:3000', reuseExistingServer: !process.env.CI, timeout: 120 * 1000,