From 7fa3c9466a25ab6e4e8c6934bec7bd7b04d65721 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=B3berta=20Andersen?= Date: Fri, 17 Jan 2025 14:33:07 +0000 Subject: [PATCH 1/6] chore: Adding QA steps to merge_group --- .github/workflows/merge-queue.yml | 211 ++++++++++++++++++++++++++++-- .github/workflows/pullrequest.yml | 2 +- 2 files changed, 198 insertions(+), 15 deletions(-) diff --git a/.github/workflows/merge-queue.yml b/.github/workflows/merge-queue.yml index 3bc9913c7889..93ba7713ede9 100644 --- a/.github/workflows/merge-queue.yml +++ b/.github/workflows/merge-queue.yml @@ -1,29 +1,212 @@ name: Validate code in the merge queue (post merge) on: - workflow_dispatch: + workflow_dispatch: {} merge_group: +defaults: + run: + shell: bash -euxo pipefail {0} + +concurrency: + group: merge-queue-post-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +env: + COMPOSE_HTTP_TIMEOUT: 180 + SKIP_GENERATED_CACHE: ${{ contains(github.event.pull_request.labels.*.name, 'skip-generated-cache') }} + NX_AFFECTED_ALL: ${{ contains(github.event.pull_request.labels.*.name, 'nx-affected-all') }} + CHUNK_SIZE: ${{ vars.CHUNK_SIZE || 3 }} + DISABLE_GROUPING: ${{ vars.DISABLE_GROUPING || false }} + DISABLE_CHUNKS: ${{ vars.DISABLE_CHUNKS || false }} + DISABLE_PROBLEMATIC: ${{ vars.DISABLE_PROBLEMATIC || false }} + MAX_JOBS: ${{ vars.MAX_JOBS || 2 }} + NX_PARALLEL: ${{ vars.NX_PARALLEL || 2 }} + NX_MAX_PARALLEL: ${{ vars.NX_MAX_PARALLEL || 4 }} jobs: - success: - runs-on: ec2-runners - container: - image: public.ecr.aws/m3u4c4h9/island-is/actions-runner-public:latest + prepare: + runs-on: arc-runners + timeout-minutes: 35 + env: + AFFECTED_ALL: ${{ secrets.AFFECTED_ALL }} + SERVERSIDE_FEATURES_ON: '' + DOCKER_REGISTRY: 821090935708.dkr.ecr.eu-west-1.amazonaws.com/ + + outputs: + CACHE_KEYS: ${{ steps.get_cache.outputs.keys }} + TEST_CHUNKS: ${{ steps.build_info.outputs.TEST_CHUNKS }} + E2E_CHUNKS: ${{ steps.build_info.outputs.E2E_CHUNKS }} + E2E_BUILD_ID: ${{ steps.build_info.outputs.BUILD_ID }} + BUILD_CHUNKS: ${{ steps.build_info.outputs.BUILD_CHUNKS }} steps: - - name: Dump GitHub context - env: - GITHUB_CONTEXT: ${{ toJson(github) }} + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - uses: actions/setup-node@v4 + with: + node-version-file: 'package.json' + + - name: Setup yarn + run: corepack enable + + - name: Get cache + id: get_cache + uses: ./.github/actions/get-cache + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + enable-cache: 'node_modules,cypress,generated-files' + + - uses: actions/setup-node@v4 + with: + node-version-file: 'package.json' + + - name: Setup yarn + run: corepack enable + + + - name: Derive appropriate SHAs + uses: nrwl/nx-set-shas@v4 + + + - name: Gather branch info + id: build_info run: | - echo "$GITHUB_CONTEXT" - - name: Announce success - run: echo "Build is successful" - codeowners-check: - name: Lint CODEOWNERS + export BASE=${{ env.NX_BASE }} + export HEAD=${{ env.NX_HEAD }} + + echo "TEST_CHUNKS={\"projects\":$(./scripts/ci/generate-chunks.sh test)}" >> "$GITHUB_OUTPUT" + echo "BUILD_CHUNKS={\"projects\":$(./scripts/ci/generate-chunks.sh build)}" >> "$GITHUB_OUTPUT" + echo "E2E_CHUNKS={\"projects\":$(./scripts/ci/generate-chunks.sh e2e-ci)}" >> "$GITHUB_OUTPUT" + echo BUILD_ID="$GITHUB_RUN_ID-$GITHUB_RUN_NUMBER-$(uuidgen)" >> "$GITHUB_OUTPUT" + + tests: + needs: + - prepare + if: needs.prepare.outputs.TEST_CHUNKS runs-on: ec2-runners container: image: public.ecr.aws/m3u4c4h9/island-is/actions-runner-public:latest env: - CHECK: 'false' + AFFECTED_PROJECTS: ${{ matrix.projects }} + strategy: + fail-fast: false + matrix: ${{ fromJson(needs.prepare.outputs.TEST_CHUNKS) }} + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version-file: 'package.json' + + - name: Setup yarn + run: corepack enable + + - name: Get cache + id: get-cache + uses: ./.github/actions/get-cache + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + keys: ${{ needs.prepare.outputs.CACHE_KEYS }} + enable-cache: 'node_modules,cypress,generated-files' + + - uses: ./.github/actions/unit-test + with: + dd-api-key: '${{ secrets.DD_API_KEY }}' + codecov-token: ${{ secrets.CODECOV_TOKEN }} + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + docker-registry: 821090935708.dkr.ecr.eu-west-1.amazonaws.com/ + + e2e: + needs: + - prepare + if: needs.prepare.outputs.E2E_CHUNKS + runs-on: arc-runners + timeout-minutes: 45 + env: + AFFECTED_PROJECT: ${{ matrix.projects }} + CYPRESS_PROJECT_ID: 4q7jz8 + CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} + API_MOCKS: 'true' + NODE_OPTIONS: --max-old-space-size=4096 + E2E_BUILD_ID: '${{ needs.prepare.outputs.E2E_BUILD_ID }}-${{ github.run_attempt }}' + strategy: + fail-fast: false + matrix: ${{ fromJson(needs.prepare.outputs.E2E_CHUNKS) }} + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version-file: 'package.json' + + - name: Setup yarn + run: corepack enable + + - name: Get cache + id: get-cache + uses: ./.github/actions/get-cache + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + keys: ${{ needs.prepare.outputs.CACHE_KEYS }} + enable-cache: 'node_modules,cypress,generated-files' + + - name: Running e2e tests + run: ./scripts/ci/40_e2e.sh "${AFFECTED_PROJECT}" + + build: + needs: + - prepare + runs-on: arc-runners + timeout-minutes: 35 + env: + AFFECTED_PROJECTS: ${{ matrix.projects }} + strategy: + fail-fast: true + matrix: ${{ fromJson(needs.prepare.outputs.BUILD_CHUNKS) }} + if: needs.prepare.outputs.BUILD_CHUNKS + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version-file: 'package.json' + - name: Setup yarn + run: corepack enable + - name: Get cache + id: get-cache + uses: ./.github/actions/get-cache + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + keys: ${{ needs.prepare.outputs.CACHE_KEYS }} + enable-cache: 'node_modules,generated-files' + + - name: Building + run: ./scripts/ci/run-in-parallel-native.sh build + + success: + runs-on: arc-runners + if: ${{ !cancelled() }} + needs: + - prepare + - tests + - e2e + - build + steps: + - name: Check prepare success + run: '[[ ${{ needs.prepare.result }} == "success" ]] || exit 1' + - name: Check tests success + run: '[[ ${{ needs.tests.result }} != "failure" ]] || exit 1' + - name: Check e2e success + run: '[[ ${{ needs.e2e.result }} != "failure" ]] || exit 1' + - name: Check build success + run: '[[ ${{ needs.build.result }} != "failure" ]] || exit 1' + + # Remove this as a required status check and switch to something more meaningful + codeowners-check: + name: Lint CODEOWNERS + runs-on: arc-runners steps: - name: Codeowners validation run: | diff --git a/.github/workflows/pullrequest.yml b/.github/workflows/pullrequest.yml index d4f5742f74fd..acfa672d7a66 100644 --- a/.github/workflows/pullrequest.yml +++ b/.github/workflows/pullrequest.yml @@ -205,7 +205,7 @@ jobs: fi - name: Check release-manager approval id: check-release-manager-approval - if: ${{ contains(github.event.pull_request.labels.*.name, 'automerge') && contains(github.event.pull_request.head.ref, '/pre-release/') }} + if: ${{ contains(github.event.pull_request.head.ref, '/pre-release/') }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | From 71e4c167b28841342a0445afd09a190161466fd7 Mon Sep 17 00:00:00 2001 From: andes-it Date: Thu, 30 Jan 2025 10:14:06 +0000 Subject: [PATCH 2/6] chore: nx format:write update dirty files --- .github/workflows/merge-queue.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/merge-queue.yml b/.github/workflows/merge-queue.yml index 93ba7713ede9..e8ad9784e646 100644 --- a/.github/workflows/merge-queue.yml +++ b/.github/workflows/merge-queue.yml @@ -65,11 +65,9 @@ jobs: - name: Setup yarn run: corepack enable - - name: Derive appropriate SHAs uses: nrwl/nx-set-shas@v4 - - name: Gather branch info id: build_info run: | From 4bc2a331093e8c164ceaaabd6e890b7740fbf1cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=B3berta=20Andersen?= Date: Thu, 30 Jan 2025 10:20:07 +0000 Subject: [PATCH 3/6] remove duplicate code --- .github/workflows/merge-queue.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/merge-queue.yml b/.github/workflows/merge-queue.yml index e8ad9784e646..90c471699b9c 100644 --- a/.github/workflows/merge-queue.yml +++ b/.github/workflows/merge-queue.yml @@ -58,13 +58,6 @@ jobs: github-token: ${{ secrets.GITHUB_TOKEN }} enable-cache: 'node_modules,cypress,generated-files' - - uses: actions/setup-node@v4 - with: - node-version-file: 'package.json' - - - name: Setup yarn - run: corepack enable - - name: Derive appropriate SHAs uses: nrwl/nx-set-shas@v4 From 54ec7e267635b1d66faf6bcedbc05d288d45d564 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=B3berta=20Andersen?= Date: Thu, 30 Jan 2025 10:41:49 +0000 Subject: [PATCH 4/6] arc --- .github/workflows/pullrequest-lint.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/pullrequest-lint.yml b/.github/workflows/pullrequest-lint.yml index f7b04171a1c8..8b8293d9ffe7 100644 --- a/.github/workflows/pullrequest-lint.yml +++ b/.github/workflows/pullrequest-lint.yml @@ -14,9 +14,7 @@ defaults: jobs: lint: name: Lint PR title - runs-on: ec2-runners - container: - image: public.ecr.aws/m3u4c4h9/island-is/actions-runner-public:latest + runs-on: arc-runners steps: - uses: amannn/action-semantic-pull-request@v5 with: From 53e3bb427d753b63901811309b43e4386dc7eaec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=B3berta=20Andersen?= Date: Thu, 30 Jan 2025 10:44:43 +0000 Subject: [PATCH 5/6] arc --- .github/workflows/external-checks.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/external-checks.yml b/.github/workflows/external-checks.yml index 4258c03ab4aa..b788092cb8b2 100644 --- a/.github/workflows/external-checks.yml +++ b/.github/workflows/external-checks.yml @@ -11,9 +11,7 @@ defaults: jobs: codeowners-check: name: Lint CODEOWNERS - runs-on: ec2-runners - container: - image: public.ecr.aws/m3u4c4h9/island-is/actions-runner-public:latest + runs-on: arc-runners env: CHECK: 'false' steps: From 323e4250310d44fd4a39bbec3efaa4a069464351 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=B3berta=20Andersen?= Date: Thu, 30 Jan 2025 10:49:15 +0000 Subject: [PATCH 6/6] arc --- .github/workflows/pullrequest.yml | 24 ++++++------------------ .github/workflows/push.yml | 12 +++--------- 2 files changed, 9 insertions(+), 27 deletions(-) diff --git a/.github/workflows/pullrequest.yml b/.github/workflows/pullrequest.yml index acfa672d7a66..b5457b62191a 100644 --- a/.github/workflows/pullrequest.yml +++ b/.github/workflows/pullrequest.yml @@ -27,9 +27,7 @@ env: jobs: prepare: - runs-on: ec2-runners - container: - image: public.ecr.aws/m3u4c4h9/island-is/actions-runner-public:latest + runs-on: arc-runners timeout-minutes: 35 env: @@ -295,9 +293,7 @@ jobs: linting-workspace: needs: - prepare - runs-on: ec2-runners - container: - image: public.ecr.aws/m3u4c4h9/island-is/actions-runner-public:latest + runs-on: arc-runners timeout-minutes: 5 steps: - uses: actions/checkout@v4 @@ -335,9 +331,7 @@ jobs: formatting: needs: - prepare - runs-on: ec2-runners - container: - image: public.ecr.aws/m3u4c4h9/island-is/actions-runner-public:latest + runs-on: arc-runners timeout-minutes: 5 steps: - uses: actions/checkout@v4 @@ -376,9 +370,7 @@ jobs: linting: needs: - prepare - runs-on: ec2-runners - container: - image: public.ecr.aws/m3u4c4h9/island-is/actions-runner-public:latest + runs-on: arc-runners timeout-minutes: 35 if: needs.prepare.outputs.LINT_CHUNKS env: @@ -407,9 +399,7 @@ jobs: build: needs: - prepare - runs-on: ec2-runners - container: - image: public.ecr.aws/m3u4c4h9/island-is/actions-runner-public:latest + runs-on: arc-runners timeout-minutes: 35 env: AFFECTED_PROJECTS: ${{ matrix.projects }} @@ -436,9 +426,7 @@ jobs: run: ./scripts/ci/run-in-parallel-native.sh build success: - runs-on: ec2-runners - container: - image: public.ecr.aws/m3u4c4h9/island-is/actions-runner-public:latest + runs-on: arc-runners if: ${{ !cancelled() }} needs: - prepare diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 8924dc31a229..90574a94586a 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -48,9 +48,7 @@ env: jobs: pre-checks: name: Check if job should run - runs-on: ec2-runners - container: - image: public.ecr.aws/m3u4c4h9/island-is/actions-runner-public:latest + runs-on: arc-runners env: CREATE_PATTERNS: ^release/ PRE_RELEASE_PATTERN: ^pre-release/ @@ -150,9 +148,7 @@ jobs: echo "PRE_CHECK=push" >> "$GITHUB_OUTPUT" prepare: - runs-on: ec2-runners - container: - image: public.ecr.aws/m3u4c4h9/island-is/actions-runner-public:latest + runs-on: arc-runners timeout-minutes: 90 if: needs.pre-checks.outputs.PRE_CHECK @@ -458,9 +454,7 @@ jobs: needs: - prepare if: needs.prepare.outputs.TEST_CHUNKS - runs-on: ec2-runners - container: - image: public.ecr.aws/m3u4c4h9/island-is/actions-runner-public:latest + runs-on: arc-runners timeout-minutes: 35 env: AFFECTED_PROJECTS: ${{ matrix.projects }}