@@ -10,13 +10,9 @@ anchor:
1010 filters :
1111 tags :
1212 only : /^v[0-9]+(\.[0-9]+).*/
13- parameters :
14- run_local_build_test_workflow :
15- type : boolean
16- default : false
1713
1814description : |
19- Build, test, code-sign & deploy Slack Platform CLI binaries
15+ Build, code-sign & deploy Slack Platform CLI binaries
2016
2117commands :
2218 export-build-version :
@@ -113,25 +109,13 @@ jobs:
113109 default : " dev-build"
114110 docker : # run the steps with Docker
115111 # CircleCI Go images available at: https://hub.docker.com/r/circleci/golang/
116- - image : cimg/go:1.26.2
112+ - image : cimg/go:1.26.3
117113 steps : # steps that comprise the `build` job
118114 - checkout # check out source code to working directory
119115 - restore_cache : # restores saved cache if no changes are detected since last run
120116 keys :
121117 - go-mod-v4-{{ checksum "go.sum" }}
122118 - retrieve-oidc-secrets
123- - run :
124- name : Run Unit Tests
125- command : |
126- make test
127- - run :
128- name : Run Install Tests
129- command : |
130- make test-install
131- - run :
132- name : Sync Tests Results
133- command : |
134- cp ./coverage.out /tmp/test-results
135119 - run :
136120 name : Run Build
137121 command : |
@@ -160,8 +144,6 @@ jobs:
160144 - " *.zip"
161145 - store_artifacts :
162146 path : ./tmp/circleci-workspace/artifacts
163- - store_test_results :
164- path : /tmp/test-results
165147 - notify-slack-on-fail
166148 - notify-slack-on-pass
167149
@@ -343,105 +325,6 @@ jobs:
343325 - notify-slack-on-fail
344326 - notify-slack-on-pass
345327
346- e2e-test :
347- docker :
348- - image : cimg/base:current
349- parameters :
350- artifact_dir :
351- type : string
352- default : " /tmp/circleci-workspace/artifacts"
353- e2e_target_branch :
354- type : string
355- description : " What branch of the integration test repo should be used to test the CLI?"
356- default : main
357- release_ref :
358- type : string
359- description : " What CLI release tag should be used during testing?"
360- default : dev-build
361- manual_trigger_windows :
362- type : boolean
363- description : " Whether this is a Windows-specific test run"
364- default : false
365- steps :
366- - checkout
367- - retrieve-oidc-secrets
368- - attach_workspace :
369- at : << parameters.artifact_dir >>
370- - run :
371- name : Check file sync
372- command : |
373- ls -R << parameters.artifact_dir >>
374- - run :
375- name : Source release_ref if present
376- command : |
377- # the create-github-release job, for branch builds, will create a release_ref file with the tag name in it
378- # branch builds have a special tag associated to them, so if this file exists, read the release tag from it
379- if [ -f << parameters.artifact_dir >>/release_ref ]; then
380- source << parameters.artifact_dir >>/release_ref
381- echo "Sourced release tag from create-github-release job: ${RELEASE_REF}"
382- else
383- RELEASE_REF="<< parameters.release_ref >>"
384- echo "Release tag provided as job parameter: ${RELEASE_REF}"
385- fi
386- echo "export RELEASE_REF=${RELEASE_REF}" >> $BASH_ENV
387- - run :
388- name : Kick off platform-devxp-test pipeline
389- command : |
390- # TODO: once CircleCI updates its pipeline-invocation API, move off of Cheng's personal CircleCI access token, which is saved to both of the slackapi CircleCI "contexts" as an env var:
391- # https://app.circleci.com/settings/organization/github/slackapi/contexts
392- if [[ -z "$CIRCLE_BRANCH" || "$CIRCLE_BRANCH" == pull/* ]]; then
393- BRANCH_NAME="main"
394- echo "Performing the standard end-to-end test suite for changes of a forked branch"
395- else
396- BRANCH_NAME="$CIRCLE_BRANCH"
397- fi
398- TEST_JOB_WORKFLOW_ID=$(curl --location --request POST 'https://circleci.com/api/v2/project/gh/slackapi/platform-devxp-test/pipeline' \
399- --header 'Content-Type: application/json' \
400- -u "${CCHEN_CIRCLECI_PERSONAL_TOKEN}:" \
401- --data "{\"branch\":\"${BRANCH_NAME}\",\"parameters\":{\"slack_cli_build_tag\":\"${RELEASE_REF}\",\"manual_trigger_windows\":<< parameters.manual_trigger_windows >>}}" | jq '.id')
402- if [ $TEST_JOB_WORKFLOW_ID = "null" ]; then
403- echo "Performing the standard test suite found on the \"main\" branch of the end-to-end tests"
404- TEST_JOB_WORKFLOW_ID=$(curl --location --request POST 'https://circleci.com/api/v2/project/gh/slackapi/platform-devxp-test/pipeline' \
405- --header 'Content-Type: application/json' \
406- -u "${CCHEN_CIRCLECI_PERSONAL_TOKEN}:" \
407- --data "{\"branch\":\"main\",\"parameters\":{\"slack_cli_build_tag\":\"${RELEASE_REF}\",\"manual_trigger_windows\":<< parameters.manual_trigger_windows >>}}" | jq '.id')
408- else
409- echo "Performing the changed tests on the \"$BRANCH_NAME\" branch of the end-to-end tests"
410- fi
411- if [ $TEST_JOB_WORKFLOW_ID = "null" ]; then
412- echo "Failed to start the testing workflow"
413- exit 1
414- fi
415- echo "platform-devxp-test workflow started with id: $TEST_JOB_WORKFLOW_ID"
416- echo "export TEST_JOB_WORKFLOW_ID=${TEST_JOB_WORKFLOW_ID}" >> $BASH_ENV
417- - run :
418- name : Wait for platform-devxp-test E2E run to complete
419- command : |
420- E2E_RESULT="{}"
421- E2E_STATUS="running"
422- while [[ $E2E_STATUS != "failed" && $E2E_STATUS != "canceled" && $E2E_STATUS != "success" ]]
423- do
424- sleep 10
425- echo "Polling test job..."
426- E2E_RESULT=$(curl --location -sS --request GET "https://circleci.com/api/v2/pipeline/$TEST_JOB_WORKFLOW_ID/workflow" --header "Circle-Token: $CIRCLE_TOKEN")
427- E2E_STATUS=$(echo $E2E_RESULT | jq --raw-output '.items[0].status')
428- echo "Status is now: $E2E_STATUS"
429- done
430- if [ $E2E_STATUS = "failed" ]; then
431- E2E_PIPE_NUM=$(echo $E2E_RESULT | jq '.items[0].pipeline_number')
432- E2E_WORKFLOW_ID=$(echo $E2E_RESULT | jq -r '.items[0].id')
433- CIRCLE_FAIL_LINK="https://app.circleci.com/pipelines/github/slackapi/platform-devxp-test/${E2E_PIPE_NUM}/workflows/${E2E_WORKFLOW_ID}"
434- echo "Tests failed! Visit $CIRCLE_FAIL_LINK for more info."
435- exit 1
436- elif [ "$E2E_STATUS" = "canceled" ]; then
437- echo "Tests have been canceled and did not finish"
438- exit 1
439- else
440- echo "Tests passed woot 🎉"
441- fi
442- - notify-slack-on-fail
443- - notify-slack-on-pass
444-
445328 s3-upload :
446329 machine : true
447330 resource_class : slackapi/slack-cli-code-sign-dev
@@ -482,89 +365,21 @@ jobs:
482365 - notify-slack-on-pass
483366
484367workflows :
485- local-build-test :
486- when :
487- and :
488- - not :
489- equal : [main, << pipeline.git.branch >>]
490- - not : << pipeline.git.tag >>
491- - equal : [<< pipeline.parameters.run_local_build_test_workflow >>, true]
492- jobs :
493- - build :
494- context : slack-cli-release
495- - e2e-test :
496- # Change `main` to your local e2e_test branch
497- e2e_target_branch : " main"
498- requires :
499- - build
500- context : slack-cli-e2e
501-
502- build-lint-test-e2e-test :
368+ build :
503369 when :
504370 and :
505371 - not :
506- equal : [main, << pipeline.git.branch >>]
372+ equal : [<< pipeline.git.branch >>, main ]
507373 - not : << pipeline.git.tag >>
508- - equal :
509- [<< pipeline.parameters.run_local_build_test_workflow >>, false]
510- jobs :
511- - build :
512- context : slack-cli-release
513- release_ref : << pipeline.git.branch >>
514- - create-github-release-and-artifacts :
515- requires :
516- - build
517- context : slack-cli-release
518- release_ref : << pipeline.git.branch >>
519- - e2e-test :
520- e2e_target_branch : " main"
521- requires :
522- - create-github-release-and-artifacts
523- context : slack-cli-e2e
524-
525- # nightly build will build from main branch nightly at 12:00 am UTC
526- nightly-build-test-code-sign-deploy :
527- triggers :
528- - schedule :
529- cron : " 0 0 * * *"
530- filters :
531- branches :
532- only : main
533374 jobs :
534375 - build :
535376 context : slack-cli-release
536- release_ref : dev-build
537- - code-sign :
538- requires :
539- - build
540- context : slack-cli-release
541- - create-github-release-and-artifacts :
542- requires :
543- - code-sign
544- context : slack-cli-release
545- release_ref : dev-build
546- - e2e-test :
547- name : e2e-test-unix
548- manual_trigger_windows : false
549- requires :
550- - create-github-release-and-artifacts
551- context : slack-cli-e2e
552- release_ref : dev-build
553- - e2e-test :
554- name : e2e-test-windows
555- manual_trigger_windows : true
556- requires :
557- - create-github-release-and-artifacts
558- context : slack-cli-e2e
559- release_ref : dev-build
560377
561- dev-build-test- code-sign-deploy :
378+ dev-build-code-sign-deploy :
562379 when :
563380 and :
564381 - equal : [<< pipeline.git.branch >>, main]
565382 - not : << pipeline.git.tag >>
566- - equal :
567- [<< pipeline.parameters.run_local_build_test_workflow >>, false]
568383 jobs :
569384 - build :
570385 context : slack-cli-release
@@ -606,20 +421,6 @@ workflows:
606421 requires :
607422 - create-github-release-and-artifacts
608423 context : slack-cli-release
609- - e2e-test :
610- name : e2e-test-unix
611- manual_trigger_windows : false
612- requires :
613- - create-github-release-and-artifacts
614- context : slack-cli-e2e
615- release_ref : dev-build
616- - e2e-test :
617- name : e2e-test-windows
618- manual_trigger_windows : true
619- requires :
620- - create-github-release-and-artifacts
621- context : slack-cli-e2e
622- release_ref : dev-build
623424
624425 # feature build will be triggered when a Git tag matches the following pattern: 'v<major>.<minor>.<patch>-<describe the feature>-feature', eg. 'v1.0.0-branch-name-feature'
625426 feature-build-code-sign-deploy :
0 commit comments