From 1cffdcf4a0634ce8baa5ba2f823eb6dedb668ae6 Mon Sep 17 00:00:00 2001 From: Francesco Novy Date: Thu, 30 Mar 2023 13:48:04 +0200 Subject: [PATCH 1/3] ci: Make E2E tests required & check for PRs against master --- .github/workflows/build.yml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c23196e5ae80..0dcbd32322a2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -140,7 +140,7 @@ jobs: is_develop: ${{ github.ref == 'refs/heads/develop' }} is_release: ${{ startsWith(github.ref, 'refs/heads/release/') }} # When merging into master, or from master - is_gitflow_sync: ${{ github.head_ref == 'refs/heads/master' || github.ref == 'refs/heads/master' }} + is_gitflow_sync: ${{ github.head_ref == 'master' || github.ref == 'refs/heads/master' }} has_gitflow_label: ${{ github.event_name == 'pull_request' && contains(steps.pr-labels.outputs.labels, ' Gitflow ') }} force_skip_cache: @@ -181,6 +181,21 @@ jobs: outputs: dependency_cache_key: ${{ steps.compute_lockfile_hash.outputs.hash }} + job_check_branches: + name: Check PR branches + needs: job_get_metadata + runs-on: ubuntu-20.04 + if: github.event_name == 'pull_request' + permissions: + pull-requests: write + steps: + - name: PR is opened against master + uses: mshick/add-pr-comment@v2 + if: ${{ github.base_ref == 'master' && github.head_ref != 'develop' }} + with: + message: | + ⚠️ This PR is opened against **master**. You probably want to open it against **develop**. + job_build: name: Build needs: [job_get_metadata, job_install_deps] @@ -709,6 +724,7 @@ jobs: job_browser_playwright_tests, job_browser_integration_tests, job_remix_integration_tests, + job_e2e_tests, ] # Always run this, even if a dependent job failed if: always() From a6af9242c34579f790178367ae604564d8bc7470 Mon Sep 17 00:00:00 2001 From: Francesco Novy Date: Thu, 30 Mar 2023 15:11:11 +0200 Subject: [PATCH 2/3] fix flaky detector --- .github/workflows/flaky-test-detector.yml | 6 ++++-- .../scripts/detectFlakyTests.ts | 19 ++++++++++++++++++- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/.github/workflows/flaky-test-detector.yml b/.github/workflows/flaky-test-detector.yml index 9412da630775..97e0c24932c0 100644 --- a/.github/workflows/flaky-test-detector.yml +++ b/.github/workflows/flaky-test-detector.yml @@ -4,6 +4,9 @@ on: pull_request: paths: - 'packages/browser-integration-tests/suites/**' + branches-ignore: + - master + - develop env: HEAD_COMMIT: ${{ github.event.inputs.commit || github.sha }} @@ -77,5 +80,4 @@ jobs: working-directory: packages/browser-integration-tests env: CHANGED_TEST_PATHS: ${{ steps.changed.outputs.browser_integration_files }} - # Run 50 times when detecting changed test(s), else run all tests 5x - TEST_RUN_COUNT: ${{ steps.changed.outputs.browser_integration == 'true' && 50 || 5 }} + TEST_RUN_COUNT: 'AUTO' diff --git a/packages/browser-integration-tests/scripts/detectFlakyTests.ts b/packages/browser-integration-tests/scripts/detectFlakyTests.ts index af0a5c86a18e..88435731137e 100644 --- a/packages/browser-integration-tests/scripts/detectFlakyTests.ts +++ b/packages/browser-integration-tests/scripts/detectFlakyTests.ts @@ -23,8 +23,25 @@ ${changedPaths.join('\n')} } } + let runCount: number; + if (process.env.TEST_RUN_COUNT === 'AUTO') { + // No test paths detected: run everything 5x + runCount = 5; + + if (testPaths.length > 0) { + // Run everything up to 100x, assuming that total runtime is less than 60min. + // We assume an average runtime of 3s per test, times 4 (for different browsers) = 12s per detected testPaths + // We want to keep overall runtime under 30min + const testCount = testPaths.length * 4; + const expectedRuntimePerTestPath = testCount * 3; + const expectedRuntime = Math.floor((30 * 60) / expectedRuntimePerTestPath); + runCount = Math.min(50, Math.max(expectedRuntime, 5)); + } + } else { + runCount = parseInt(process.env.TEST_RUN_COUNT || '10'); + } + const cwd = path.join(__dirname, '../'); - const runCount = parseInt(process.env.TEST_RUN_COUNT || '10'); try { await new Promise((resolve, reject) => { From d6a740689ec7ff18a252ed22e950ce64ca9f96f8 Mon Sep 17 00:00:00 2001 From: Francesco Novy Date: Thu, 30 Mar 2023 16:49:11 +0200 Subject: [PATCH 3/3] fix ci checks --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0dcbd32322a2..4adca974d830 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -190,8 +190,8 @@ jobs: pull-requests: write steps: - name: PR is opened against master - uses: mshick/add-pr-comment@v2 - if: ${{ github.base_ref == 'master' && github.head_ref != 'develop' }} + uses: mshick/add-pr-comment@a65df5f64fc741e91c59b8359a4bc56e57aaf5b1 + if: ${{ github.base_ref == 'master' && !startsWith(github.ref, 'refs/heads/prepare-release/') }} with: message: | ⚠️ This PR is opened against **master**. You probably want to open it against **develop**.