1 В избранное 0 Ответвления 0

OSCHINA-MIRROR/panda26-gitlab

Присоединиться к Gitlife
Откройте для себя и примите участие в публичных проектах с открытым исходным кодом с участием более 10 миллионов разработчиков. Приватные репозитории также полностью бесплатны :)
Присоединиться бесплатно
Клонировать/Скачать
test-scala-application.md 2.4 КБ
Копировать Редактировать Web IDE Исходные данные Просмотреть построчно История
Dmitriy Zaporozhets Отправлено 11.05.2017 22:21 9189cff

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 and build status.

Add .gitlab-ci.yml file to project

The following .gitlab-ci.yml should be added in the root of your repository to trigger CI:

image: java:8

stages:
  - test
  - deploy

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:
  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 and displays the version that is being used. The test stage executes SBT to compile and test the project. 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 job

Add the Coverage was \[\d+.\d+\%\] regular expression in the Settings ➔ Pipelines ➔ Coverage report project setting to retrieve the test coverage rate from the build trace and have it displayed with your jobs.

Pipelines must be enabled for this option to appear.

Heroku application

A Heroku application is required. You can create one through the Dashboard. 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. Add a secure variable with this value in Project ➔ Variables with key HEROKU_API_KEY.

Опубликовать ( 0 )

Вы можете оставить комментарий после Вход в систему

1
https://api.gitlife.ru/oschina-mirror/panda26-gitlab.git
git@api.gitlife.ru:oschina-mirror/panda26-gitlab.git
oschina-mirror
panda26-gitlab
panda26-gitlab
master