.gitlab-ci.yml 1.16 KB
Newer Older
1 2 3
stages:
  - test
  - build
4
  - synchronization
5

Tom Käsler's avatar
Tom Käsler committed
6 7 8
services:
  - mysql:latest

Tom Käsler's avatar
Tom Käsler committed
9 10 11 12
variables:
  # Configure mysql environment variables (https://hub.docker.com/r/_/mysql/)
  MYSQL_DATABASE: arsnova3
  MYSQL_ROOT_PASSWORD: arsnova3_prototype
13
  WAR_FILE: target/scala-2.11/arsnova-3-backend*.jar
Tom Käsler's avatar
Tom Käsler committed
14
  MIRROR_REPO: git@github.com:thm-projects/arsnova-3-backend.git
Tom Käsler's avatar
Tom Käsler committed
15

Tom Käsler's avatar
Tom Käsler committed
16
stylecheck:
17
  stage: test
Tom Käsler's avatar
Tom Käsler committed
18 19
  tags:
    - sbt
20
  dependencies: []
Tom Käsler's avatar
Tom Käsler committed
21 22 23 24
  script:
    - sbt scalastyle
    - sbt test:scalastyle

Tom Käsler's avatar
Tom Käsler committed
25
test:
26
  stage: test
Tom Käsler's avatar
Tom Käsler committed
27 28
  tags:
    - sbt
29
  dependencies: []
Tom Käsler's avatar
Tom Käsler committed
30 31
  script:
    # Execute your project's tests
Tom Käsler's avatar
Tom Käsler committed
32 33
    - sbt clean test

Tom Käsler's avatar
Tom Käsler committed
34 35 36 37 38 39
sync_mirror:
  stage: synchronization
  when: always
  allow_failure: true
  script:
    - git clone --bare "$CI_BUILD_REPO" mirror.git
Tom Käsler's avatar
Tom Käsler committed
40 41
    - mkdir ~/.ssh && echo "$GITHUB_HOST_KEY" > ~/.ssh/known_hosts
    - eval $(ssh-agent -s) && ssh-add <(echo "$GITHUB_DEPLOY_KEY")
Tom Käsler's avatar
Tom Käsler committed
42 43 44 45 46
    - cd mirror.git
    - git update-ref -d refs/tags/production
    - git update-ref -d refs/tags/staging
    - git push --mirror "$MIRROR_REPO"

Tom Käsler's avatar
Tom Käsler committed
47 48
package:
  stage: build
49 50 51
  only:
    - master
    - /^v[0-9]+/
Tom Käsler's avatar
Tom Käsler committed
52 53
  tags:
    - sbt
54 55 56
  dependencies: []
  script:
    - sbt assembly
Tom Käsler's avatar
Tom Käsler committed
57 58 59
  artifacts:
    paths:
      - $WAR_FILE