2021-01-12 20:12:09 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Run coverage tests
|
2021-09-20 18:59:44 +00:00
|
|
|
./bazel.sh --bazelrc=.buildkite-bazelrc coverage --config=remote-cache --config=nostamp --features=norace --test_tag_filters="-race_on" --nocache_test_results -k //...
|
2021-01-12 20:12:09 +00:00
|
|
|
|
|
|
|
# Collect all coverage results into a single file (for deepsource).
|
2021-03-24 19:57:27 +00:00
|
|
|
find "$(./bazel.sh --bazelrc=.buildkite-bazelrc info bazel-testlogs)" -iname coverage.dat -print0 | xargs -t -rd '\n' -0 ./bazel.sh --bazelrc=.buildkite-bazelrc run //tools/gocovmerge:gocovmerge -- > /tmp/cover.out
|
2021-01-12 20:12:09 +00:00
|
|
|
|
|
|
|
# Download deepsource CLI
|
|
|
|
curl https://deepsource.io/cli | sh
|
|
|
|
|
|
|
|
# Upload to deepsource (requires DEEPSOURCE_DSN environment variable)
|
|
|
|
./bin/deepsource report --analyzer test-coverage --key go --value-file /tmp/cover.out
|
|
|
|
|
2021-04-30 14:58:29 +00:00
|
|
|
# Provide permission to execute script.
|
2021-09-16 16:22:39 +00:00
|
|
|
chmod +x ./hack/codecov.sh
|
2021-04-30 14:58:29 +00:00
|
|
|
|
2021-01-12 20:12:09 +00:00
|
|
|
# Upload to codecov (requires CODECOV_TOKEN environment variable)
|
2021-09-16 16:22:39 +00:00
|
|
|
./hack/codecov.sh -s "$(./bazel.sh info bazel-testlogs)" -f '**/coverage.dat'
|