summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAchilleas Pipinellis <axilleas@axilleas.me>2016-11-18 16:56:25 +0100
committerAchilleas Pipinellis <axilleas@axilleas.me>2016-11-18 17:01:28 +0100
commit99ef207604ed39fbb662f1082fa6af517ed61a64 (patch)
tree7aba2f08801b871525eeb69389f4a0eadcf89ee6
parent58fb72bb9b8a21a6d7b955a8bcd683d2956a3d4a (diff)
downloadgitlab-ce-99ef207604ed39fbb662f1082fa6af517ed61a64.tar.gz
Merge the two Scala examples
[ci skip]
-rw-r--r--doc/ci/examples/README.md1
-rw-r--r--doc/ci/examples/test-and-deploy-scala-play-application-to-heroku.md44
-rw-r--r--doc/ci/examples/test-scala-application.md41
3 files changed, 35 insertions, 51 deletions
diff --git a/doc/ci/examples/README.md b/doc/ci/examples/README.md
index babdf21b0db..ffc310ec8c7 100644
--- a/doc/ci/examples/README.md
+++ b/doc/ci/examples/README.md
@@ -9,7 +9,6 @@ Apart from those, here is an collection of tutorials and guides on setting up yo
- [Testing a PHP application](php.md)
- [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 and deploy a Scala/Play application to Heroku](test-and-deploy-scala-play-application-to-heroku.md)
- [Test a Clojure application](test-clojure-application.md)
- [Test a Scala application](test-scala-application.md)
- [Test a Phoenix application](test-phoenix-application.md)
diff --git a/doc/ci/examples/test-and-deploy-scala-play-application-to-heroku.md b/doc/ci/examples/test-and-deploy-scala-play-application-to-heroku.md
deleted file mode 100644
index 81e35d6007b..00000000000
--- a/doc/ci/examples/test-and-deploy-scala-play-application-to-heroku.md
+++ /dev/null
@@ -1,44 +0,0 @@
-## Test and Deploy a Scala/Play application
-This example guides you in setting up Gitlab CI for Play Scala web applications with automated testing and deployment to Heroku. It is accompanied with a [running example](https://gitlab-play-sample-app.herokuapp.com/) ([source](https://gitlab.com/jasperdenkers/play-scala-heroku-sample-app) and [build status](https://gitlab.com/jasperdenkers/play-scala-heroku-sample-app/builds)).
-
-### Configure CI for your project
-Add the following `.gitlab-ci.yml` to an existing project based on Play:
-
-```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
- - apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 642AC823
- - apt-get update -yq
- - apt-get install sbt -y
- - sbt sbt-version
-
-stages:
- - test
- - deploy
-
-test:
- stage: test
- script:
- - sbt test
-
-deploy:
- stage: deploy
- script:
- - apt-get update -yq
- - apt-get install rubygems ruby-dev -y
- - gem install dpl
- - dpl --provider=heroku --app=gitlab-play-sample-app --api-key=$HEROKU_API_KEY
-```
-
-It consists of two stages:
-1. `test` - executes tests using SBT.
-2. `deploy` - automatically deploys the project to Heroku using dpl.
-
-### Heroku application
-A Heroku application is required. You can create one through the [Dashboard](https://dashboard.heroku.com/). Substitute `gitlab-play-sample-app` in the `.gitlab-ci.yml` file with your application's name.
-
-### Heroku API key
-You can look up your Heroku API key in your [account](https://dashboard.heroku.com/account). Add a variable with this value in `Project > Variables` with key `HEROKU_API_KEY`.
diff --git a/doc/ci/examples/test-scala-application.md b/doc/ci/examples/test-scala-application.md
index 7412fdbbc78..85f8849fa99 100644
--- a/doc/ci/examples/test-scala-application.md
+++ b/doc/ci/examples/test-scala-application.md
@@ -1,11 +1,11 @@
-## Test a Scala application
+# Test and deploy to Heroku 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
+## Add `.gitlab-ci.yml` file to project
The following `.gitlab-ci.yml` should be added in the root of your
repository to trigger CI:
@@ -13,10 +13,14 @@ repository to trigger CI:
``` yaml
image: java:8
+stages:
+ - test
+ - deploy
+
before_script:
- apt-get update -y
- apt-get install apt-transport-https -y
- # Install SBT
+ ## 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
@@ -24,8 +28,17 @@ before_script:
- sbt sbt-version
test:
+ stage: test
script:
- sbt clean coverage test coverageReport
+
+deploy:
+ stage: deploy
+ script:
+ - apt-get update -yq
+ - apt-get install rubygems ruby-dev -y
+ - gem install dpl
+ - dpl --provider=heroku --app=gitlab-play-sample-app --api-key=$HEROKU_API_KEY
```
The `before_script` installs [SBT](http://www.scala-sbt.org/) and
@@ -33,15 +46,31 @@ 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.
+The `deploy` stage automatically deploys the project to Heroku using dpl.
You can use other versions of Scala and SBT by defining them in
`build.sbt`.
-### Display test coverage in build
+## 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
+**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.
+
+## Heroku application
+
+A Heroku application is required. You can create one through the
+[Dashboard](https://dashboard.heroku.com/). Substitute `gitlab-play-sample-app`
+in the `.gitlab-ci.yml` file with your application's name.
+
+## Heroku API key
+
+You can look up your Heroku API key in your
+[account](https://dashboard.heroku.com/account). Add a secure [variable] with
+this value in **Project ➔ Variables** with key `HEROKU_API_KEY`.
+
+[variable]: ../variables/README.md#user-defined-variables-secure-variables
+[test coverage]: ../../user/project/pipelines/settings.md#test-coverage-report-badge