summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2017-05-18 08:08:51 +0000
committerAchilleas Pipinellis <axilleas@axilleas.me>2017-05-18 08:08:51 +0000
commite74f3b05bc0ed617dd459d9c05ad19734dfc0340 (patch)
tree26f0b5fb23f5754689c28aa6972aa234f9f748c5
parenta49337727be1e28c29ad19b310fa2eb2df828c91 (diff)
downloadgitlab-ce-e74f3b05bc0ed617dd459d9c05ad19734dfc0340.tar.gz
Add Code Climate CLI example to CI documentation
-rw-r--r--doc/ci/README.md1
-rw-r--r--doc/ci/examples/README.md1
-rw-r--r--doc/ci/examples/code_climate.md28
3 files changed, 30 insertions, 0 deletions
diff --git a/doc/ci/README.md b/doc/ci/README.md
index c4f9a3cb573..86de0ee9043 100644
--- a/doc/ci/README.md
+++ b/doc/ci/README.md
@@ -108,6 +108,7 @@ Here is an collection of tutorials and guides on setting up your CI pipeline.
- [Scala](examples/test-scala-application.md)
- [Phoenix](examples/test-phoenix-application.md)
- [Run PHP Composer & NPM scripts then deploy them to a staging server](examples/deployment/composer-npm-deploy.md)
+ - [Analyze code quality with the Code Climate CLI](examples/code_climate.md)
- **Blog posts**
- [Automated Debian packaging](https://about.gitlab.com/2016/10/12/automated-debian-package-build-with-gitlab-ci/)
- [Spring boot application with GitLab CI and Kubernetes](https://about.gitlab.com/2016/12/14/continuous-delivery-of-a-spring-boot-application-with-gitlab-ci-and-kubernetes/)
diff --git a/doc/ci/examples/README.md b/doc/ci/examples/README.md
index 33c27b39a8a..2458cb959ab 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 the Code Climate CLI](code_climate.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_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