diff --git a/.github/ISSUE_TEMPLATE/1.bug_report.yml b/.github/ISSUE_TEMPLATE/1.bug_report.yml index 3e73aa706..56f998913 100644 --- a/.github/ISSUE_TEMPLATE/1.bug_report.yml +++ b/.github/ISSUE_TEMPLATE/1.bug_report.yml @@ -31,6 +31,11 @@ body: description: What version of Payload are you running? validations: required: true + - type: input + id: adapters-plugins + attributes: + label: Adapters and Plugins + description: What adapters and plugins are you using? ie. db-mongodb, db-postgres, bundler-webpack, etc. - type: markdown attributes: value: Before submitting the issue, go through the steps you've written down to make sure the steps provided are detailed and clear. diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2a65c3a5e..44cb27f6b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -108,6 +108,10 @@ jobs: tests-e2e: runs-on: ubuntu-latest needs: core-build + strategy: + fail-fast: false + matrix: + part: [1/4, 2/4, 3/4, 4/4] steps: - name: Use Node.js 18 @@ -128,14 +132,14 @@ jobs: key: ${{ github.sha }}-${{ github.run_number }} - name: E2E Tests - run: pnpm test:e2e --bail + run: pnpm test:e2e --part ${{ matrix.part }} --bail - uses: actions/upload-artifact@v3 if: always() with: name: test-results path: test-results/ - retention-days: 30 + retention-days: 1 tests-type-generation: runs-on: ubuntu-latest @@ -165,11 +169,22 @@ jobs: - name: Generate GraphQL schema file run: pnpm dev:generate-graphql-schema graphql-schema-gen -# DB Adapters - - build-db-mongodb: + build-packages: + name: Build Packages runs-on: ubuntu-latest needs: core-build + strategy: + fail-fast: false + matrix: + pkg: + - db-mongodb + - db-postgres + - bundler-webpack + - bundler-vite + - richtext-slate + - richtext-lexical + - live-preview + - live-preview-react steps: - name: Use Node.js 18 @@ -189,162 +204,5 @@ jobs: path: ./* key: ${{ github.sha }}-${{ github.run_number }} - - name: Build db-mongodb - run: pnpm turbo run build --filter=db-mongodb - - build-db-postgres: - runs-on: ubuntu-latest - needs: core-build - - steps: - - name: Use Node.js 18 - uses: actions/setup-node@v3 - with: - node-version: 18 - - - name: Install pnpm - uses: pnpm/action-setup@v2 - with: - version: 8 - run_install: false - - - name: Restore build - uses: actions/cache@v3 - with: - path: ./* - key: ${{ github.sha }}-${{ github.run_number }} - - - name: Build db-postgres - run: pnpm turbo run build --filter=db-postgres - -# Bundlers - - build-bundler-webpack: - runs-on: ubuntu-latest - needs: core-build - - steps: - - name: Use Node.js 18 - uses: actions/setup-node@v3 - with: - node-version: 18 - - - name: Install pnpm - uses: pnpm/action-setup@v2 - with: - version: 8 - run_install: false - - - name: Restore build - uses: actions/cache@v3 - with: - path: ./* - key: ${{ github.sha }}-${{ github.run_number }} - - - name: Build bundler-webpack - run: pnpm turbo run build --filter=bundler-webpack - - build-bundler-vite: - runs-on: ubuntu-latest - needs: core-build - - steps: - - name: Use Node.js 18 - uses: actions/setup-node@v3 - with: - node-version: 18 - - - name: Install pnpm - uses: pnpm/action-setup@v2 - with: - version: 8 - run_install: false - - - name: Restore build - uses: actions/cache@v3 - with: - path: ./* - key: ${{ github.sha }}-${{ github.run_number }} - - - name: Build bundler-vite - run: pnpm turbo run build --filter=bundler-vite - -# Other Plugins - - build-plugin-richtext-slate: - runs-on: ubuntu-latest - needs: core-build - - steps: - - name: Use Node.js 18 - uses: actions/setup-node@v3 - with: - node-version: 18 - - - name: Install pnpm - uses: pnpm/action-setup@v2 - with: - version: 8 - run_install: false - - - name: Restore build - uses: actions/cache@v3 - with: - path: ./* - key: ${{ github.sha }}-${{ github.run_number }} - - - name: Build richtext-slate - run: pnpm turbo run build --filter=richtext-slate - - build-plugin-richtext-lexical: - runs-on: ubuntu-latest - needs: core-build - - steps: - - name: Use Node.js 18 - uses: actions/setup-node@v3 - with: - node-version: 18 - - - name: Install pnpm - uses: pnpm/action-setup@v2 - with: - version: 8 - run_install: false - - - name: Restore build - uses: actions/cache@v3 - with: - path: ./* - key: ${{ github.sha }}-${{ github.run_number }} - - - name: Build richtext-lexical - run: pnpm turbo run build --filter=richtext-lexical - - build-plugin-live-preview: - runs-on: ubuntu-latest - needs: core-build - - steps: - - name: Use Node.js 18 - uses: actions/setup-node@v3 - with: - node-version: 18 - - - name: Install pnpm - uses: pnpm/action-setup@v2 - with: - version: 8 - run_install: false - - - name: Restore build - uses: actions/cache@v3 - with: - path: ./* - key: ${{ github.sha }}-${{ github.run_number }} - - - name: Build live-preview - run: pnpm turbo run build --filter=live-preview - - - name: Build live-preview-react - run: pnpm turbo run build --filter=live-preview-react + - name: Build ${{ matrix.pkg }} + run: pnpm turbo run build --filter=${{ matrix.pkg }} diff --git a/package.json b/package.json index 9adaa46a5..587c50888 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ }, "devDependencies": { "@payloadcms/eslint-config": "workspace:*", - "@playwright/test": "1.37.1", + "@playwright/test": "1.38.1", "@swc/cli": "^0.1.62", "@swc/jest": "0.2.29", "@swc/register": "0.1.10", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ceac225bd..fbe605ef4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -22,8 +22,8 @@ importers: specifier: workspace:* version: link:packages/eslint-config-payload '@playwright/test': - specifier: 1.37.1 - version: 1.37.1 + specifier: 1.38.1 + version: 1.38.1 '@swc/cli': specifier: ^0.1.62 version: 0.1.62(@swc/core@1.3.76) @@ -3485,15 +3485,12 @@ packages: '@octokit/openapi-types': 18.0.0 dev: true - /@playwright/test@1.37.1: - resolution: {integrity: sha512-bq9zTli3vWJo8S3LwB91U0qDNQDpEXnw7knhxLM0nwDvexQAwx9tO8iKDZSqqneVq+URd/WIoz+BALMqUTgdSg==} + /@playwright/test@1.38.1: + resolution: {integrity: sha512-NqRp8XMwj3AK+zKLbZShl0r/9wKgzqI/527bkptKXomtuo+dOjU9NdMASQ8DNC9z9zLOMbG53T4eihYr3XR+BQ==} engines: {node: '>=16'} hasBin: true dependencies: - '@types/node': 20.6.2 - playwright-core: 1.37.1 - optionalDependencies: - fsevents: 2.3.2 + playwright: 1.38.1 dev: true /@pnpm/config.env-replace@1.1.0: @@ -12086,12 +12083,22 @@ packages: find-up: 3.0.0 dev: false - /playwright-core@1.37.1: - resolution: {integrity: sha512-17EuQxlSIYCmEMwzMqusJ2ztDgJePjrbttaefgdsiqeLWidjYz9BxXaTaZWxH1J95SHGk6tjE+dwgWILJoUZfA==} + /playwright-core@1.38.1: + resolution: {integrity: sha512-tQqNFUKa3OfMf4b2jQ7aGLB8o9bS3bOY0yMEtldtC2+spf8QXG9zvXLTXUeRsoNuxEYMgLYR+NXfAa1rjKRcrg==} engines: {node: '>=16'} hasBin: true dev: true + /playwright@1.38.1: + resolution: {integrity: sha512-oRMSJmZrOu1FP5iu3UrCx8JEFRIMxLDM0c/3o4bpzU5Tz97BypefWf7TuTNPWeCe279TPal5RtPPZ+9lW/Qkow==} + engines: {node: '>=16'} + hasBin: true + dependencies: + playwright-core: 1.38.1 + optionalDependencies: + fsevents: 2.3.2 + dev: true + /pluralize@8.0.0: resolution: {integrity: sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==} engines: {node: '>=4'} diff --git a/test/runE2E.ts b/test/runE2E.ts index f20f81463..5905c92b0 100644 --- a/test/runE2E.ts +++ b/test/runE2E.ts @@ -1,4 +1,5 @@ import glob from 'glob' +import minimist from 'minimist' import path from 'path' import shelljs from 'shelljs' import slash from 'slash' @@ -8,14 +9,39 @@ shelljs.env.DISABLE_LOGGING = 'true' const playwrightBin = path.resolve(__dirname, '../node_modules/.bin/playwright') const testRunCodes: { code: number; suiteName: string }[] = [] -const args = process.argv.slice(2) +const { _: args, bail, part } = minimist(process.argv.slice(2)) const suiteName = args[0] // Run all -if (!suiteName || args[0].startsWith('-')) { - const bail = args.includes('--bail') - const files = glob.sync(`${path.resolve(__dirname).replace(/\\/g, '/')}/**/*e2e.spec.ts`) - console.log(`\n\nExecuting all ${files.length} E2E tests...`) +if (!suiteName) { + let files = glob.sync(`${path.resolve(__dirname).replace(/\\/g, '/')}/**/*e2e.spec.ts`) + + const totalFiles = files.length + + if (part) { + if (!part.includes('/')) { + throw new Error('part must be in the format of "1/2"') + } + + const [partToRun, totalParts] = part.split('/').map((n) => parseInt(n)) + + if (partToRun > totalParts) { + throw new Error('part cannot be greater than totalParts') + } + + const partSize = Math.ceil(files.length / totalParts) + const start = (partToRun - 1) * partSize + const end = start + partSize + files = files.slice(start, end) + } + + if (files.length !== totalFiles) { + console.log(`\n\nExecuting part ${part}: ${files.length} of ${totalFiles} E2E tests...\n\n`) + } else { + console.log(`\n\nExecuting all ${files.length} E2E tests...\n\n`) + } + console.log(`${files.join('\n')}\n`) + files.forEach((file) => { clearWebpackCache() executePlaywright(file, bail)