.gitlab-ci.yml 1.47 KB
Newer Older
Tom Käsler's avatar
Tom Käsler committed
1
stages:
2
  - install
Tom Käsler's avatar
Tom Käsler committed
3
  - test
4
  - build
Tom Käsler's avatar
Tom Käsler committed
5 6
  - deploy

7
cache:
Tom Käsler's avatar
Tom Käsler committed
8
  key: ${CI_COMMIT_REF_SLUG}
9
  paths:
Tom Käsler's avatar
Tom Käsler committed
10
    - node_modules/
11

12 13 14 15 16
install_node_modules:
  stage: install
  tags:
    - nodejs
  script:
17
    - npm install
Tom Käsler's avatar
Tom Käsler committed
18

19 20 21 22 23
ts_lint:
  stage: test
  tags:
    - nodejs
  script:
Tom Käsler's avatar
Tom Käsler committed
24
    - npm install
25 26 27
    - node_modules/tslint/bin/tslint -c tslint.json -p tsconfig.json

npm_test:
Tom Käsler's avatar
Tom Käsler committed
28
  stage: test
29
  allow_failure: true
Tom Käsler's avatar
Tom Käsler committed
30 31 32
  tags:
    - nodejs
  script:
33
    - npm install
34
    - node_modules/mocha/bin/mocha --opts src/tests/mocha.opts
Tom Käsler's avatar
Tom Käsler committed
35

36 37 38 39 40 41 42
build:
  stage: build
  only:
    - master
  tags:
    - nodejs
  script:
Tom Käsler's avatar
Tom Käsler committed
43
    - npm install
44 45 46
    - export NODE_ENV='production'
    - export ARSNOVA_CLICK_BACKEND_PORT_INTERNAL='3000'
    - export ARSNOVA_CLICK_BACKEND_ROUTE_PREFIX='/backend'
47
    - export LEADERBOARD_ALGORITHM='PointBased'
48
    - npm run build:PROD
Tom Käsler's avatar
Tom Käsler committed
49
    - cp package.json dist
50 51 52 53
  artifacts:
    paths:
      - dist

Tom Käsler's avatar
Tom Käsler committed
54 55 56 57 58
deploy:
  stage: deploy
  only:
    - master
  tags:
Tom Käsler's avatar
Tom Käsler committed
59
    - rsync
Tom Käsler's avatar
Tom Käsler committed
60 61 62 63 64
  dependencies:
    - build
  script:
    - chmod -R a+rX,ug+w .
    - eval $(ssh-agent -s)
Tom Käsler's avatar
fix  
Tom Käsler committed
65
    - mkdir ~/.ssh
66
    - ssh-keyscan "$STAGING_BACKEND_URL" >> ~/.ssh/known_hosts
Tom Käsler's avatar
Tom Käsler committed
67
    - ssh-add <(echo "$STAGING_SSH_PRIVATE_KEY")
Tom Käsler's avatar
Tom Käsler committed
68
    - rsync -rltgoDqv --delete -e "ssh" dist/* "$STAGING_BACKEND_SSH_URL"
69
    - rsync -rltgoDqv --delete -e "ssh" dist/* "$BETA_BACKEND_SSH_URL"
Tom Käsler's avatar
Tom Käsler committed
70
    - ssh $NEW_PRODUCTION_SSH 'touch /home/arsnova/arsnova.click-v2/backend/deploy.touch'
71
    - ssh $NEW_PRODUCTION_SSH 'touch /home/arsnova/arsnova.click-v2-beta/backend/deploy.touch'
Tom Käsler's avatar
Tom Käsler committed
72