Skip to content

Commit 1c009fa

Browse files
authored
ci: Make E2E tests required & check for PRs against master (#7670)
1 parent 79ca4a7 commit 1c009fa

File tree

3 files changed

+39
-4
lines changed

3 files changed

+39
-4
lines changed

.github/workflows/build.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ jobs:
140140
is_develop: ${{ github.ref == 'refs/heads/develop' }}
141141
is_release: ${{ startsWith(github.ref, 'refs/heads/release/') }}
142142
# When merging into master, or from master
143-
is_gitflow_sync: ${{ github.head_ref == 'refs/heads/master' || github.ref == 'refs/heads/master' }}
143+
is_gitflow_sync: ${{ github.head_ref == 'master' || github.ref == 'refs/heads/master' }}
144144
has_gitflow_label:
145145
${{ github.event_name == 'pull_request' && contains(steps.pr-labels.outputs.labels, ' Gitflow ') }}
146146
force_skip_cache:
@@ -181,6 +181,21 @@ jobs:
181181
outputs:
182182
dependency_cache_key: ${{ steps.compute_lockfile_hash.outputs.hash }}
183183

184+
job_check_branches:
185+
name: Check PR branches
186+
needs: job_get_metadata
187+
runs-on: ubuntu-20.04
188+
if: github.event_name == 'pull_request'
189+
permissions:
190+
pull-requests: write
191+
steps:
192+
- name: PR is opened against master
193+
uses: mshick/add-pr-comment@a65df5f64fc741e91c59b8359a4bc56e57aaf5b1
194+
if: ${{ github.base_ref == 'master' && !startsWith(github.ref, 'refs/heads/prepare-release/') }}
195+
with:
196+
message: |
197+
⚠️ This PR is opened against **master**. You probably want to open it against **develop**.
198+
184199
job_build:
185200
name: Build
186201
needs: [job_get_metadata, job_install_deps]
@@ -709,6 +724,7 @@ jobs:
709724
job_browser_playwright_tests,
710725
job_browser_integration_tests,
711726
job_remix_integration_tests,
727+
job_e2e_tests,
712728
]
713729
# Always run this, even if a dependent job failed
714730
if: always()

.github/workflows/flaky-test-detector.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ on:
44
pull_request:
55
paths:
66
- 'packages/browser-integration-tests/suites/**'
7+
branches-ignore:
8+
- master
9+
- develop
710

811
env:
912
HEAD_COMMIT: ${{ github.event.inputs.commit || github.sha }}
@@ -77,5 +80,4 @@ jobs:
7780
working-directory: packages/browser-integration-tests
7881
env:
7982
CHANGED_TEST_PATHS: ${{ steps.changed.outputs.browser_integration_files }}
80-
# Run 50 times when detecting changed test(s), else run all tests 5x
81-
TEST_RUN_COUNT: ${{ steps.changed.outputs.browser_integration == 'true' && 50 || 5 }}
83+
TEST_RUN_COUNT: 'AUTO'

packages/browser-integration-tests/scripts/detectFlakyTests.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,25 @@ ${changedPaths.join('\n')}
2323
}
2424
}
2525

26+
let runCount: number;
27+
if (process.env.TEST_RUN_COUNT === 'AUTO') {
28+
// No test paths detected: run everything 5x
29+
runCount = 5;
30+
31+
if (testPaths.length > 0) {
32+
// Run everything up to 100x, assuming that total runtime is less than 60min.
33+
// We assume an average runtime of 3s per test, times 4 (for different browsers) = 12s per detected testPaths
34+
// We want to keep overall runtime under 30min
35+
const testCount = testPaths.length * 4;
36+
const expectedRuntimePerTestPath = testCount * 3;
37+
const expectedRuntime = Math.floor((30 * 60) / expectedRuntimePerTestPath);
38+
runCount = Math.min(50, Math.max(expectedRuntime, 5));
39+
}
40+
} else {
41+
runCount = parseInt(process.env.TEST_RUN_COUNT || '10');
42+
}
43+
2644
const cwd = path.join(__dirname, '../');
27-
const runCount = parseInt(process.env.TEST_RUN_COUNT || '10');
2845

2946
try {
3047
await new Promise<void>((resolve, reject) => {

0 commit comments

Comments
 (0)