diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f9a69d8..d03ff9d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -44,9 +44,60 @@ jobs: - name: Run checks run: ./check.sh - - name: Build + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: lts/* + + - uses: pnpm/action-setup@v3 + name: Install pnpm + with: + version: 8 + run_install: false + package_json_file: sandbox/package.json + + - name: Get pnpm store directory + shell: bash + run: | + echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV + + - uses: actions/cache@v4 + name: Setup pnpm cache + with: + path: ${{ env.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + + - name: Install dependencies + working-directory: ./sandbox + run: pnpm install + + - name: Install Playwright Browsers + working-directory: ./sandbox + run: pnpm exec playwright install --with-deps + + - name: Build Dev + run: ./dev.sh + + - name: Run Playwright dev tests + working-directory: ./sandbox + run: pnpm exec playwright test dev.spec.ts + + - name: Build Prod run: ./prod.sh + - name: Run Playwright prod tests + working-directory: ./sandbox + run: pnpm exec playwright test prod.spec.ts + + - uses: actions/upload-artifact@v4 + if: always() + with: + name: playwright-report + path: sandbox/playwright-report/ + retention-days: 30 + - name: Prepublish run: ./prepublish.sh diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml deleted file mode 100644 index 2ac6839..0000000 --- a/.github/workflows/playwright.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Playwright Tests -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] -jobs: - test: - timeout-minutes: 60 - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: lts/* - - name: Install dependencies - run: npm install -g pnpm && pnpm install - - name: Install Playwright Browsers - run: pnpm exec playwright install --with-deps - - name: Run Playwright tests - run: pnpm exec playwright test - - uses: actions/upload-artifact@v4 - if: always() - with: - name: playwright-report - path: playwright-report/ - retention-days: 30 diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index f903548..d7b3f1e 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -44,5 +44,56 @@ jobs: - name: Run checks run: ./check.sh - - name: Build + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: lts/* + + - uses: pnpm/action-setup@v3 + name: Install pnpm + with: + version: 8 + run_install: false + package_json_file: sandbox/package.json + + - name: Get pnpm store directory + shell: bash + run: | + echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV + + - uses: actions/cache@v4 + name: Setup pnpm cache + with: + path: ${{ env.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + + - name: Install dependencies + working-directory: ./sandbox + run: pnpm install + + - name: Install Playwright Browsers + working-directory: ./sandbox + run: pnpm exec playwright install --with-deps + + - name: Build Dev + run: ./dev.sh + + - name: Run Playwright dev tests + working-directory: ./sandbox + run: pnpm exec playwright test dev.spec.ts + + - name: Build Prod run: ./prod.sh + + - name: Run Playwright prod tests + working-directory: ./sandbox + run: pnpm exec playwright test prod.spec.ts + + - uses: actions/upload-artifact@v4 + if: always() + with: + name: playwright-report + path: sandbox/playwright-report/ + retention-days: 30 diff --git a/sandbox/playwright.config.ts b/sandbox/playwright.config.ts index 34e5a4a..952bead 100644 --- a/sandbox/playwright.config.ts +++ b/sandbox/playwright.config.ts @@ -72,7 +72,7 @@ export default defineConfig({ /* Run your local dev server before starting the tests */ webServer: { command: 'pnpm run start', - url: 'http://127.0.0.1:3000', + url: 'http://localhost:3000', reuseExistingServer: !process.env.CI, }, }) diff --git a/sandbox/tests/util.ts b/sandbox/tests/util.ts index e4a7d83..e4b8754 100644 --- a/sandbox/tests/util.ts +++ b/sandbox/tests/util.ts @@ -1,5 +1,5 @@ import { Page } from '@playwright/test' export async function goHome(page: Page) { - await page.goto('http://127.0.0.1:3000') + await page.goto('http://localhost:3000') }