From 1d24b580700cf794420883e81f6b0dcc432b0269 Mon Sep 17 00:00:00 2001 From: 1Copenut Date: Mon, 18 Sep 2023 16:35:36 -0500 Subject: [PATCH 01/12] Refactoring test Bash script for parallelization. --- .buildkite/scripts/pipeline_test.sh | 44 +++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 12 deletions(-) diff --git a/.buildkite/scripts/pipeline_test.sh b/.buildkite/scripts/pipeline_test.sh index 7fef13e2c04..0a2a40f8aa5 100644 --- a/.buildkite/scripts/pipeline_test.sh +++ b/.buildkite/scripts/pipeline_test.sh @@ -2,15 +2,35 @@ set -euo pipefail -docker run \ - -i --rm \ - --env GIT_COMMITTER_NAME=test \ - --env GIT_COMMITTER_EMAIL=test \ - --env HOME=/tmp \ - --user="$(id -u):$(id -g)" \ - --volume="$(pwd):/app" \ - --workdir=/app \ - docker.elastic.co/eui/ci:5.3 \ - bash -c "/opt/yarn*/bin/yarn \ - && yarn cypress install \ - && NODE_OPTIONS=\"--max-old-space-size=2048\" npm run test-ci" +TEST_TYPE='unit' + +DOCKER_OPTIONS=( + -i --rm + --env GIT_COMMITTER_NAME=test + --env GIT_COMMITTER_EMAIL=test + --env HOME=/tmp + --user="$(id -u):$(id -g)" + --volume="$(pwd):/app" + --workdir=/app + docker.elastic.co/eui/ci:5.3 + bash -c "/opt/yarn*/bin/yarn" +) + +if [[ "${TEST_TYPE}" == 'lint' ]]; then + echo "[TASK]: Running linters" + DOCKER_OPTIONS+=("NODE_OPTIONS=\"--max-old-space-size=2048\" yarn lint") +elif [[ "${TEST_TYPE}" == 'unit' ]]; then + echo "[TASK]: Running unit tests" + DOCKER_OPTIONS+=("NODE_OPTIONS=\"--max-old-space-size=2048\" yarn test-unit") +elif [[ "${TEST_TYPE}" == 'cypress:16' ]]; then + echo "[TASK]: Running Cypress tests against React 16" + DOCKER_OPTIONS+=("yarn cypress install" "NODE_OPTIONS=\"--max-old-space-size=2048\" yarn test-cypress --react-version 16") +elif [[ "${TEST_TYPE}" == 'cypress:17' ]]; then + echo "[TASK]: Running Cypress tests against React 17" + DOCKER_OPTIONS+=("yarn cypress install" "NODE_OPTIONS=\"--max-old-space-size=2048\" yarn test-cypress --react-version 17") +elif [[ "${TEST_TYPE}" == 'cypress:18' ]]; then + echo "[TASK]: Running Cypress tests against React 18" + DOCKER_OPTIONS+=("yarn cypress install" "NODE_OPTIONS=\"--max-old-space-size=2048\" yarn test-cypress --react-version 18") +fi + +docker run "${DOCKER_OPTIONS[@]}" From f5442c7c507bf37d2bbb9099b39e0526f1eeebfd Mon Sep 17 00:00:00 2001 From: 1Copenut Date: Mon, 18 Sep 2023 16:36:02 -0500 Subject: [PATCH 02/12] Splitting test tasks linting and unit testing. --- .buildkite/pipelines/pipeline_pull_request_test.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.buildkite/pipelines/pipeline_pull_request_test.yml b/.buildkite/pipelines/pipeline_pull_request_test.yml index af25c625a9f..31cf0187280 100644 --- a/.buildkite/pipelines/pipeline_pull_request_test.yml +++ b/.buildkite/pipelines/pipeline_pull_request_test.yml @@ -3,7 +3,11 @@ steps: - agents: provider: "gcp" - command: .buildkite/scripts/pipeline_test.sh + - command: .buildkite/scripts/pipeline_test.sh + env: + TEST_TYPE: 'lint' + if: build.branch != "main" # We're skipping testing commits in main for now to maintain parity with previous Jenkins setup + - command: .buildkite/scripts/pipeline_test.sh + env: + TEST_TYPE: 'unit' if: build.branch != "main" # We're skipping testing commits in main for now to maintain parity with previous Jenkins setup - artifact_paths: - - "cypress/screenshots/**/*.png" From 69fd82c6006c84a517a7e83b8b1cd40ff1cc87c9 Mon Sep 17 00:00:00 2001 From: 1Copenut Date: Mon, 18 Sep 2023 16:42:03 -0500 Subject: [PATCH 03/12] Moved agents declaration into individual steps. --- .buildkite/pipelines/pipeline_pull_request_test.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.buildkite/pipelines/pipeline_pull_request_test.yml b/.buildkite/pipelines/pipeline_pull_request_test.yml index 31cf0187280..f48ddf661af 100644 --- a/.buildkite/pipelines/pipeline_pull_request_test.yml +++ b/.buildkite/pipelines/pipeline_pull_request_test.yml @@ -1,13 +1,15 @@ # 🏠/.buildkite/pipelines/pipeline_pull_request_test.yml steps: - - agents: - provider: "gcp" - command: .buildkite/scripts/pipeline_test.sh + agents: + provider: "gcp" env: TEST_TYPE: 'lint' if: build.branch != "main" # We're skipping testing commits in main for now to maintain parity with previous Jenkins setup - command: .buildkite/scripts/pipeline_test.sh + agents: + provider: "gcp" env: TEST_TYPE: 'unit' if: build.branch != "main" # We're skipping testing commits in main for now to maintain parity with previous Jenkins setup From 2fb57476f291a368bc5d4e58a9ca0085eeced4eb Mon Sep 17 00:00:00 2001 From: 1Copenut Date: Mon, 18 Sep 2023 16:57:30 -0500 Subject: [PATCH 04/12] Was missing the double ampersand to run Yarn commands. --- .buildkite/scripts/pipeline_test.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.buildkite/scripts/pipeline_test.sh b/.buildkite/scripts/pipeline_test.sh index 0a2a40f8aa5..f666bf56724 100644 --- a/.buildkite/scripts/pipeline_test.sh +++ b/.buildkite/scripts/pipeline_test.sh @@ -18,19 +18,19 @@ DOCKER_OPTIONS=( if [[ "${TEST_TYPE}" == 'lint' ]]; then echo "[TASK]: Running linters" - DOCKER_OPTIONS+=("NODE_OPTIONS=\"--max-old-space-size=2048\" yarn lint") + DOCKER_OPTIONS+=("&& NODE_OPTIONS=\"--max-old-space-size=2048\" yarn lint") elif [[ "${TEST_TYPE}" == 'unit' ]]; then echo "[TASK]: Running unit tests" - DOCKER_OPTIONS+=("NODE_OPTIONS=\"--max-old-space-size=2048\" yarn test-unit") + DOCKER_OPTIONS+=("&& NODE_OPTIONS=\"--max-old-space-size=2048\" yarn test-unit") elif [[ "${TEST_TYPE}" == 'cypress:16' ]]; then echo "[TASK]: Running Cypress tests against React 16" - DOCKER_OPTIONS+=("yarn cypress install" "NODE_OPTIONS=\"--max-old-space-size=2048\" yarn test-cypress --react-version 16") + DOCKER_OPTIONS+=("&& yarn cypress install" "&& NODE_OPTIONS=\"--max-old-space-size=2048\" yarn test-cypress --react-version 16") elif [[ "${TEST_TYPE}" == 'cypress:17' ]]; then echo "[TASK]: Running Cypress tests against React 17" - DOCKER_OPTIONS+=("yarn cypress install" "NODE_OPTIONS=\"--max-old-space-size=2048\" yarn test-cypress --react-version 17") + DOCKER_OPTIONS+=("&& yarn cypress install" "&& NODE_OPTIONS=\"--max-old-space-size=2048\" yarn test-cypress --react-version 17") elif [[ "${TEST_TYPE}" == 'cypress:18' ]]; then echo "[TASK]: Running Cypress tests against React 18" - DOCKER_OPTIONS+=("yarn cypress install" "NODE_OPTIONS=\"--max-old-space-size=2048\" yarn test-cypress --react-version 18") + DOCKER_OPTIONS+=("&& yarn cypress install" "&& NODE_OPTIONS=\"--max-old-space-size=2048\" yarn test-cypress --react-version 18") fi docker run "${DOCKER_OPTIONS[@]}" From 0902f9af131533f25708ca68400c966b4723e51f Mon Sep 17 00:00:00 2001 From: 1Copenut Date: Mon, 18 Sep 2023 17:09:06 -0500 Subject: [PATCH 05/12] Restoring Cypress install to all commands. --- .buildkite/scripts/pipeline_test.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.buildkite/scripts/pipeline_test.sh b/.buildkite/scripts/pipeline_test.sh index f666bf56724..88294253704 100644 --- a/.buildkite/scripts/pipeline_test.sh +++ b/.buildkite/scripts/pipeline_test.sh @@ -2,7 +2,7 @@ set -euo pipefail -TEST_TYPE='unit' +# TEST_TYPE='unit' DOCKER_OPTIONS=( -i --rm @@ -18,10 +18,10 @@ DOCKER_OPTIONS=( if [[ "${TEST_TYPE}" == 'lint' ]]; then echo "[TASK]: Running linters" - DOCKER_OPTIONS+=("&& NODE_OPTIONS=\"--max-old-space-size=2048\" yarn lint") + DOCKER_OPTIONS+=("&& yarn cypress install" "&& NODE_OPTIONS=\"--max-old-space-size=2048\" yarn lint") elif [[ "${TEST_TYPE}" == 'unit' ]]; then echo "[TASK]: Running unit tests" - DOCKER_OPTIONS+=("&& NODE_OPTIONS=\"--max-old-space-size=2048\" yarn test-unit") + DOCKER_OPTIONS+=("&& yarn cypress install" "&& NODE_OPTIONS=\"--max-old-space-size=2048\" yarn test-unit") elif [[ "${TEST_TYPE}" == 'cypress:16' ]]; then echo "[TASK]: Running Cypress tests against React 16" DOCKER_OPTIONS+=("&& yarn cypress install" "&& NODE_OPTIONS=\"--max-old-space-size=2048\" yarn test-cypress --react-version 16") From 7967c917eaffce2a980fa241cfe91277f78e7caa Mon Sep 17 00:00:00 2001 From: 1Copenut Date: Tue, 19 Sep 2023 09:53:26 -0500 Subject: [PATCH 06/12] Adjusting conditional array adds to be one string each. --- .buildkite/scripts/pipeline_test.sh | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/.buildkite/scripts/pipeline_test.sh b/.buildkite/scripts/pipeline_test.sh index 88294253704..ed41426fb77 100644 --- a/.buildkite/scripts/pipeline_test.sh +++ b/.buildkite/scripts/pipeline_test.sh @@ -2,8 +2,6 @@ set -euo pipefail -# TEST_TYPE='unit' - DOCKER_OPTIONS=( -i --rm --env GIT_COMMITTER_NAME=test @@ -13,24 +11,23 @@ DOCKER_OPTIONS=( --volume="$(pwd):/app" --workdir=/app docker.elastic.co/eui/ci:5.3 - bash -c "/opt/yarn*/bin/yarn" ) if [[ "${TEST_TYPE}" == 'lint' ]]; then echo "[TASK]: Running linters" - DOCKER_OPTIONS+=("&& yarn cypress install" "&& NODE_OPTIONS=\"--max-old-space-size=2048\" yarn lint") + DOCKER_OPTIONS+=(bash -c \"/opt/yarn\*/bin/yarn \&\& yarn cypress install \&\& NODE_OPTIONS=\"--max-old-space-size=2048\" yarn lint\") elif [[ "${TEST_TYPE}" == 'unit' ]]; then echo "[TASK]: Running unit tests" - DOCKER_OPTIONS+=("&& yarn cypress install" "&& NODE_OPTIONS=\"--max-old-space-size=2048\" yarn test-unit") + DOCKER_OPTIONS+=(bash -c \"/opt/yarn\*/bin/yarn \&\& yarn cypress install \&\& NODE_OPTIONS=\"--max-old-space-size=2048\" yarn test-unit\") elif [[ "${TEST_TYPE}" == 'cypress:16' ]]; then echo "[TASK]: Running Cypress tests against React 16" - DOCKER_OPTIONS+=("&& yarn cypress install" "&& NODE_OPTIONS=\"--max-old-space-size=2048\" yarn test-cypress --react-version 16") + DOCKER_OPTIONS+=(bash -c \"/opt/yarn\*/bin/yarn \&\& yarn cypress install \&\& NODE_OPTIONS=\"--max-old-space-size=2048\" yarn test-cypress --react-version 16\") elif [[ "${TEST_TYPE}" == 'cypress:17' ]]; then echo "[TASK]: Running Cypress tests against React 17" - DOCKER_OPTIONS+=("&& yarn cypress install" "&& NODE_OPTIONS=\"--max-old-space-size=2048\" yarn test-cypress --react-version 17") + DOCKER_OPTIONS+=(bash -c \"/opt/yarn\*/bin/yarn \&\& yarn cypress install \&\& NODE_OPTIONS=\"--max-old-space-size=2048\" yarn test-cypress --react-version 17\") elif [[ "${TEST_TYPE}" == 'cypress:18' ]]; then echo "[TASK]: Running Cypress tests against React 18" - DOCKER_OPTIONS+=("&& yarn cypress install" "&& NODE_OPTIONS=\"--max-old-space-size=2048\" yarn test-cypress --react-version 18") + DOCKER_OPTIONS+=(bash -c \"/opt/yarn\*/bin/yarn \&\& yarn cypress install \&\& NODE_OPTIONS=\"--max-old-space-size=2048\" yarn test-cypress --react-version 18\") fi docker run "${DOCKER_OPTIONS[@]}" From 3c4493c37c5f6249b495f4683e7a860e9a40e827 Mon Sep 17 00:00:00 2001 From: 1Copenut Date: Tue, 19 Sep 2023 10:08:28 -0500 Subject: [PATCH 07/12] Removed double quote literals for bash -c command. --- .buildkite/scripts/pipeline_test.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.buildkite/scripts/pipeline_test.sh b/.buildkite/scripts/pipeline_test.sh index ed41426fb77..a037d30e313 100644 --- a/.buildkite/scripts/pipeline_test.sh +++ b/.buildkite/scripts/pipeline_test.sh @@ -15,19 +15,19 @@ DOCKER_OPTIONS=( if [[ "${TEST_TYPE}" == 'lint' ]]; then echo "[TASK]: Running linters" - DOCKER_OPTIONS+=(bash -c \"/opt/yarn\*/bin/yarn \&\& yarn cypress install \&\& NODE_OPTIONS=\"--max-old-space-size=2048\" yarn lint\") + DOCKER_OPTIONS+=(bash -c "/opt/yarn*/bin/yarn && yarn cypress install && NODE_OPTIONS=\"--max-old-space-size=2048\" yarn lint") elif [[ "${TEST_TYPE}" == 'unit' ]]; then echo "[TASK]: Running unit tests" - DOCKER_OPTIONS+=(bash -c \"/opt/yarn\*/bin/yarn \&\& yarn cypress install \&\& NODE_OPTIONS=\"--max-old-space-size=2048\" yarn test-unit\") + DOCKER_OPTIONS+=(bash -c "/opt/yarn\*/bin/yarn \&\& yarn cypress install \&\& NODE_OPTIONS=\"--max-old-space-size=2048\" yarn test-unit") elif [[ "${TEST_TYPE}" == 'cypress:16' ]]; then echo "[TASK]: Running Cypress tests against React 16" - DOCKER_OPTIONS+=(bash -c \"/opt/yarn\*/bin/yarn \&\& yarn cypress install \&\& NODE_OPTIONS=\"--max-old-space-size=2048\" yarn test-cypress --react-version 16\") + DOCKER_OPTIONS+=(bash -c "/opt/yarn\*/bin/yarn \&\& yarn cypress install \&\& NODE_OPTIONS=\"--max-old-space-size=2048\" yarn test-cypress --react-version 16") elif [[ "${TEST_TYPE}" == 'cypress:17' ]]; then echo "[TASK]: Running Cypress tests against React 17" - DOCKER_OPTIONS+=(bash -c \"/opt/yarn\*/bin/yarn \&\& yarn cypress install \&\& NODE_OPTIONS=\"--max-old-space-size=2048\" yarn test-cypress --react-version 17\") + DOCKER_OPTIONS+=(bash -c "/opt/yarn\*/bin/yarn \&\& yarn cypress install \&\& NODE_OPTIONS=\"--max-old-space-size=2048\" yarn test-cypress --react-version 17") elif [[ "${TEST_TYPE}" == 'cypress:18' ]]; then echo "[TASK]: Running Cypress tests against React 18" - DOCKER_OPTIONS+=(bash -c \"/opt/yarn\*/bin/yarn \&\& yarn cypress install \&\& NODE_OPTIONS=\"--max-old-space-size=2048\" yarn test-cypress --react-version 18\") + DOCKER_OPTIONS+=(bash -c "/opt/yarn\*/bin/yarn \&\& yarn cypress install \&\& NODE_OPTIONS=\"--max-old-space-size=2048\" yarn test-cypress --react-version 18") fi docker run "${DOCKER_OPTIONS[@]}" From 4d04d639471c0ebf333031531cfe1389926d4e42 Mon Sep 17 00:00:00 2001 From: 1Copenut Date: Tue, 19 Sep 2023 10:29:57 -0500 Subject: [PATCH 08/12] Updating all bash strings after successful lint run. Adding one Cypress test to BK runner. --- .buildkite/pipelines/pipeline_pull_request_test.yml | 6 ++++++ .buildkite/scripts/pipeline_test.sh | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.buildkite/pipelines/pipeline_pull_request_test.yml b/.buildkite/pipelines/pipeline_pull_request_test.yml index f48ddf661af..05283cc2d07 100644 --- a/.buildkite/pipelines/pipeline_pull_request_test.yml +++ b/.buildkite/pipelines/pipeline_pull_request_test.yml @@ -13,3 +13,9 @@ steps: env: TEST_TYPE: 'unit' if: build.branch != "main" # We're skipping testing commits in main for now to maintain parity with previous Jenkins setup + - command: .buildkite/scripts/pipeline_test.sh + agents: + provider: "gcp" + env: + TEST_TYPE: 'cypress:18' + if: build.branch != "main" # We're skipping testing commits in main for now to maintain parity with previous Jenkins setup diff --git a/.buildkite/scripts/pipeline_test.sh b/.buildkite/scripts/pipeline_test.sh index a037d30e313..40fb260403a 100644 --- a/.buildkite/scripts/pipeline_test.sh +++ b/.buildkite/scripts/pipeline_test.sh @@ -18,16 +18,16 @@ if [[ "${TEST_TYPE}" == 'lint' ]]; then DOCKER_OPTIONS+=(bash -c "/opt/yarn*/bin/yarn && yarn cypress install && NODE_OPTIONS=\"--max-old-space-size=2048\" yarn lint") elif [[ "${TEST_TYPE}" == 'unit' ]]; then echo "[TASK]: Running unit tests" - DOCKER_OPTIONS+=(bash -c "/opt/yarn\*/bin/yarn \&\& yarn cypress install \&\& NODE_OPTIONS=\"--max-old-space-size=2048\" yarn test-unit") + DOCKER_OPTIONS+=(bash -c "/opt/yarn*/bin/yarn && yarn cypress install && NODE_OPTIONS=\"--max-old-space-size=2048\" yarn test-unit") elif [[ "${TEST_TYPE}" == 'cypress:16' ]]; then echo "[TASK]: Running Cypress tests against React 16" - DOCKER_OPTIONS+=(bash -c "/opt/yarn\*/bin/yarn \&\& yarn cypress install \&\& NODE_OPTIONS=\"--max-old-space-size=2048\" yarn test-cypress --react-version 16") + DOCKER_OPTIONS+=(bash -c "/opt/yarn*/bin/yarn && yarn cypress install && NODE_OPTIONS=\"--max-old-space-size=2048\" yarn test-cypress --react-version 16") elif [[ "${TEST_TYPE}" == 'cypress:17' ]]; then echo "[TASK]: Running Cypress tests against React 17" - DOCKER_OPTIONS+=(bash -c "/opt/yarn\*/bin/yarn \&\& yarn cypress install \&\& NODE_OPTIONS=\"--max-old-space-size=2048\" yarn test-cypress --react-version 17") + DOCKER_OPTIONS+=(bash -c "/opt/yarn*/bin/yarn && yarn cypress install && NODE_OPTIONS=\"--max-old-space-size=2048\" yarn test-cypress --react-version 17") elif [[ "${TEST_TYPE}" == 'cypress:18' ]]; then echo "[TASK]: Running Cypress tests against React 18" - DOCKER_OPTIONS+=(bash -c "/opt/yarn\*/bin/yarn \&\& yarn cypress install \&\& NODE_OPTIONS=\"--max-old-space-size=2048\" yarn test-cypress --react-version 18") + DOCKER_OPTIONS+=(bash -c "/opt/yarn*/bin/yarn && yarn cypress install && NODE_OPTIONS=\"--max-old-space-size=2048\" yarn test-cypress") fi docker run "${DOCKER_OPTIONS[@]}" From d2a29f43610f6efd9b8f3125a512f1d689fab10f Mon Sep 17 00:00:00 2001 From: 1Copenut Date: Tue, 19 Sep 2023 12:14:06 -0500 Subject: [PATCH 09/12] Adding Cypress runs for React 16 and 17. --- .../pipelines/pipeline_pull_request_test.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.buildkite/pipelines/pipeline_pull_request_test.yml b/.buildkite/pipelines/pipeline_pull_request_test.yml index 05283cc2d07..f5ce8a9aa39 100644 --- a/.buildkite/pipelines/pipeline_pull_request_test.yml +++ b/.buildkite/pipelines/pipeline_pull_request_test.yml @@ -13,9 +13,27 @@ steps: env: TEST_TYPE: 'unit' if: build.branch != "main" # We're skipping testing commits in main for now to maintain parity with previous Jenkins setup + - command: .buildkite/scripts/pipeline_test.sh + agents: + provider: "gcp" + env: + TEST_TYPE: 'cypress:16' + if: build.branch != "main" # We're skipping testing commits in main for now to maintain parity with previous Jenkins setup + artifact_paths: + - "cypress/react16/screenshots/**/*.png" + - command: .buildkite/scripts/pipeline_test.sh + agents: + provider: "gcp" + env: + TEST_TYPE: 'cypress:17' + if: build.branch != "main" # We're skipping testing commits in main for now to maintain parity with previous Jenkins setup + artifact_paths: + - "cypress/react17/screenshots/**/*.png" - command: .buildkite/scripts/pipeline_test.sh agents: provider: "gcp" env: TEST_TYPE: 'cypress:18' if: build.branch != "main" # We're skipping testing commits in main for now to maintain parity with previous Jenkins setup + artifact_paths: + - "cypress/react18/screenshots/**/*.png" From 2818174a45da537ffdf7a282bf335ac30950df87 Mon Sep 17 00:00:00 2001 From: 1Copenut Date: Tue, 19 Sep 2023 12:15:14 -0500 Subject: [PATCH 10/12] Refactoring test pipeline to switch case for readability. --- .buildkite/scripts/pipeline_test.sh | 48 +++++++++++++++++++---------- 1 file changed, 32 insertions(+), 16 deletions(-) diff --git a/.buildkite/scripts/pipeline_test.sh b/.buildkite/scripts/pipeline_test.sh index 40fb260403a..f80576cbd43 100644 --- a/.buildkite/scripts/pipeline_test.sh +++ b/.buildkite/scripts/pipeline_test.sh @@ -13,21 +13,37 @@ DOCKER_OPTIONS=( docker.elastic.co/eui/ci:5.3 ) -if [[ "${TEST_TYPE}" == 'lint' ]]; then - echo "[TASK]: Running linters" - DOCKER_OPTIONS+=(bash -c "/opt/yarn*/bin/yarn && yarn cypress install && NODE_OPTIONS=\"--max-old-space-size=2048\" yarn lint") -elif [[ "${TEST_TYPE}" == 'unit' ]]; then - echo "[TASK]: Running unit tests" - DOCKER_OPTIONS+=(bash -c "/opt/yarn*/bin/yarn && yarn cypress install && NODE_OPTIONS=\"--max-old-space-size=2048\" yarn test-unit") -elif [[ "${TEST_TYPE}" == 'cypress:16' ]]; then - echo "[TASK]: Running Cypress tests against React 16" - DOCKER_OPTIONS+=(bash -c "/opt/yarn*/bin/yarn && yarn cypress install && NODE_OPTIONS=\"--max-old-space-size=2048\" yarn test-cypress --react-version 16") -elif [[ "${TEST_TYPE}" == 'cypress:17' ]]; then - echo "[TASK]: Running Cypress tests against React 17" - DOCKER_OPTIONS+=(bash -c "/opt/yarn*/bin/yarn && yarn cypress install && NODE_OPTIONS=\"--max-old-space-size=2048\" yarn test-cypress --react-version 17") -elif [[ "${TEST_TYPE}" == 'cypress:18' ]]; then - echo "[TASK]: Running Cypress tests against React 18" - DOCKER_OPTIONS+=(bash -c "/opt/yarn*/bin/yarn && yarn cypress install && NODE_OPTIONS=\"--max-old-space-size=2048\" yarn test-cypress") -fi +case $TEST_TYPE in + lint) + echo "[TASK]: Running linters" + DOCKER_OPTIONS+=(bash -c "/opt/yarn*/bin/yarn && yarn cypress install && NODE_OPTIONS=\"--max-old-space-size=2048\" yarn lint") + ;; + + unit) + echo "[TASK]: Running unit tests" + DOCKER_OPTIONS+=(bash -c "/opt/yarn*/bin/yarn && yarn cypress install && NODE_OPTIONS=\"--max-old-space-size=2048\" yarn test-unit") + ;; + + cypress:16) + echo "[TASK]: Running Cypress tests against React 16" + DOCKER_OPTIONS+=(bash -c "/opt/yarn*/bin/yarn && yarn cypress install && NODE_OPTIONS=\"--max-old-space-size=2048\" yarn test-cypress --react-version 16") + ;; + + cypress:17) + echo "[TASK]: Running Cypress tests against React 17" + DOCKER_OPTIONS+=(bash -c "/opt/yarn*/bin/yarn && yarn cypress install && NODE_OPTIONS=\"--max-old-space-size=2048\" yarn test-cypress --react-version 17") + ;; + + cypress:18) + echo "[TASK]: Running Cypress tests against React 18" + DOCKER_OPTIONS+=(bash -c "/opt/yarn*/bin/yarn && yarn cypress install && NODE_OPTIONS=\"--max-old-space-size=2048\" yarn test-cypress") + ;; + + *) + echo "[ERROR]: Unknown task" + echo "Exit code: 1" + exit 1 + ;; +esac docker run "${DOCKER_OPTIONS[@]}" From 779c58473a865f2d41238a7829cbc466e96c7645 Mon Sep 17 00:00:00 2001 From: 1Copenut Date: Tue, 19 Sep 2023 12:50:59 -0500 Subject: [PATCH 11/12] Labeling steps for task recognition. --- .buildkite/pipelines/pipeline_pull_request_test.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.buildkite/pipelines/pipeline_pull_request_test.yml b/.buildkite/pipelines/pipeline_pull_request_test.yml index f5ce8a9aa39..4f20892efcb 100644 --- a/.buildkite/pipelines/pipeline_pull_request_test.yml +++ b/.buildkite/pipelines/pipeline_pull_request_test.yml @@ -2,18 +2,21 @@ steps: - command: .buildkite/scripts/pipeline_test.sh + label: ":typescript: Linting" agents: provider: "gcp" env: TEST_TYPE: 'lint' if: build.branch != "main" # We're skipping testing commits in main for now to maintain parity with previous Jenkins setup - command: .buildkite/scripts/pipeline_test.sh + label: ":jest: Unit tests" agents: provider: "gcp" env: TEST_TYPE: 'unit' if: build.branch != "main" # We're skipping testing commits in main for now to maintain parity with previous Jenkins setup - command: .buildkite/scripts/pipeline_test.sh + label: ":cypress: Cypress tests on React 16" agents: provider: "gcp" env: @@ -22,6 +25,7 @@ steps: artifact_paths: - "cypress/react16/screenshots/**/*.png" - command: .buildkite/scripts/pipeline_test.sh + label: ":cypress: Cypress tests on React 17" agents: provider: "gcp" env: @@ -30,6 +34,7 @@ steps: artifact_paths: - "cypress/react17/screenshots/**/*.png" - command: .buildkite/scripts/pipeline_test.sh + label: ":cypress: Cypress tests on React 18" agents: provider: "gcp" env: From 09fe4e88a1522c251b641b2521928e5c04bfde9d Mon Sep 17 00:00:00 2001 From: 1Copenut Date: Tue, 19 Sep 2023 13:21:23 -0500 Subject: [PATCH 12/12] Updating comment about branch filter. --- .buildkite/pipelines/pipeline_pull_request_test.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.buildkite/pipelines/pipeline_pull_request_test.yml b/.buildkite/pipelines/pipeline_pull_request_test.yml index 4f20892efcb..a983a2f1b75 100644 --- a/.buildkite/pipelines/pipeline_pull_request_test.yml +++ b/.buildkite/pipelines/pipeline_pull_request_test.yml @@ -7,21 +7,21 @@ steps: provider: "gcp" env: TEST_TYPE: 'lint' - if: build.branch != "main" # We're skipping testing commits in main for now to maintain parity with previous Jenkins setup + if: build.branch != "main" # This job is triggered by the combined test and deploy docs for every PR - command: .buildkite/scripts/pipeline_test.sh label: ":jest: Unit tests" agents: provider: "gcp" env: TEST_TYPE: 'unit' - if: build.branch != "main" # We're skipping testing commits in main for now to maintain parity with previous Jenkins setup + if: build.branch != "main" - command: .buildkite/scripts/pipeline_test.sh label: ":cypress: Cypress tests on React 16" agents: provider: "gcp" env: TEST_TYPE: 'cypress:16' - if: build.branch != "main" # We're skipping testing commits in main for now to maintain parity with previous Jenkins setup + if: build.branch != "main" artifact_paths: - "cypress/react16/screenshots/**/*.png" - command: .buildkite/scripts/pipeline_test.sh @@ -30,7 +30,7 @@ steps: provider: "gcp" env: TEST_TYPE: 'cypress:17' - if: build.branch != "main" # We're skipping testing commits in main for now to maintain parity with previous Jenkins setup + if: build.branch != "main" artifact_paths: - "cypress/react17/screenshots/**/*.png" - command: .buildkite/scripts/pipeline_test.sh @@ -39,6 +39,6 @@ steps: provider: "gcp" env: TEST_TYPE: 'cypress:18' - if: build.branch != "main" # We're skipping testing commits in main for now to maintain parity with previous Jenkins setup + if: build.branch != "main" artifact_paths: - "cypress/react18/screenshots/**/*.png"