From 98c25f3207574a7a6083e86ce6b8d76598ce6537 Mon Sep 17 00:00:00 2001 From: Danijel Martinek Date: Tue, 5 May 2026 19:43:09 +0200 Subject: [PATCH] ci: add GitHub Actions workflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Runs typecheck + lint + boundaries + test (with coverage) + build on every push to main and every PR. Postgres service for tests that need DB. Playwright e2e and Storybook smoke tests gated on validate job passing. Coverage uploaded as artifact (lcov format) for downstream tools (Codecov, etc.) — wiring left to template users. Spec: §6.11 --- .github/workflows/ci.yml | 117 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..817890b --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,117 @@ +# CI workflow — runs on every push to main and every pull request. +# +# TURBO_TOKEN / TURBO_TEAM: set these in your repository secrets/variables +# to enable Turborepo remote caching. Without them the workflow still works, +# just without the remote-cache speedup. +# +# PAYLOAD_SECRET: the value used here is a throwaway test secret. Do NOT +# reuse it in production. Set a real secret for your deployed environments. + +name: CI + +on: + push: + branches: [main] + pull_request: + +env: + TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} + TURBO_TEAM: ${{ vars.TURBO_TEAM }} + CI: true + +jobs: + validate: + name: typecheck + lint + boundaries + test + build + runs-on: ubuntu-latest + services: + postgres: + image: postgres:16-alpine + env: + POSTGRES_PASSWORD: postgres + POSTGRES_USER: postgres + POSTGRES_DB: cms_test + ports: + - 5432:5432 + options: >- + --health-cmd "pg_isready -U postgres" + --health-interval 10s + --health-timeout 5s + --health-retries 5 + steps: + - uses: actions/checkout@v4 + - uses: pnpm/action-setup@v4 + with: + version: 9 + - uses: actions/setup-node@v4 + with: + node-version: 22 + cache: pnpm + - run: pnpm install --frozen-lockfile + - run: pnpm typecheck + - run: pnpm lint + - run: pnpm turbo boundaries + - name: Test with coverage + env: + DATABASE_URL: postgres://postgres:postgres@localhost:5432/cms_test + PAYLOAD_SECRET: test-secret-do-not-use-in-prod + run: pnpm test -- --coverage + - run: pnpm build + - uses: actions/upload-artifact@v4 + if: always() + with: + name: coverage + path: '**/coverage/lcov.info' + retention-days: 7 + + e2e: + name: Playwright e2e + needs: validate + runs-on: ubuntu-latest + services: + postgres: + image: postgres:16-alpine + env: + POSTGRES_PASSWORD: postgres + POSTGRES_USER: postgres + POSTGRES_DB: cms_test + ports: + - 5432:5432 + options: >- + --health-cmd "pg_isready -U postgres" + --health-interval 10s + --health-timeout 5s + --health-retries 5 + steps: + - uses: actions/checkout@v4 + - uses: pnpm/action-setup@v4 + with: + version: 9 + - uses: actions/setup-node@v4 + with: + node-version: 22 + cache: pnpm + - run: pnpm install --frozen-lockfile + - run: pnpm exec playwright install --with-deps chromium + - name: Run e2e + env: + DATABASE_URL: postgres://postgres:postgres@localhost:5432/cms_test + PAYLOAD_SECRET: test-secret-do-not-use-in-prod + run: pnpm test:e2e + + storybook: + name: Storybook smoke tests + needs: validate + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: pnpm/action-setup@v4 + with: + version: 9 + - uses: actions/setup-node@v4 + with: + node-version: 22 + cache: pnpm + - run: pnpm install --frozen-lockfile + - run: pnpm exec playwright install --with-deps chromium + - run: pnpm build-storybook --filter @repo/storybook + - run: pnpm test:stories