.gitlab-ci.yml 1.12 KB
Newer Older
Lukas Burgey's avatar
Add CI    
Lukas Burgey committed
1
2
3
4
5
image: golang:1.12-alpine

stages:
  - lint
  - build
Lukas Burgey's avatar
Lukas Burgey committed
6
  - deploy
Lukas Burgey's avatar
Add CI    
Lukas Burgey committed
7
8

before_script:
Lukas Burgey's avatar
Lukas Burgey committed
9
  - apk add --no-cache git make rsync openssh-client
Lukas Burgey's avatar
Add CI    
Lukas Burgey committed
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
  - mkdir -p /go/src/git.scc.kit.edu/feudal /go/src/_/builds
  - cp -r $CI_PROJECT_DIR /go/src/git.scc.kit.edu/feudal/feudalClient
  - ln -s /go/src/git.scc.kit.edu/feudal /go/src/_/builds/feudalClient
  - make dep

lint:
  stage: lint
  script:
    make lint

build:
  stage: build
  script:
    - make build
  artifacts:
    paths:
      - feudalClient
Lukas Burgey's avatar
Lukas Burgey committed
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55

deploy_dev:
  stage: deploy
  environment:
    name: dev
  only:
    - dev
    - master
  script:
    - eval $(ssh-agent -s)
    - echo "$SSH_PRIVATE_KEY" | ssh-add -
    - mkdir -p ~/.ssh
    - chmod 700 ~/.ssh
    - echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
    - rsync -v feudalClient $DEV_USER@$DEV_HOST:bin/feudalClientDev

deploy_master:
  stage: deploy
  environment:
    name: master
  only:
    - master
  script:
    - eval $(ssh-agent -s)
    - echo "$SSH_PRIVATE_KEY" | ssh-add -
    - mkdir -p ~/.ssh
    - chmod 700 ~/.ssh
    - echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
    - rsync -v feudalClient $DEV_USER@$DEV_HOST:bin/feudalClient