Skip to content
This repository has been archived by the owner on Sep 19, 2021. It is now read-only.

Send test coverage for backend to codecov.io #669

Merged
merged 6 commits into from
Aug 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,20 @@ specs:
# Coverage
#
.PHONY: coverage
coverage:
$(info Running code coverage)
# Run coverage-go first – it removes its backend coverage data
# afterwards, so coverage-js will not label its report data as
# belonging to the frontend.
coverage: coverage-go coverage-js
coverage-js:
$(info Running code coverage for JS)
@docker-compose run --rm \
-e "CODECOV_TOKEN=${CODECOV_TOKEN}" \
js yarn coverage
coverage-go:
$(info Running code coverage for Go)
@docker-compose run --rm \
-e "CODECOV_TOKEN=${CODECOV_TOKEN}" \
api make coverage

#
# Building
Expand Down
6 changes: 5 additions & 1 deletion api/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ MAKEFLAGS += --silent
all: clean test build

test:
GOLANG_ENV=test go test -cover $(shell go list ./... | grep -v /vendor/)
GOLANG_ENV=test go test -coverprofile=coverage.txt -covermode=atomic -cover $(shell go list ./... | grep -v /vendor/)

coverage:
# Use -c to remove processed reports so coverage-js won't find it
codecov -c -F backend -f coverage.txt -X gcov

build:
go build -o api ./cmd/server
Expand Down
3 changes: 3 additions & 0 deletions conf/docker/Dockerfile.api
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,7 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get -q -y update && apt-get -q -y install
COPY api/Gopkg.toml api/Gopkg.lock ./
RUN dep ensure -vendor-only

RUN curl https://raw.githubusercontent.com/codecov/codecov-bash/master/codecov > /usr/local/bin/codecov; \
chmod 755 /usr/local/bin/codecov

CMD ./bin/run.sh
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"lint-css": "gulp lint",
"lint-js": "eslint --ext .js,.jsx src/",
"lint": "npm run lint-css && npm run lint-js",
"coverage": "NODE_ENV=test codecov",
"coverage": "NODE_ENV=test codecov -F frontend --disable=gcov",
"build-assets": "gulp build",
"build-js": "webpack -p --progress",
"build-css": "npm run build-assets && node-sass-chokidar --include-path src/sass --output-style compressed --source-map true src/eqip.scss dist/css/eqip.css",
Expand Down