diff options
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. |