codecov-bash icon indicating copy to clipboard operation
codecov-bash copied to clipboard

Suggestion for extending documentation for codecov and docker

Open Midnighter opened this issue 7 years ago • 2 comments

I'm not a make expert so it might be obvious to others; I struggled a long time with the proper expansion of the ci_env variable. The following fixed it for me in my Makefile so maybe it's a useful addition to the documentation?

SHELL:=/bin/bash

test-travis:
	$(eval ci_env=$(shell bash <(curl -s https://codecov.io/env)))
	docker-compose run --rm $(ci_env)  web printenv

Midnighter avatar Apr 09 '18 16:04 Midnighter

@Midnighter Thank you very much for sharing this. You bailed me out of a hole trying to implement this into a Makefile. It would definitely be a good idea to incorporate instructions on how to put this into a Makefile into the documentation.

anthonyhastings avatar Jul 29 '19 21:07 anthonyhastings

Glad it was of help to you :slightly_smiling_face: I must admit, though, that I switched to generating a coverage report inside and uploading it outside the container for most of my projects. Example:

## Run the tests and report coverage (see https://docs.codecov.io/docs/testing-with-docker).
shared := /tmp/coverage
test-travis:
	mkdir --parents "$(shared)"
	docker-compose run --rm -v "$(shared):$(shared)" \
		<container> pytest --cov-report \
		"xml:$(shared)/coverage.xml" --cov-report term --cov=<package>
	bash <(curl -s https://codecov.io/bash) -f "$(shared)/coverage.xml"

Midnighter avatar Jul 29 '19 21:07 Midnighter