Skip to content

Scheduling infrastructure for absolutely everyone.

chore: Only run E2E suite when ready-for-e2e label added (#15529)

Keith Williams4a88051531f6
diff --git a/.github/workflows/api-v1-production-build.yml b/.github/workflows/api-v1-production-build.yml
index 3fdd51d512c..80a24ef801b 100644
--- a/.github/workflows/api-v1-production-build.yml
+++ b/.github/workflows/api-v1-production-build.yml
@@ -65,7 +65,7 @@ jobs:
- uses: ./.github/actions/yarn-install
- uses: ./.github/actions/cache-db
- name: Cache API v1 production build
- uses: buildjet/cache@v3
+ uses: buildjet/cache@v4
id: cache-api-v1-build
env:
cache-name: api-v1-build
diff --git a/.github/workflows/api-v2-production-build.yml b/.github/workflows/api-v2-production-build.yml
index da2f17c40a4..28fe054a93e 100644
--- a/.github/workflows/api-v2-production-build.yml
+++ b/.github/workflows/api-v2-production-build.yml
@@ -34,7 +34,7 @@ jobs:
- uses: ./.github/actions/dangerous-git-checkout
- uses: ./.github/actions/yarn-install
- name: Cache API v2 production build
- uses: buildjet/cache@v3
+ uses: buildjet/cache@v4
id: cache-api-v2-build
env:
cache-name: api-v2-build
diff --git a/.github/workflows/nextjs-bundle-analysis.yml b/.github/workflows/nextjs-bundle-analysis.yml
index 823063321f8..dc293e4501f 100644
--- a/.github/workflows/nextjs-bundle-analysis.yml
+++ b/.github/workflows/nextjs-bundle-analysis.yml
@@ -45,13 +45,7 @@ env:
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
jobs:
- build:
- name: Production builds
- if: ${{ github.event_name == 'push' }}
- uses: ./.github/workflows/production-build-without-database.yml
- secrets: inherit
analyze:
- needs: build
if: always()
runs-on: buildjet-2vcpu-ubuntu-2204
steps:
diff --git a/.github/workflows/pr-review.yml b/.github/workflows/pr-review.yml
new file mode 100644
index 00000000000..d18a871ef8d
--- /dev/null
+++ b/.github/workflows/pr-review.yml
@@ -0,0 +1,17 @@
+name: PR Reviewed
+
+on:
+ pull_request_review:
+ types: [submitted]
+
+jobs:
+ label-pr:
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Label PR as ready for E2E
+ if: github.event.review.state == 'approved'
+ uses: actions-ecosystem/action-add-labels@v1
+ with:
+ github_token: ${{ secrets.GITHUB_TOKEN }}
+ labels: 'ready-for-e2e'
diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml
index e8099fae923..40b57091a33 100644
--- a/.github/workflows/pr.yml
+++ b/.github/workflows/pr.yml
@@ -2,6 +2,7 @@ name: PR Update
on:
pull_request_target:
+ types: [opened, synchronize, reopened, labeled]
branches:
- main
workflow_dispatch:
@@ -27,37 +28,149 @@ jobs:
filters: |
has-files-requiring-all-checks:
- "!(**.md|.github/CODEOWNERS)"
+
+ check-label:
+ runs-on: buildjet-2vcpu-ubuntu-2204
+ name: Check for E2E label
+ outputs:
+ run-e2e: ${{ steps.check-if-pr-has-label.outputs.run-e2e == 'true' && (github.event_name != 'labeled' || (github.event_name == 'labeled' && github.event.label.name == 'ready-for-e2e')) }}
+ run-jobs: ${{ github.event_name != 'labeled' }}
+ steps:
+ - name: Get PR from branch name
+ id: check-if-pr-has-label
+ uses: actions/github-script@v7
+ with:
+ script: |
+ let pr;
+ if (github.event && github.event.pull_request) {
+ const response = await github.rest.pulls.get({
+ owner: github.context.repo.owner,
+ repo: github.context.repo.repo,
+ pull_number: github.event.pull_request.number
+ });
+
+ pr = response.data;
+ } else {
+ const ref = '${{ github.ref }}';
+ const branch = ref.replace('refs/heads/', '');
+ console.log(ref);
+ console.log(branch);
+ const response = await github.rest.pulls.list({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ state: 'open',
+ head: `${context.repo.owner}:${branch}`
+ });
+
+ if (response.data.length > 0) {
+ pr = response.data[0];
+ } else {
+ core.setOutput('run-e2e', false);
+ console.log('No PR found matching the branch');
+ }
+ }
+
+ if (!pr) {
+ console.log('No PR found');
+ return;
+ }
+
+ const labels = pr.labels.map(label => label.name);
+ console.log('PR #', pr.number);
+ if (labels.includes('ready-for-e2e')) {
+ core.setOutput('run-e2e', true);
+ console.log('Found the label');
+ } else {
+ core.setOutput('run-e2e', false);
+ console.log('Did not find the label');
+ }
+
type-check:
name: Type check
- needs: [changes]
- if: ${{ needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
+ needs: [changes, check-label]
+ if: ${{ needs.check-label.outputs.run-jobs == 'true' && needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
uses: ./.github/workflows/check-types.yml
secrets: inherit
lint:
name: Linters
- needs: [changes]
- if: ${{ needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
+ needs: [changes, check-label]
+ if: ${{ needs.check-label.outputs.run-jobs == 'true' && needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
uses: ./.github/workflows/lint.yml
secrets: inherit
unit-test:
name: Tests
- needs: [changes]
- if: ${{ needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
+ needs: [changes, check-label]
+ if: ${{ needs.check-label.outputs.run-jobs == 'true' && needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
uses: ./.github/workflows/unit-tests.yml
secrets: inherit
integration-test:
name: Tests
- needs: [changes]
- if: ${{ needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
+ needs: [changes, check-label]
+ if: ${{ needs.check-label.outputs.run-jobs == 'true' && needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
uses: ./.github/workflows/integration-tests.yml
secrets: inherit
+ build-api-v1:
+ name: Production builds
+ needs: [changes, check-label]
+ if: ${{ needs.check-label.outputs.run-e2e == 'true' && needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
+ uses: ./.github/workflows/api-v1-production-build.yml
+ secrets: inherit
+
+ build-api-v2:
+ name: Production builds
+ needs: [changes, check-label]
+ if: ${{ needs.check-label.outputs.run-e2e == 'true' && needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
+ uses: ./.github/workflows/api-v2-production-build.yml
+ secrets: inherit
+
+ build:
+ name: Production builds
+ needs: [changes, check-label]
+ if: ${{ needs.check-label.outputs.run-e2e == 'true' && needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
+ uses: ./.github/workflows/production-build-without-database.yml
+ secrets: inherit
+
+ e2e:
+ name: Tests
+ needs: [changes, check-label, build]
+ if: ${{ needs.check-label.outputs.run-e2e == 'true' && needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
+ uses: ./.github/workflows/e2e.yml
+ secrets: inherit
+
+ e2e-app-store:
+ name: Tests
+ needs: [changes, check-label, build]
+ if: ${{ needs.check-label.outputs.run-e2e == 'true' && needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
+ uses: ./.github/workflows/e2e-app-store.yml
+ secrets: inherit
+
+ e2e-embed:
+ name: Tests
+ needs: [changes, check-label, build]
+ if: ${{ needs.check-label.outputs.run-e2e == 'true' && needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
+ uses: ./.github/workflows/e2e-embed.yml
+ secrets: inherit
+
+ e2e-embed-react:
+ name: Tests
+ needs: [changes, check-label, build]
+ if: ${{ needs.check-label.outputs.run-e2e == 'true' && needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
+ uses: ./.github/workflows/e2e-embed-react.yml
+ secrets: inherit
+
+ analyze:
+ name: Analyze Build
+ needs: [build]
+ uses: ./.github/workflows/nextjs-bundle-analysis.yml
+ secrets: inherit
+
required:
- needs: [changes, lint, type-check, unit-test, integration-test]
- if: always()
+ needs: [changes, lint, type-check, unit-test, integration-test, check-label, build, build-api-v1, build-api-v2, e2e, e2e-embed, e2e-embed-react, e2e-app-store]
+ if: ${{ needs.check-label.outputs.run-e2e == 'true' }}
runs-on: buildjet-2vcpu-ubuntu-2204
steps:
- name: fail if conditional jobs failed