Skip to content

Commit

Permalink
Only run CI e2e tests on approved PRs
Browse files Browse the repository at this point in the history
Avoid running the entire suite of (expensive) e2e tests on every PR that
is opened or updated. Only run if PR is approved.

Reference: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#running-a-workflow-when-a-pull-request-is-approved
  • Loading branch information
necolas committed May 10, 2024
1 parent 40f6699 commit 5ff4054
Show file tree
Hide file tree
Showing 3 changed files with 132 additions and 127 deletions.
228 changes: 118 additions & 110 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,127 +77,135 @@ jobs:
- run: npm run test-integration

e2e-mac:
if: github.repository_owner == 'facebook'
strategy:
matrix:
node-version: [18.18.0]
browser: ['chromium', 'firefox', 'webkit']
editor-mode: ['rich-text', 'plain-text']
events-mode: ['legacy-events', 'modern-events']
uses: ./.github/workflows/e2e-test.yml
with:
os: 'macos-latest'
node-version: ${{ matrix.node-version }}
browser: ${{ matrix.browser }}
editor-mode: ${{ matrix.editor-mode }}
events-mode: ${{ matrix.events-mode }}
approved:
if: github.repository_owner == 'facebook' && github.event.review.state == 'APPROVED'
strategy:
matrix:
node-version: [18.18.0]
browser: ['chromium', 'firefox', 'webkit']
editor-mode: ['rich-text', 'plain-text']
events-mode: ['legacy-events', 'modern-events']
uses: ./.github/workflows/e2e-test.yml
with:
os: 'macos-latest'
node-version: ${{ matrix.node-version }}
browser: ${{ matrix.browser }}
editor-mode: ${{ matrix.editor-mode }}
events-mode: ${{ matrix.events-mode }}

e2e-linux:
if: github.repository_owner == 'facebook'
strategy:
matrix:
node-version: [18.18.0]
browser: ['chromium', 'firefox']
editor-mode: ['rich-text', 'plain-text']
events-mode: ['legacy-events', 'modern-events']
uses: ./.github/workflows/e2e-test.yml
with:
os: 'ubuntu-latest'
node-version: ${{ matrix.node-version }}
browser: ${{ matrix.browser }}
editor-mode: ${{ matrix.editor-mode }}
events-mode: ${{ matrix.events-mode }}
approved:
if: github.repository_owner == 'facebook' && github.event.review.state == 'APPROVED'
strategy:
matrix:
node-version: [18.18.0]
browser: ['chromium', 'firefox']
editor-mode: ['rich-text', 'plain-text']
events-mode: ['legacy-events', 'modern-events']
uses: ./.github/workflows/e2e-test.yml
with:
os: 'ubuntu-latest'
node-version: ${{ matrix.node-version }}
browser: ${{ matrix.browser }}
editor-mode: ${{ matrix.editor-mode }}
events-mode: ${{ matrix.events-mode }}

e2e-windows:
if: github.repository_owner == 'facebook'
strategy:
matrix:
node-version: [18.18.0]
browser: ['chromium', 'firefox']
editor-mode: ['rich-text', 'plain-text']
events-mode: ['legacy-events', 'modern-events']
uses: ./.github/workflows/e2e-test.yml
with:
os: 'windows-latest'
node-version: ${{ matrix.node-version }}
browser: ${{ matrix.browser }}
editor-mode: ${{ matrix.editor-mode }}
events-mode: ${{ matrix.events-mode }}
approved:
if: github.repository_owner == 'facebook' && github.event.review.state == 'APPROVED'
strategy:
matrix:
node-version: [18.18.0]
browser: ['chromium', 'firefox']
editor-mode: ['rich-text', 'plain-text']
events-mode: ['legacy-events', 'modern-events']
uses: ./.github/workflows/e2e-test.yml
with:
os: 'windows-latest'
node-version: ${{ matrix.node-version }}
browser: ${{ matrix.browser }}
editor-mode: ${{ matrix.editor-mode }}
events-mode: ${{ matrix.events-mode }}

e2e-collab-mac:
if: github.repository_owner == 'facebook'
strategy:
matrix:
node-version: [18.18.0]
browser: ['chromium', 'firefox', 'webkit']
uses: ./.github/workflows/e2e-test.yml
with:
os: 'macos-latest'
node-version: ${{ matrix.node-version }}
browser: ${{ matrix.browser }}
editor-mode: 'rich-text-with-collab'
events-mode: 'modern-events'
approved:
if: github.repository_owner == 'facebook' && github.event.review.state == 'APPROVED'
strategy:
matrix:
node-version: [18.18.0]
browser: ['chromium', 'firefox', 'webkit']
uses: ./.github/workflows/e2e-test.yml
with:
os: 'macos-latest'
node-version: ${{ matrix.node-version }}
browser: ${{ matrix.browser }}
editor-mode: 'rich-text-with-collab'
events-mode: 'modern-events'

e2e-collab-linux:
if: github.repository_owner == 'facebook'
strategy:
matrix:
node-version: [18.18.0]
browser: ['chromium', 'firefox']
uses: ./.github/workflows/e2e-test.yml
with:
os: 'ubuntu-latest'
node-version: ${{ matrix.node-version }}
browser: ${{ matrix.browser }}
editor-mode: 'rich-text-with-collab'
events-mode: 'modern-events'
approved:
if: github.repository_owner == 'facebook' && github.event.review.state == 'APPROVED'
strategy:
matrix:
node-version: [18.18.0]
browser: ['chromium', 'firefox']
uses: ./.github/workflows/e2e-test.yml
with:
os: 'ubuntu-latest'
node-version: ${{ matrix.node-version }}
browser: ${{ matrix.browser }}
editor-mode: 'rich-text-with-collab'
events-mode: 'modern-events'

e2e-collab-windows:
if: github.repository_owner == 'facebook'
strategy:
matrix:
node-version: [18.18.0]
browser: ['chromium', 'firefox']
uses: ./.github/workflows/e2e-test.yml
with:
os: 'windows-latest'
node-version: ${{ matrix.node-version }}
browser: ${{ matrix.browser }}
editor-mode: 'rich-text-with-collab'
events-mode: 'modern-events'
approved:
if: github.repository_owner == 'facebook' && github.event.review.state == 'APPROVED'
strategy:
matrix:
node-version: [18.18.0]
browser: ['chromium', 'firefox']
uses: ./.github/workflows/e2e-test.yml
with:
os: 'windows-latest'
node-version: ${{ matrix.node-version }}
browser: ${{ matrix.browser }}
editor-mode: 'rich-text-with-collab'
events-mode: 'modern-events'

e2e-prod:
if: github.repository_owner == 'facebook'
strategy:
matrix:
os: ['macos-latest']
node-version: [18.18.0]
browser: ['chromium']
editor-mode: ['rich-text']
events-mode: ['modern-events']
uses: ./.github/workflows/e2e-test.yml
with:
prod: true
os: ${{ matrix.os }}
node-version: ${{ matrix.node-version }}
browser: ${{ matrix.browser }}
editor-mode: ${{ matrix.editor-mode }}
events-mode: ${{ matrix.events-mode }}
approved:
if: github.repository_owner == 'facebook' && github.event.review.state == 'APPROVED'
strategy:
matrix:
os: ['macos-latest']
node-version: [18.18.0]
browser: ['chromium']
editor-mode: ['rich-text']
events-mode: ['modern-events']
uses: ./.github/workflows/e2e-test.yml
with:
prod: true
os: ${{ matrix.os }}
node-version: ${{ matrix.node-version }}
browser: ${{ matrix.browser }}
editor-mode: ${{ matrix.editor-mode }}
events-mode: ${{ matrix.events-mode }}

e2e-collab-prod:
if: github.repository_owner == 'facebook'
strategy:
matrix:
os: ['macos-latest']
node-version: [18.18.0]
browser: ['chromium']
editor-mode: ['rich-text-with-collab']
events-mode: ['modern-events']
uses: ./.github/workflows/e2e-test.yml
with:
prod: true
os: ${{ matrix.os }}
node-version: ${{ matrix.node-version }}
browser: ${{ matrix.browser }}
editor-mode: ${{ matrix.editor-mode }}
events-mode: ${{ matrix.events-mode }}
approved:
if: github.repository_owner == 'facebook' && github.event.review.state == 'APPROVED'
strategy:
matrix:
os: ['macos-latest']
node-version: [18.18.0]
browser: ['chromium']
editor-mode: ['rich-text-with-collab']
events-mode: ['modern-events']
uses: ./.github/workflows/e2e-test.yml
with:
prod: true
os: ${{ matrix.os }}
node-version: ${{ matrix.node-version }}
browser: ${{ matrix.browser }}
editor-mode: ${{ matrix.editor-mode }}
events-mode: ${{ matrix.events-mode }}
18 changes: 13 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,19 @@ possible.
We actively welcome your pull requests.

1. Fork the repo and create your branch from `main`.
2. If you've added code that should be tested, add tests.
3. If you've changed APIs, update the documentation.
4. Ensure the test suite passes.
5. Make sure your code lints.
6. If you haven't already, complete the Contributor License Agreement ("CLA").
2. Run `npm install` to install dependencies.
3. If you've added code that should be tested, add tests.
4. If you've changed APIs, update the documentation.
5. Ensure the test suite passes.
6. Make sure your code lints.
7. If you haven't already, complete the Contributor License Agreement ("CLA").

Note that the local server needs to be running in order to run the e2e tests.

- `npm run start`
- `npm run test-e2e-chromium` (to run only chromium e2e tests)

`npm run start` will start both the dev server and collab server. If you don't need collab, use `npm run dev` to start just the dev server.

## Contributor License Agreement ("CLA")

Expand Down
13 changes: 1 addition & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -334,18 +334,7 @@ editor.registerUpdateListener(({editorState}) => {

## Contributing to Lexical

1. Clone this repository

2. Install dependencies

- `npm install`

3. Start local server and run tests
- `npm run start`
- `npm run test-e2e-chromium` to run only chromium e2e tests
- The server needs to be running for the e2e tests

`npm run start` will start both the dev server and collab server. If you don't need collab, use `npm run dev` to start just the dev server.
Please read the [CONTRIBUTING.md](https://github.com/facebook/lexical/blob/main/CONTRIBUTING.md).

### Optional but recommended, use VSCode for development

Expand Down

0 comments on commit 5ff4054

Please sign in to comment.