From 7780ef6d0ab384d3e5daf059079f43c33b520ffd Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Tue, 22 Oct 2024 15:54:28 -0400 Subject: [PATCH 1/4] ci: integrate with e2e CI system --- .circleci/config.yml | 71 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..d4a4a5a --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,71 @@ +# Use the latest 2.1 version of CircleCI pipeline process engine. +# See: https://circleci.com/docs/2.0/configuration-reference +version: 2.1 +orbs: + jq: circleci/jq@2.2.0 + +description: | + Run end-to-end integration tests between deno-slack-api, Slack Platform CLI and other Slack app development tooling. + +jobs: + e2e-test: + docker: + - image: cimg/base:current + parameters: + e2e_target_branch: + type: string + description: "What branch of the integration test repo should be used to test the CLI?" + # TODO: update to main post-merge + default: deno-api-import-url + api_branch: + type: string + description: "What deno-slack-api branch should be used during testing?" + default: main + steps: + - checkout + - run: + name: Kick off platform-devpx-test pipeline + command: | + IMPORT_URL="https://raw.githubusercontent.com/slackapi/deno-slack-sdk/refs/heads/<< parameters.sdk_branch >>/src/"; + # https://app.circleci.com/settings/organization/github/slackapi/contexts + TEST_JOB_WORKFLOW_ID=$(curl --location --request POST 'https://circleci.com/api/v2/project/gh/slackapi/platform-devxp-test/pipeline' \ + --header 'Content-Type: application/json' \ + -u "${FIL_CIRCLECI_PERSONAL_TOKEN}:" \ + --data "{\"branch\":\"<< parameters.e2e_target_branch >>\",\"parameters\":{\"deno_sdk_import_url\":\"${IMPORT_URL}\"}}" | jq '.id') + echo "e2e test workflow started with id: $TEST_JOB_WORKFLOW_ID" + echo "export TEST_JOB_WORKFLOW_ID=${TEST_JOB_WORKFLOW_ID}" >> $BASH_ENV + - run: + name: Wait for platform-devxp-test E2E run to complete + command: | + E2E_RESULT="{}" + E2E_STATUS="running" + # possible status values: success, running, not_run, failed, error, failing, on_hold, canceled, unauthorized + while [[ $E2E_STATUS != "failed" && $E2E_STATUS != "canceled" && $E2E_STATUS != "success" && $E2E_STATUS != "not_run" && $E2E_STATUS != "error" && $E2E_STATUS != "unauthorized" ]] + do + sleep 30s + echo "Polling test job ${TEST_JOB_WORKFLOW_ID}..." + E2E_RESULT=$(curl --location -sS --request GET "https://circleci.com/api/v2/pipeline/$TEST_JOB_WORKFLOW_ID/workflow" --header "Circle-Token: $FIL_CIRCLECI_PERSONAL_TOKEN") + E2E_STATUS=$(echo $E2E_RESULT | jq --raw-output '.items[0].status') + echo "Status is now: $E2E_STATUS" + done + if [ $E2E_STATUS = "failed" ] || [ $E2E_STATUS = "error" ]; then + E2E_PIPE_NUM=$(echo $E2E_RESULT | jq '.items[0].pipeline_number') + E2E_WORKFLOW_ID=$(echo $E2E_RESULT | jq -r '.items[0].id') + CIRCLE_FAIL_LINK="https://app.circleci.com/pipelines/github/slackapi/platform-devxp-test/${E2E_PIPE_NUM}/workflows/${E2E_WORKFLOW_ID}" + echo "Tests failed! Visit $CIRCLE_FAIL_LINK for more info." + exit 1 + elif [ "$E2E_STATUS" = "canceled" ] || [ "$E2E_STATUS" = "unauthorized" ] || [ $E2E_STATUS = "not_run" ]; then + echo "Tests have been ${E2E_STATUS} and did not finish!" + exit 1 + else + echo "Tests passed woot 🎉" + fi + +workflows: + e2e-test: + jobs: + - e2e-test: + # TODO: update to main post-merge + e2e_target_branch: "deno-api-import-url" + sdk_branch: << pipeline.git.branch >> + context: slack-cli-e2e From 865dc42ca6c894d219deefaa0d25c3985095ec26 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Tue, 22 Oct 2024 15:55:40 -0400 Subject: [PATCH 2/4] set API particulars correctly. --- .circleci/config.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index d4a4a5a..46d903a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -24,14 +24,14 @@ jobs: steps: - checkout - run: - name: Kick off platform-devpx-test pipeline + name: Kick off platform-devxp-test pipeline command: | - IMPORT_URL="https://raw.githubusercontent.com/slackapi/deno-slack-sdk/refs/heads/<< parameters.sdk_branch >>/src/"; + IMPORT_URL="https://raw.githubusercontent.com/slackapi/deno-slack-api/refs/heads/<< parameters.api_branch >>/src/"; # https://app.circleci.com/settings/organization/github/slackapi/contexts TEST_JOB_WORKFLOW_ID=$(curl --location --request POST 'https://circleci.com/api/v2/project/gh/slackapi/platform-devxp-test/pipeline' \ --header 'Content-Type: application/json' \ -u "${FIL_CIRCLECI_PERSONAL_TOKEN}:" \ - --data "{\"branch\":\"<< parameters.e2e_target_branch >>\",\"parameters\":{\"deno_sdk_import_url\":\"${IMPORT_URL}\"}}" | jq '.id') + --data "{\"branch\":\"<< parameters.e2e_target_branch >>\",\"parameters\":{\"deno_api_import_url\":\"${IMPORT_URL}\"}}" | jq '.id') echo "e2e test workflow started with id: $TEST_JOB_WORKFLOW_ID" echo "export TEST_JOB_WORKFLOW_ID=${TEST_JOB_WORKFLOW_ID}" >> $BASH_ENV - run: From 79f8daafb138bb91dc1eb1e1a7eb70e573047b79 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Tue, 22 Oct 2024 15:59:00 -0400 Subject: [PATCH 3/4] derpy derp --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 46d903a..d5c7273 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -67,5 +67,5 @@ workflows: - e2e-test: # TODO: update to main post-merge e2e_target_branch: "deno-api-import-url" - sdk_branch: << pipeline.git.branch >> + api_branch: << pipeline.git.branch >> context: slack-cli-e2e From b9dac6bd1acf97d78fabab7045c65cea32ea934f Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Tue, 22 Oct 2024 16:13:48 -0400 Subject: [PATCH 4/4] invoke main branch of CI system --- .circleci/config.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index d5c7273..94d6d70 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -15,8 +15,7 @@ jobs: e2e_target_branch: type: string description: "What branch of the integration test repo should be used to test the CLI?" - # TODO: update to main post-merge - default: deno-api-import-url + default: main api_branch: type: string description: "What deno-slack-api branch should be used during testing?" @@ -65,7 +64,6 @@ workflows: e2e-test: jobs: - e2e-test: - # TODO: update to main post-merge - e2e_target_branch: "deno-api-import-url" + e2e_target_branch: "main" api_branch: << pipeline.git.branch >> context: slack-cli-e2e