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 | |
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>
-rw-r--r-- | doc/ci/examples/README.md | 1 | ||||
-rw-r--r-- | doc/ci/examples/code_quality.md | 24 |
2 files changed, 25 insertions, 0 deletions
diff --git a/doc/ci/examples/README.md b/doc/ci/examples/README.md index 33c27b39a8a..b232fb838f4 100644 --- a/doc/ci/examples/README.md +++ b/doc/ci/examples/README.md @@ -55,6 +55,7 @@ Apart from those, here is an collection of tutorials and guides on setting up yo - [Using `dpl` as deployment tool](deployment/README.md) - [Repositories with examples for various languages](https://gitlab.com/groups/gitlab-examples) - [The .gitlab-ci.yml file for GitLab itself](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/.gitlab-ci.yml) +- [Analyze code quality with Code Climate CLI](examples/code_quality.md) - **Articles:** - [Continuous Deployment with GitLab: how to build and deploy a Debian Package with GitLab CI](https://about.gitlab.com/2016/10/12/automated-debian-package-build-with-gitlab-ci/) 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. |