Merge pull request #7557 from hashicorp/dnephin/ci-small-improvements
ci: Upload coverage from each job
This commit is contained in:
commit
5fffde3c27
|
@ -106,19 +106,19 @@ jobs:
|
|||
gotestsum --format=short-verbose \
|
||||
--junitfile $TEST_RESULTS_DIR/gotestsum-report.xml -- \
|
||||
-tags="$GOTAGS" -p 2 \
|
||||
-cover -coverprofile=cov_$CIRCLE_NODE_INDEX.part \
|
||||
-cover -coverprofile=coverage.txt \
|
||||
$PACKAGE_NAMES
|
||||
|
||||
# save coverage report parts
|
||||
- persist_to_workspace:
|
||||
root: .
|
||||
paths:
|
||||
- cov_*.part
|
||||
|
||||
- store_test_results:
|
||||
path: *TEST_RESULTS_DIR
|
||||
- store_artifacts:
|
||||
path: *TEST_RESULTS_DIR
|
||||
- run: &codecov_upload
|
||||
name: codecov upload
|
||||
when: always
|
||||
# The -C flag shouldn't be necessary, but it fails to find the commit
|
||||
# without it.
|
||||
command: bash <(curl -s https://codecov.io/bash) -C "$CIRCLE_SHA1"
|
||||
|
||||
# split off a job for the API package since it is separate
|
||||
go-test-api:
|
||||
|
@ -140,19 +140,14 @@ jobs:
|
|||
gotestsum \
|
||||
--format=short-verbose \
|
||||
--junitfile $TEST_RESULTS_DIR/gotestsum-report.xml -- \
|
||||
-tags="$GOTAGS" -cover -coverprofile=cov_api.part \
|
||||
-tags="$GOTAGS" -cover -coverprofile=coverage.txt \
|
||||
./...
|
||||
|
||||
# save coverage report parts
|
||||
- persist_to_workspace:
|
||||
root: ./api
|
||||
paths:
|
||||
- cov_*.part
|
||||
|
||||
- store_test_results:
|
||||
path: *TEST_RESULTS_DIR
|
||||
- store_artifacts:
|
||||
path: *TEST_RESULTS_DIR
|
||||
- run: *codecov_upload
|
||||
|
||||
# split off a job for the SDK package since it is separate
|
||||
go-test-sdk:
|
||||
|
@ -174,42 +169,14 @@ jobs:
|
|||
gotestsum \
|
||||
--format=short-verbose \
|
||||
--junitfile $TEST_RESULTS_DIR/gotestsum-report.xml -- \
|
||||
-tags=$GOTAGS -cover -coverprofile=cov_sdk.part \
|
||||
-tags=$GOTAGS -cover -coverprofile=coverage.txt \
|
||||
./...
|
||||
|
||||
# save coverage report parts
|
||||
- persist_to_workspace:
|
||||
root: ./sdk
|
||||
paths:
|
||||
- cov_*.part
|
||||
|
||||
- store_test_results:
|
||||
path: *TEST_RESULTS_DIR
|
||||
- store_artifacts:
|
||||
path: *TEST_RESULTS_DIR
|
||||
|
||||
# combine code coverage results from the parallel circleci executors
|
||||
coverage-merge:
|
||||
docker:
|
||||
- image: *GOLANG_IMAGE
|
||||
environment:
|
||||
<<: *ENVIRONMENT
|
||||
steps:
|
||||
- checkout
|
||||
- attach_workspace:
|
||||
at: .
|
||||
- run:
|
||||
name: merge coverage reports
|
||||
command: |
|
||||
mkdir -p $TEST_RESULTS_DIR
|
||||
echo "mode: set" > coverage.out
|
||||
grep -h -v "mode: set" cov_*.part >> coverage.out
|
||||
go tool cover -html=coverage.out -o $TEST_RESULTS_DIR/coverage.html
|
||||
- run:
|
||||
name: codecov upload
|
||||
command: bash <(curl -s https://codecov.io/bash) -v -C $CIRCLE_SHA1 -f '!agent/bindata_assetfs.go'
|
||||
- store_artifacts:
|
||||
path: *TEST_RESULTS_DIR
|
||||
- run: *codecov_upload
|
||||
|
||||
# build all distros
|
||||
build-distros: &build-distros
|
||||
|
@ -689,11 +656,6 @@ workflows:
|
|||
- go-test-api:
|
||||
requires: [dev-build]
|
||||
- go-test-sdk
|
||||
- coverage-merge:
|
||||
requires:
|
||||
- go-test
|
||||
- go-test-api
|
||||
- go-test-sdk
|
||||
- test-connect-ca-providers
|
||||
|
||||
build-distros:
|
||||
|
|
|
@ -30,3 +30,8 @@ comment: false
|
|||
# https://docs.codecov.io/docs/flags
|
||||
# TODO: split out test coverage for API, SDK, UI, website?
|
||||
# flags:
|
||||
|
||||
ignore:
|
||||
- "agent/bindata_assetfs.go"
|
||||
- "vendor/**/*"
|
||||
- "**/*.pb.go"
|
||||
|
|
Loading…
Reference in New Issue