diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2017-05-18 08:08:51 +0000 |
---|---|---|
committer | Achilleas Pipinellis <axilleas@axilleas.me> | 2017-05-18 08:08:51 +0000 |
commit | e74f3b05bc0ed617dd459d9c05ad19734dfc0340 (patch) | |
tree | 26f0b5fb23f5754689c28aa6972aa234f9f748c5 /doc/ci/examples/code_climate.md | |
parent | a49337727be1e28c29ad19b310fa2eb2df828c91 (diff) | |
download | gitlab-ce-e74f3b05bc0ed617dd459d9c05ad19734dfc0340.tar.gz |
Add Code Climate CLI example to CI documentation
Diffstat (limited to 'doc/ci/examples/code_climate.md')
-rw-r--r-- | doc/ci/examples/code_climate.md | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/doc/ci/examples/code_climate.md b/doc/ci/examples/code_climate.md new file mode 100644 index 00000000000..bd53f80ce14 --- /dev/null +++ b/doc/ci/examples/code_climate.md @@ -0,0 +1,28 @@ +# Analyze project code quality with Code Climate CLI + +This example shows how to run [Code Climate CLI][cli] on your code by using\ +GitLab CI and Docker. + +First, you need GitLab Runner with [docker-in-docker executor](../docker/using_docker_build.md#use-docker-in-docker-executor). + +Once you setup the Runner add new job to `.gitlab-ci.yml`: + +```yaml +codeclimate: + image: docker:latest + variables: + DOCKER_DRIVER: overlay + services: + - docker:dind + script: + - docker pull codeclimate/codeclimate + - docker run --env CODECLIMATE_CODE="$PWD" --volume "$PWD":/code --volume /var/run/docker.sock:/var/run/docker.sock --volume /tmp/cc:/tmp/cc codeclimate/codeclimate init + - docker run --env CODECLIMATE_CODE="$PWD" --volume "$PWD":/code --volume /var/run/docker.sock:/var/run/docker.sock --volume /tmp/cc:/tmp/cc codeclimate/codeclimate analyze -f json > codeclimate.json + artifacts: + paths: [codeclimate.json] +``` + +This will create a `codeclimate` job in your CI pipeline and will allow you to +download and analyze the report artifact in JSON format. + +[cli]: https://github.com/codeclimate/codeclimate |