diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2017-05-15 09:23:20 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2017-05-15 09:23:20 +0300 |
commit | 81f08d7b38c89167d016fbe4bf475cf373055947 (patch) | |
tree | 8c43bac9fc2d652641e7c6322b8c2362a3e56e4f /doc/ci/examples/code_quality.md | |
parent | f70075b6d09e8cdf0898afb3d8696b881228c363 (diff) | |
download | gitlab-ce-dz-codeclimate-doc.tar.gz |
Add Code Climate CLI example to CI documentationdz-codeclimate-doc
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'doc/ci/examples/code_quality.md')
-rw-r--r-- | doc/ci/examples/code_quality.md | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/doc/ci/examples/code_quality.md b/doc/ci/examples/code_quality.md new file mode 100644 index 00000000000..f46b1b22631 --- /dev/null +++ b/doc/ci/examples/code_quality.md @@ -0,0 +1,24 @@ +# Analyze project code quality with Code Climate CLI + +This example shows how to run Code Climate CLI on your code by using GitLab CI and docker. + +First, you need GitLab runner with docker-in-docker executor - https://docs.gitlab.com/ce/ci/docker/using_docker_build.html#use-docker-in-docker-executor. + +Once you setup runner let's add new job to the `.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 `codeclimate` job in your CI pipeline and will allow you to download analyse report artifact in JSON format. |