-
Notifications
You must be signed in to change notification settings - Fork 1
Create isolated tests and mandatory CI verification #589
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
55d451a
54e42c7
7f7326e
ca2fca2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # Dedicated test environment. Loaded by the Vitest and Playwright harnesses | ||
| # INSTEAD of .env / .env.local so tests never inherit developer or | ||
| # production-like configuration. Contains NO secrets. | ||
| # | ||
| # - Integration tests (Vitest) derive a UNIQUE, test-named database from | ||
| # DATABASE_URI's host (vitest.globalSetup.ts) and drop it around the suite. | ||
| # - E2E tests (Playwright) run the app against DATABASE_URI directly. | ||
| # Both require a LOCAL MongoDB (CI provides a service container). The isolation | ||
| # guard rejects any shared/hosted host (Atlas, DocumentDB, etc.). | ||
|
|
||
| NODE_ENV=test | ||
| PAYLOAD_SECRET=test-payload-secret-not-for-production | ||
|
|
||
| # Local, test-named database host. Overridden by CI to point at the MongoDB | ||
| # service container. Never a shared/hosted cluster. | ||
| DATABASE_URI=mongodb://127.0.0.1:27017/promisetracker_e2e_test | ||
|
|
||
| # Enforce the isolated-database guard at app startup during E2E runs. | ||
| PT_ASSERT_TEST_DB=true |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| version: 2 | ||
| updates: | ||
| # Continuous software-composition security updates for app dependencies. | ||
| - package-ecosystem: npm | ||
| directory: "/" | ||
| schedule: | ||
| interval: weekly | ||
| open-pull-requests-limit: 10 | ||
| groups: | ||
| payload: | ||
| patterns: | ||
| - "@payloadcms/*" | ||
| - "payload" | ||
| ai-sdk: | ||
| patterns: | ||
| - "@ai-sdk/*" | ||
| - "ai" | ||
|
|
||
| - package-ecosystem: github-actions | ||
| directory: "/" | ||
| schedule: | ||
| interval: weekly |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| pull_request: | ||
| push: | ||
| branches-ignore: [main] | ||
|
|
||
| concurrency: | ||
| group: "${{ github.workflow }} @ ${{ github.ref }}" | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| verify: | ||
| uses: ./.github/workflows/verify.yml | ||
Check warningCode scanning / CodeQL Workflow does not contain permissions Medium
Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,102 @@ | ||
| name: Verify | ||
|
|
||
| # Reusable verification pipeline. Called by CI (on pull requests) and by the | ||
| # deploy workflow (which must not run when this fails). | ||
| on: | ||
| workflow_call: | ||
|
|
||
| env: | ||
| NODE_VERSION: "22.12.0" | ||
| # Isolated, local, test-named database — never a shared/hosted cluster. | ||
| DATABASE_URI: mongodb://127.0.0.1:27017/promisetracker_ci_test | ||
| PAYLOAD_SECRET: test-payload-secret-not-for-production | ||
| PT_ASSERT_TEST_DB: "true" | ||
| NODE_OPTIONS: "--no-deprecation" | ||
|
|
||
| jobs: | ||
| verify: | ||
| name: Lint, types, tests | ||
| runs-on: ubuntu-latest | ||
| services: | ||
| mongodb: | ||
| image: mongo:7 | ||
| ports: | ||
| - 27017:27017 | ||
| options: >- | ||
| --health-cmd "mongosh --quiet --eval 'db.runCommand({ ping: 1 })'" | ||
| --health-interval 10s | ||
| --health-timeout 5s | ||
| --health-retries 10 | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up pnpm | ||
| uses: pnpm/action-setup@v4 | ||
|
|
||
| - name: Set up Node | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: ${{ env.NODE_VERSION }} | ||
| cache: pnpm | ||
|
|
||
| # Frozen installation: fail if the lockfile is out of date. | ||
| - name: Install dependencies | ||
| run: pnpm install --frozen-lockfile | ||
|
|
||
| # Generated-artifact drift: regenerate committed types/import map and | ||
| # fail if anything changed. | ||
| - name: Check generated artifacts are up to date | ||
| run: | | ||
| pnpm run generate:all | ||
| if ! git diff --exit-code; then | ||
| echo "::error::Generated artifacts are out of date. Run 'pnpm run generate:all' and commit the result." | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Lint | ||
| run: pnpm run lint | ||
|
|
||
| - name: Type-check | ||
| run: pnpm run typecheck | ||
|
|
||
| - name: Integration tests | ||
| run: pnpm run test:int | ||
|
|
||
| - name: Install Playwright browsers | ||
| run: pnpm exec playwright install --with-deps chromium | ||
|
|
||
| - name: Critical E2E smoke tests | ||
| run: pnpm run test:e2e | ||
|
|
||
| - name: Upload Playwright report | ||
| if: ${{ !cancelled() }} | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: playwright-report | ||
| path: playwright-report/ | ||
| retention-days: 7 | ||
| if-no-files-found: ignore | ||
|
|
||
| security: | ||
Check warningCode scanning / CodeQL Workflow does not contain permissions Medium
Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
|
||
|
github-advanced-security[bot] marked this conversation as resolved.
Fixed
|
||
| name: Dependency security scan | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up pnpm | ||
| uses: pnpm/action-setup@v4 | ||
|
|
||
| - name: Set up Node | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: ${{ env.NODE_VERSION }} | ||
| cache: pnpm | ||
|
|
||
| - name: Install dependencies | ||
| run: pnpm install --frozen-lockfile | ||
|
|
||
| # Software-composition analysis: fail on high/critical advisories. | ||
| - name: Audit dependencies | ||
| run: pnpm audit --audit-level high --prod | ||
Check warningCode scanning / CodeQL Workflow does not contain permissions Medium
Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
|
||
|
github-advanced-security[bot] marked this conversation as resolved.
Fixed
|
||
Uh oh!
There was an error while loading. Please reload this page.