Skip to content

Commit

Permalink
Merge pull request #10488 from hashicorp/dnephin/ci-lib-testing
Browse files Browse the repository at this point in the history
ci: test api/sdk against last 2 Go versions
  • Loading branch information
dnephin authored and hc-github-team-consul-core committed Jun 29, 2021
1 parent ceac373 commit 5d86fe4
Showing 1 changed file with 32 additions and 40 deletions.
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 @@ -990,10 +965,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

0 comments on commit 5d86fe4

Please sign in to comment.