From ac4d753863e32a3f1da2d073983e418d88401e67 Mon Sep 17 00:00:00 2001 From: Jasper Denkers Date: Fri, 26 Feb 2016 12:31:35 +0100 Subject: Added CI example for Scala and SBT Added CI test coverage parse regex for scoverage --- doc/ci/examples/README.md | 1 + doc/ci/examples/test-scala-application.md | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 doc/ci/examples/test-scala-application.md diff --git a/doc/ci/examples/README.md b/doc/ci/examples/README.md index cc059dc4376..20eeaad3fa3 100644 --- a/doc/ci/examples/README.md +++ b/doc/ci/examples/README.md @@ -4,6 +4,7 @@ - [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) +- [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..2df60321cfe --- /dev/null +++ b/doc/ci/examples/test-scala-application.md @@ -0,0 +1,28 @@ +## Test a Scala application + +This example demonstrates the integration of Gitlab CI with Scala applications using SBT. Checkout the example [project](https://gitlab.com/jasperdenkers/scala-sbt-sample-app) and [build status](https://gitlab.com/jasperdenkers/scala-sbt-sample-app/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 +before_script: + # 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 a 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 `Continuous Integration > Test coverage parsing` project setting to retrieve the test coverage rate from the build trace and have it displayed with your builds. -- cgit v1.2.1 From 707ca4bb91a29baf43908d025be356b6e00353fe Mon Sep 17 00:00:00 2001 From: Jasper Denkers Date: Thu, 10 Mar 2016 17:06:20 +0100 Subject: Refer to example project in gitlab-examples group --- doc/ci/examples/test-scala-application.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/ci/examples/test-scala-application.md b/doc/ci/examples/test-scala-application.md index 2df60321cfe..f1753157e9b 100644 --- a/doc/ci/examples/test-scala-application.md +++ b/doc/ci/examples/test-scala-application.md @@ -1,6 +1,6 @@ ## Test a Scala application -This example demonstrates the integration of Gitlab CI with Scala applications using SBT. Checkout the example [project](https://gitlab.com/jasperdenkers/scala-sbt-sample-app) and [build status](https://gitlab.com/jasperdenkers/scala-sbt-sample-app/builds). +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 -- cgit v1.2.1 From 9169c7e81fb906cf9f419d195d73a585b19dafbc Mon Sep 17 00:00:00 2001 From: Jasper Denkers Date: Thu, 10 Mar 2016 17:32:37 +0100 Subject: Add Java 8 image to Scala CI instructions --- doc/ci/examples/test-scala-application.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/ci/examples/test-scala-application.md b/doc/ci/examples/test-scala-application.md index f1753157e9b..58947f0f9f4 100644 --- a/doc/ci/examples/test-scala-application.md +++ b/doc/ci/examples/test-scala-application.md @@ -7,6 +7,8 @@ This example demonstrates the integration of Gitlab CI with Scala applications u The following `.gitlab-ci.yml` should be added in the root of your repository to trigger CI: ```yaml +image: java:8 + before_script: # Install SBT - echo "deb http://dl.bintray.com/sbt/debian /" | tee -a /etc/apt/sources.list.d/sbt.list -- cgit v1.2.1