Skip to content

Commit 103aef5

Browse files
committed
ci: report end-to-end test status from separate configurations
1 parent 806aa51 commit 103aef5

5 files changed

Lines changed: 11 additions & 353 deletions

File tree

.circleci/config.yml

Lines changed: 3 additions & 200 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@ 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

1814
description: |
1915
Build, test, code-sign & deploy Slack Platform CLI binaries
@@ -120,18 +116,6 @@ jobs:
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: |
@@ -343,105 +327,6 @@ jobs:
343327
- notify-slack-on-fail
344328
- notify-slack-on-pass
345329

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-
445330
s3-upload:
446331
machine: true
447332
resource_class: slackapi/slack-cli-code-sign-dev
@@ -482,89 +367,21 @@ jobs:
482367
- notify-slack-on-pass
483368

484369
workflows:
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:
370+
build:
503371
when:
504372
and:
505373
- not:
506-
equal: [main, << pipeline.git.branch >>]
374+
equal: [<< pipeline.git.branch >>, main]
507375
- 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
533376
jobs:
534377
- build:
535378
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
560379

561-
dev-build-test-code-sign-deploy:
380+
dev-build-code-sign-deploy:
562381
when:
563382
and:
564383
- equal: [<< pipeline.git.branch >>, main]
565384
- not: << pipeline.git.tag >>
566-
- equal:
567-
[<< pipeline.parameters.run_local_build_test_workflow >>, false]
568385
jobs:
569386
- build:
570387
context: slack-cli-release
@@ -606,20 +423,6 @@ workflows:
606423
requires:
607424
- create-github-release-and-artifacts
608425
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
623426

624427
# 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'
625428
feature-build-code-sign-deploy:

.github/MAINTAINERS_GUIDE.md

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -293,25 +293,12 @@ results directly.
293293

294294
#### Continuous integration tests
295295

296-
All tests are run during PRs, merges to `main`, and on nightly builds of `main`
297-
by our continuous integration systems: GitHub Action and CircleCI workflows.
296+
All tests are run during PRs and merges to `main` by our continuous integration
297+
systems: GitHub Actions and CircleCI workflows.
298298

299299
The module tests that are used can be found alongside the modules in `*_test.go`
300300
files and edited as needed.
301301

302-
The end-to-end tests are located in the
303-
[slackapi/platform-devxp-test][platform-devxp-test] repo and can be adjusted to
304-
new requirements by a maintainer.
305-
306-
By default the tests execute with the `dev-build` GitHub Release of this repo.
307-
Branches on this repo will also create a related GitHub Release, and end-to-end
308-
tests will use the branch-specific Slack CLI release to execute tests.
309-
310-
The branch name can also be set by changing
311-
[the `e2e_target_branch`](https://github.com/slackapi/slack-cli/blob/24048e34b30a1f1bed46f9d937ff0b02a3cb76b7/.circleci/config.yml#L950)
312-
for the `build-lint-test-e2e-test` workflow in the `.circleci/config.yml` file,
313-
but take care not to merge this change into `main`!
314-
315302
#### Test naming conventions
316303

317304
Test function names should use the format `Test_StructName_FunctionName` for methods
@@ -551,7 +538,6 @@ tree of a transitive dependency, this command can be helpful:
551538
go mod graph | grep <module name>
552539
```
553540

554-
555541
### Designing
556542

557543
Conventions for how commands handle inputs and format outputs are documented in
@@ -624,7 +610,7 @@ The development build comes in 2 flavours:
624610

625611
#### 1. Development build GitHub release
626612

627-
A development build and recent changelog is generated each night from `main`
613+
A development build and recent changelog is generated on each merge to `main`
628614
with all of the latest changes. Builds are released with the `dev-build` tag and
629615
can be [reviewed from the releases][dev-release] page.
630616

@@ -636,8 +622,9 @@ Each release page contains:
636622
version `v*.*.*` pattern
637623
- Assets for the macOS, Linux, and Windows binaries
638624

639-
The development build and release automation is performed from the `deploy-dev`
640-
job in the [`.circleci/config.yml`][circleci] file.
625+
The development build and release automation is performed from the
626+
`dev-build-code-sign-deploy` workflow in the [`.circleci/config.yml`][circleci]
627+
file.
641628

642629
#### 2. Development build install script
643630

@@ -808,10 +795,8 @@ Steps to merge a pull request:
808795
1. Tests must pass on the pull request using the continuous integration suite
809796
- Tests for development APIs are optional, but we recommend investigating why
810797
it's failing before merging
811-
- End-to-end tests for pull requests from forks can be [started][e2e] if:
812-
- The `workflow` from the **main** branch is used
813-
- The `branch` contains the pull request number as: `pull/123/head`
814-
- The `status` is reported with the commit checks
798+
- End-to-end tests start from the [platform-devxp-test][platform-devxp-test]
799+
project with custom options
815800
2. Code is reviewed and approved by another maintainer
816801
3. Title is descriptive
817802
- This becomes part of the CHANGELOG, so please make sure it's meaningful to
@@ -832,7 +817,6 @@ When in doubt, find the other maintainers and ask.
832817
[commit]: https://www.conventionalcommits.org/en/v1.0.0/
833818
[contributing]: ./CONTRIBUTING.md
834819
[dev-release]: https://github.com/slackapi/slack-cli/releases/tag/dev-build
835-
[e2e]: https://github.com/slackapi/slack-cli/actions/workflows/e2e_tests.yml
836820
[effective-go]: https://golang.org/doc/effective_go
837821
[github-app-docs]: https://github.com/apps/slackapi
838822
[github-app-releaser]: https://github.com/apps/slack-cli-releaser

0 commit comments

Comments
 (0)