Skip to content

Commit

Permalink
codecov job update (istio#10078)
Browse files Browse the repository at this point in the history
* Codecov revamp

* Adding htlm log parsing

* Html parsing
  • Loading branch information
hklai authored and istio-testing committed Nov 21, 2018
1 parent 75977a4 commit 2bb3950
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 246 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -604,8 +604,8 @@ jobs:
MAXPROCS=6 bin/codecov_diff.sh
- run:
name: Uploading code coverage to codecov.io
when: always
command: bash <(curl -s https://codecov.io/bash) -f /go/out/codecov/coverage.cov
when: on_success
command: bash <(curl -s https://codecov.io/bash) -f /go/out/codecov/pr/coverage.cov
- store_artifacts:
path: /go/out/codecov

Expand Down
9 changes: 6 additions & 3 deletions bin/codecov.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ OUT_DIR=${OUT_DIR:-"${GOPATH}/out/codecov"}
SCRIPTPATH="$(cd "$(dirname "$0")" ; pwd -P)"
ROOTDIR="$(dirname "${SCRIPTPATH}")"
DIR="./..."
CODECOV_SKIP="${ROOTDIR}/codecov.skip"
CODECOV_SKIP=${CODECOV_SKIP:-"${ROOTDIR}/codecov.skip"}
SKIPPED_TESTS_GREP_ARGS=

# Set GOPATH to match the expected layout
Expand Down Expand Up @@ -80,7 +80,9 @@ function parse_skipped_tests() {
if [[ "${SKIPPED_TESTS_GREP_ARGS}" != '' ]]; then
SKIPPED_TESTS_GREP_ARGS+='\|'
fi
SKIPPED_TESTS_GREP_ARGS+="\\(${entry}\\)"
if [[ "${entry}" != "#"* ]]; then
SKIPPED_TESTS_GREP_ARGS+="\\(${entry}\\)"
fi
done < "${CODECOV_SKIP}"
}

Expand All @@ -105,7 +107,8 @@ mkdir -p "${OUT_DIR}"
pushd "${OUT_DIR}"
go get github.com/wadey/gocovmerge
gocovmerge "${COVERAGEDIR}"/*.cov > coverage.cov
cat "${COVERAGEDIR}"/*.report > codecov.report
cat "${COVERAGEDIR}"/*.report > report.out
go tool cover -html=coverage.cov -o coverage.html
popd

echo "Intermediate files were written to ${COVERAGEDIR}"
Expand Down
20 changes: 15 additions & 5 deletions bin/codecov_diff.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,21 @@ set -e
set -u
set -o pipefail

REPORT_PATH=${GOPATH}/out/codecov
BASELINE_PATH=${GOPATH}/out/codecov_baseline
SCRIPTPATH="$(cd "$(dirname "$0")" ; pwd -P)"
ROOTDIR="$(dirname "${SCRIPTPATH}")"

REPORT_PATH=${GOPATH}/out/codecov/pr
BASELINE_PATH=${GOPATH}/out/codecov/baseline
CODECOV_SKIP=${GOPATH}/out/codecov/codecov.skip

mkdir -p "${GOPATH}"/out/codecov

# Use the codecov.skip from the PR across two test runs to make sure we skip a
# consistent list of packages.
cp "${ROOTDIR}"/codecov.skip "${CODECOV_SKIP}"

# First run codecov from current workspace (PR)
OUT_DIR="${REPORT_PATH}" MAXPROCS=${MAXPROCS:-} ./bin/codecov.sh || echo "Some tests have failed"
OUT_DIR="${REPORT_PATH}" MAXPROCS="${MAXPROCS:-}" CODECOV_SKIP="${CODECOV_SKIP:-}" ./bin/codecov.sh || echo "Some tests have failed"

if [[ -n "${CIRCLE_PR_NUMBER:-}" ]]; then
TMP_GITHUB_TOKEN=$(mktemp /tmp/XXXXX.github)
Expand All @@ -40,9 +50,9 @@ if [[ -n "${CIRCLE_PR_NUMBER:-}" ]]; then
cp "${TMP_CODECOV_SH}" ./bin/codecov.sh


OUT_DIR="${BASELINE_PATH}" MAXPROCS="${MAXPROCS:-}" ./bin/codecov.sh || echo "Some tests have failed"
OUT_DIR="${BASELINE_PATH}" MAXPROCS="${MAXPROCS:-}" CODECOV_SKIP="${CODECOV_SKIP:-}" ./bin/codecov.sh || echo "Some tests have failed"

go get -u istio.io/test-infra/toolbox/pkg_check
"${GOPATH}"/bin/pkg_check --report_file="${REPORT_PATH}/codecov.report" --baseline_file="${BASELINE_PATH}/codecov.report"
"${GOPATH}"/bin/pkg_check --report_file="${REPORT_PATH}/coverage.html" --baseline_file="${BASELINE_PATH}/coverage.html" --html
fi

236 changes: 0 additions & 236 deletions codecov.requirement

This file was deleted.

1 change: 1 addition & 0 deletions codecov.skip
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ istio.io/istio/mixer/tools/codegen
istio.io/istio/pilot/test
istio.io/istio/pkg/mcp/testing
istio.io/istio/pkg/test
istio.io/istio/samples
istio.io/istio/security/tests/integration
istio.io/istio/tests/e2e
istio.io/istio/tests/integration2/examples
Expand Down

0 comments on commit 2bb3950

Please sign in to comment.