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 d2b3d63
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 26 deletions.
19 changes: 11 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ jobs:
- run: npm run test-integration

e2e-mac:
if: github.repository_owner == 'facebook'
if: github.repository_owner == 'facebook' && github.event.review.state == 'APPROVED'
strategy:
matrix:
node-version: [18.18.0]
Expand All @@ -93,7 +93,7 @@ jobs:
events-mode: ${{ matrix.events-mode }}

e2e-linux:
if: github.repository_owner == 'facebook'
if: github.repository_owner == 'facebook' && github.event.review.state == 'APPROVED'
strategy:
matrix:
node-version: [18.18.0]
Expand All @@ -109,7 +109,10 @@ jobs:
events-mode: ${{ matrix.events-mode }}

e2e-windows:
if: github.repository_owner == 'facebook'
if: github.repository_owner == 'testuser' && (
github.event.review.state == 'APPROVED' ||
(github.event_name == 'pull_request' && contains(fromJson('["COLLABORATOR","MEMBER","OWNER",]'), github.event.pull_request.author_association))
)
strategy:
matrix:
node-version: [18.18.0]
Expand All @@ -125,7 +128,7 @@ jobs:
events-mode: ${{ matrix.events-mode }}

e2e-collab-mac:
if: github.repository_owner == 'facebook'
if: github.repository_owner == 'facebook' && github.event.review.state == 'APPROVED'
strategy:
matrix:
node-version: [18.18.0]
Expand All @@ -139,7 +142,7 @@ jobs:
events-mode: 'modern-events'

e2e-collab-linux:
if: github.repository_owner == 'facebook'
if: github.repository_owner == 'facebook' && github.event.review.state == 'APPROVED'
strategy:
matrix:
node-version: [18.18.0]
Expand All @@ -153,7 +156,7 @@ jobs:
events-mode: 'modern-events'

e2e-collab-windows:
if: github.repository_owner == 'facebook'
if: github.repository_owner == 'facebook' && github.event.review.state == 'APPROVED'
strategy:
matrix:
node-version: [18.18.0]
Expand All @@ -167,7 +170,7 @@ jobs:
events-mode: 'modern-events'

e2e-prod:
if: github.repository_owner == 'facebook'
if: github.repository_owner == 'facebook' && github.event.review.state == 'APPROVED'
strategy:
matrix:
os: ['macos-latest']
Expand All @@ -185,7 +188,7 @@ jobs:
events-mode: ${{ matrix.events-mode }}

e2e-collab-prod:
if: github.repository_owner == 'facebook'
if: github.repository_owner == 'facebook' && github.event.review.state == 'APPROVED'
strategy:
matrix:
os: ['macos-latest']
Expand Down
2 changes: 1 addition & 1 deletion .lintstagedrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
'*.(js|mjs|jsx|css|html|d.ts|ts|tsx)': 'prettier --write',
'*.(js|mjs|jsx|css|html|d.ts|ts|tsx|yml)': 'prettier --write',
'*.(js|mjs|jsx|ts|tsx)': ['eslint --fix'],
};
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 d2b3d63

Please sign in to comment.