Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: test api/sdk against last 2 Go versions #10488

Merged
merged 1 commit into from
Jun 24, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 32 additions & 40 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ parameters:

references:
images:
# When updating the Go version, remember to also update the versions in the
# workflows section for go-test-lib jobs.
go: &GOLANG_IMAGE docker.mirror.hashicorp.services/circleci/golang:1.16.3
ember: &EMBER_IMAGE docker.mirror.hashicorp.services/circleci/node:14-browsers

Expand Down Expand Up @@ -273,10 +275,15 @@ jobs:
path: /tmp/jsonfile
- run: *notify-slack-failure

# split off a job for the API package since it is separate
go-test-api:
go-test-lib:
description: "test a library against a specific Go version"
parameters:
go-version:
type: string
path:
type: string
docker:
- image: *GOLANG_IMAGE
- image: "docker.mirror.hashicorp.services/circleci/golang:<<parameters.go-version>>"
environment:
<<: *ENVIRONMENT
GOTAGS: "" # No tags for OSS but there are for enterprise
Expand All @@ -286,16 +293,16 @@ jobs:
at: /go/bin
- run: *install-gotestsum
- run:
working_directory: api
working_directory: <<parameters.path>>
command: go mod download
- run:
working_directory: api
working_directory: <<parameters.path>>
name: go test
command: |
mkdir -p $TEST_RESULTS_DIR /tmp/jsonfile
gotestsum \
--format=short-verbose \
--jsonfile /tmp/jsonfile/go-test-api.log \
--jsonfile /tmp/jsonfile/go-test-<<parameters.path>>.log \
--junitfile $TEST_RESULTS_DIR/gotestsum-report.xml -- \
-tags="$GOTAGS" -cover -coverprofile=coverage.txt \
./...
Expand All @@ -308,38 +315,6 @@ jobs:
path: /tmp/jsonfile
- run: *notify-slack-failure

# split off a job for the SDK package since it is separate
go-test-sdk:
docker:
- image: *GOLANG_IMAGE
environment:
<<: *ENVIRONMENT
GOTAGS: "" # No tags for OSS but there are for enterprise
steps:
- checkout
- attach_workspace:
at: /go/bin
- run: *install-gotestsum
- run:
working_directory: sdk
command: go mod download
- run:
working_directory: sdk
name: go test
command: |
mkdir -p $TEST_RESULTS_DIR
gotestsum \
--format=short-verbose \
--junitfile $TEST_RESULTS_DIR/gotestsum-report.xml -- \
-tags=$GOTAGS -cover -coverprofile=coverage.txt \
./...

- store_test_results:
path: *TEST_RESULTS_DIR
- store_artifacts:
path: *TEST_RESULTS_DIR
- run: *notify-slack-failure

# build all distros
build-distros: &build-distros
docker:
Expand Down Expand Up @@ -988,10 +963,27 @@ workflows:
- dev-build: *filter-ignore-non-go-branches
- go-test:
requires: [dev-build]
- go-test-api:
- go-test-lib:
name: "go-test-api go1.16"
path: api
go-version: "1.16"
requires: [dev-build]
- go-test-lib:
name: "go-test-api go1.15"
path: api
go-version: "1.15"
requires: [dev-build]
- go-test-lib:
name: "go-test-sdk go1.16"
path: sdk
go-version: "1.16"
<<: *filter-ignore-non-go-branches
- go-test-lib:
name: "go-test-sdk go1.15"
path: sdk
go-version: "1.15"
<<: *filter-ignore-non-go-branches
- go-test-race: *filter-ignore-non-go-branches
- go-test-sdk: *filter-ignore-non-go-branches
build-distros:
unless: << pipeline.parameters.trigger-load-test >>
jobs:
Expand Down