diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..d3f3d03 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,84 @@ +name: Pull Request CI + +on: + pull_request: + branches: + - main + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + quality: + runs-on: ubuntu-latest + timeout-minutes: 15 + steps: + - name: Checkout + uses: actions/checkout@v6 + with: + persist-credentials: false + + - name: Setup Bun from packageManager + uses: oven-sh/setup-bun@v2 + with: + bun-version-file: package.json + + - name: Install locked dependencies + run: bun install --frozen-lockfile + + - name: Check Svelte + run: bun run check + + - name: Check TypeScript with tsgo + run: bun run typecheck:go + + - name: Lint + run: bun run lint + + - name: Check formatting + run: bun run format:check + + - name: Unit tests + run: bun run test --run + + - name: Build for GitHub Pages + env: + BASE_PATH: /dc-code-paste + run: bun run build + + browser: + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - name: Checkout + uses: actions/checkout@v6 + with: + persist-credentials: false + + - name: Setup Bun from packageManager + uses: oven-sh/setup-bun@v2 + with: + bun-version-file: package.json + + - name: Install locked dependencies + run: bun install --frozen-lockfile + + - name: Install Chromium and system dependencies + run: bunx --no-install playwright install --with-deps chromium + + - name: Browser tests + run: bun run test:e2e + + - name: Upload failure diagnostics + if: failure() + uses: actions/upload-artifact@v7 + with: + name: playwright-failure-diagnostics + path: test-results/ + if-no-files-found: ignore + retention-days: 7 diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 892c31f..a2b2a88 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -8,8 +8,6 @@ on: permissions: contents: read - pages: write - id-token: write env: FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true @@ -21,17 +19,20 @@ concurrency: jobs: build: runs-on: ubuntu-latest + timeout-minutes: 15 steps: - name: Checkout uses: actions/checkout@v6 + with: + persist-credentials: false - name: Setup Bun uses: oven-sh/setup-bun@v2 with: - bun-version: latest + bun-version-file: package.json - name: Install dependencies - run: bun install + run: bun install --frozen-lockfile - name: Check Svelte run: bun run check @@ -46,7 +47,7 @@ jobs: run: bun run format:check - name: Test - run: bun run test + run: bun run test --run - name: Build env: @@ -61,6 +62,9 @@ jobs: deploy: if: vars.ENABLE_PAGES_DEPLOY == 'true' + permissions: + pages: write + id-token: write environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} diff --git a/playwright.config.ts b/playwright.config.ts index 5567524..6a8b8c7 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -3,6 +3,9 @@ import { defineConfig, devices } from "@playwright/test"; export default defineConfig({ testDir: "./tests/e2e", fullyParallel: true, + forbidOnly: Boolean(process.env.CI), + retries: process.env.CI ? 1 : 0, + workers: process.env.CI ? 2 : undefined, reporter: [["list"]], use: { baseURL: "http://127.0.0.1:4173",