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.
- Visit https://travis-ci.org and connect your github account (or whatever git host provider) to Travis. Enable your repository.
- Copy
sample/travis.yml
as
.travis.yml
in your repository and push it.
- Visit https://drone.io and connect your github account (or whatever git host provider) to Drone. Enable your repository.
- At page "Setup your Build Script", put:
go get -d -t ./...
go get github.com/maruel/pre-commit-go/cmd/pcg
pcg
- Visit https://circleci.com and enable your repository.
- Click 'Project Settings', 'Dependency Commands' and type:
go get github.com/maruel/pre-commit-go/cmd/pcg
- Click 'Test Commands' and type:
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