diff options
author | Achilleas Pipinellis <axilleas@axilleas.me> | 2016-06-18 07:51:51 +0000 |
---|---|---|
committer | Achilleas Pipinellis <axilleas@axilleas.me> | 2016-06-18 07:51:51 +0000 |
commit | 3d766b347b072e16270a2b3479af976c404f2948 (patch) | |
tree | a18d1dfad849311b38812db98d3f9cad520a49dc | |
parent | 00906b5bb6cde8cb60281109060a519a54000c61 (diff) | |
parent | 56777e89562fe9c81f6e9237bff9cee6420fc093 (diff) | |
download | gitlab-ce-3d766b347b072e16270a2b3479af976c404f2948.tar.gz |
Merge branch 'ci-scala-example' into 'master'
Ci scala example
## What does this MR do?
Add a scala CI example.
## Why was this MR needed?
Supersedes https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/2984
See merge request !4774
-rw-r--r-- | doc/ci/examples/README.md | 3 | ||||
-rw-r--r-- | doc/ci/examples/test-scala-application.md | 47 |
2 files changed, 49 insertions, 1 deletions
diff --git a/doc/ci/examples/README.md b/doc/ci/examples/README.md index 61294be599d..27bc21c2922 100644 --- a/doc/ci/examples/README.md +++ b/doc/ci/examples/README.md @@ -4,7 +4,8 @@ - [Test and deploy a Ruby application to Heroku](test-and-deploy-ruby-application-to-heroku.md) - [Test and deploy a Python application to Heroku](test-and-deploy-python-application-to-heroku.md) - [Test a Clojure application](test-clojure-application.md) -- [Using `dpl` as deployment tool](../deployment/README.md) +- [Test a Scala application](test-scala-application.md) +- [Using `dpl` as deployment tool](deployment/README.md) - Help your favorite programming language and GitLab by sending a merge request with a guide for that language. diff --git a/doc/ci/examples/test-scala-application.md b/doc/ci/examples/test-scala-application.md new file mode 100644 index 00000000000..7412fdbbc78 --- /dev/null +++ b/doc/ci/examples/test-scala-application.md @@ -0,0 +1,47 @@ +## Test a Scala application + +This example demonstrates the integration of Gitlab CI with Scala +applications using SBT. Checkout the example +[project](https://gitlab.com/gitlab-examples/scala-sbt) and +[build status](https://gitlab.com/gitlab-examples/scala-sbt/builds). + +### Add `.gitlab-ci.yml` file to project + +The following `.gitlab-ci.yml` should be added in the root of your +repository to trigger CI: + +``` yaml +image: java:8 + +before_script: + - apt-get update -y + - apt-get install apt-transport-https -y + # Install SBT + - echo "deb http://dl.bintray.com/sbt/debian /" | tee -a /etc/apt/sources.list.d/sbt.list + - apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 642AC823 + - apt-get update -y + - apt-get install sbt -y + - sbt sbt-version + +test: + script: + - sbt clean coverage test coverageReport +``` + +The `before_script` installs [SBT](http://www.scala-sbt.org/) and +displays the version that is being used. The `test` stage executes SBT +to compile and test the project. +[scoverage](https://github.com/scoverage/sbt-scoverage) is used as an SBT +plugin to measure test coverage. + +You can use other versions of Scala and SBT by defining them in +`build.sbt`. + +### Display test coverage in build + +Add the `Coverage was \[\d+.\d+\%\]` regular expression in the +**Settings > Edit Project > Test coverage parsing** project setting to +retrieve the test coverage rate from the build trace and have it +displayed with your builds. + +**Builds** must be enabled for this option to appear. |