pcg
sets itself in mode run-hook continuous-integration
automatically when run without arguments and the environment variable CI=true
is set. It is set on all popular hosted CI services.
Here's a sample of CI systems that can be used. M-A did a review of hosted CI services at maruel.net/post/ci-go-review/. See this blog post for the pros and cons for each service. Obviously, use 1, not all but none is perfect:
Code coverage can be used via one of the systems above via Coveralls:
Post push CI (continuous integration) works with Travis. This runs the checks on pull requests automatically! This also works with github organizations.
.travis.yml
in your repository and push it.go get -d -t ./... go get github.com/maruel/pre-commit-go/cmd/pcg pcg
go get github.com/maruel/pre-commit-go/cmd/pcg
pcg
Integrate with travis-ci first, then visit https://coveralls.io and enable your repository.
goveralls doesn't detect drone.io job id automatically yet. Please send a Pull Request to fix this if this is your preferred setup.
To use coveralls.io, you must check-in a pre-commit-go.yml that has a coverage
check with use_coveralls: true
.
When running under CI, you'll want it to run more tests than run locally, in particular things that take too much time for a user to test. You can configure this with adding a pre-commit-go.yml file in your repository. You can also enable running lint checks by default on your CI by enabling it explicitly:
pcg installrun -m all -a