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 \
|
gotestsum --format=short-verbose \
|
||||||
--junitfile $TEST_RESULTS_DIR/gotestsum-report.xml -- \
|
--junitfile $TEST_RESULTS_DIR/gotestsum-report.xml -- \
|
||||||
-tags="$GOTAGS" -p 2 \
|
-tags="$GOTAGS" -p 2 \
|
||||||
-cover -coverprofile=cov_$CIRCLE_NODE_INDEX.part \
|
-cover -coverprofile=coverage.txt \
|
||||||
$PACKAGE_NAMES
|
$PACKAGE_NAMES
|
||||||
|
|
||||||
# save coverage report parts
|
|
||||||
- persist_to_workspace:
|
|
||||||
root: .
|
|
||||||
paths:
|
|
||||||
- cov_*.part
|
|
||||||
|
|
||||||
- store_test_results:
|
- store_test_results:
|
||||||
path: *TEST_RESULTS_DIR
|
path: *TEST_RESULTS_DIR
|
||||||
- store_artifacts:
|
- store_artifacts:
|
||||||
path: *TEST_RESULTS_DIR
|
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
|
# split off a job for the API package since it is separate
|
||||||
go-test-api:
|
go-test-api:
|
||||||
|
@ -140,19 +140,14 @@ jobs:
|
||||||
gotestsum \
|
gotestsum \
|
||||||
--format=short-verbose \
|
--format=short-verbose \
|
||||||
--junitfile $TEST_RESULTS_DIR/gotestsum-report.xml -- \
|
--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:
|
- store_test_results:
|
||||||
path: *TEST_RESULTS_DIR
|
path: *TEST_RESULTS_DIR
|
||||||
- store_artifacts:
|
- store_artifacts:
|
||||||
path: *TEST_RESULTS_DIR
|
path: *TEST_RESULTS_DIR
|
||||||
|
- run: *codecov_upload
|
||||||
|
|
||||||
# split off a job for the SDK package since it is separate
|
# split off a job for the SDK package since it is separate
|
||||||
go-test-sdk:
|
go-test-sdk:
|
||||||
|
@ -174,42 +169,14 @@ jobs:
|
||||||
gotestsum \
|
gotestsum \
|
||||||
--format=short-verbose \
|
--format=short-verbose \
|
||||||
--junitfile $TEST_RESULTS_DIR/gotestsum-report.xml -- \
|
--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:
|
- store_test_results:
|
||||||
path: *TEST_RESULTS_DIR
|
path: *TEST_RESULTS_DIR
|
||||||
- store_artifacts:
|
- store_artifacts:
|
||||||
path: *TEST_RESULTS_DIR
|
path: *TEST_RESULTS_DIR
|
||||||
|
- run: *codecov_upload
|
||||||
# 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
|
|
||||||
|
|
||||||
# build all distros
|
# build all distros
|
||||||
build-distros: &build-distros
|
build-distros: &build-distros
|
||||||
|
@ -689,11 +656,6 @@ workflows:
|
||||||
- go-test-api:
|
- go-test-api:
|
||||||
requires: [dev-build]
|
requires: [dev-build]
|
||||||
- go-test-sdk
|
- go-test-sdk
|
||||||
- coverage-merge:
|
|
||||||
requires:
|
|
||||||
- go-test
|
|
||||||
- go-test-api
|
|
||||||
- go-test-sdk
|
|
||||||
- test-connect-ca-providers
|
- test-connect-ca-providers
|
||||||
|
|
||||||
build-distros:
|
build-distros:
|
||||||
|
|
|
@ -30,3 +30,8 @@ comment: false
|
||||||
# https://docs.codecov.io/docs/flags
|
# https://docs.codecov.io/docs/flags
|
||||||
# TODO: split out test coverage for API, SDK, UI, website?
|
# TODO: split out test coverage for API, SDK, UI, website?
|
||||||
# flags:
|
# flags:
|
||||||
|
|
||||||
|
ignore:
|
||||||
|
- "agent/bindata_assetfs.go"
|
||||||
|
- "vendor/**/*"
|
||||||
|
- "**/*.pb.go"
|
||||||
|
|
Loading…
Reference in New Issue