.gitlab-ci.yml 2.25 KB
Newer Older
1 2 3
before_script:
  - go version

Loïck Bonniot's avatar
Add CI  
Loïck Bonniot committed
4 5
stages:
  - test
Loïck Bonniot's avatar
Loïck Bonniot committed
6
  - deploy
Loïck Bonniot's avatar
Add CI  
Loïck Bonniot committed
7

Loïck Bonniot's avatar
Loïck Bonniot committed
8
Unit tests:
Loïck Bonniot's avatar
Add CI  
Loïck Bonniot committed
9 10 11 12 13 14 15
  stage: test
  tags:
    - golang
    - mongo  # Require an available mongo service
    - strong # Disable this build on small runners
  services:
    - "lesterpig/mongo:latest" # Use this light version of mongo
Quentin DAUCHY's avatar
Quentin DAUCHY committed
16
    - "lesterpig/postfix:latest"
Loïck Bonniot's avatar
Loïck Bonniot committed
17 18 19
  artifacts:
    paths:
      - "coverage.html"
Loïck Bonniot's avatar
Loïck Bonniot committed
20
  script:
21
    - "ln -s $(pwd) $GOPATH/src/dfss"
Richer Maximilien's avatar
Richer Maximilien committed
22
    - "./build/deps.sh"
23
    - "cd $GOPATH/src/dfss && go install ./..."
24 25 26
    - "go test -coverprofile auth.part -v dfss/auth"
    - "go test -coverprofile mgdb.part -v dfss/mgdb"
    - "go test -coverprofile mails.part -v dfss/mails"
Loïck Bonniot's avatar
Loïck Bonniot committed
27
    - "go test -coverprofile net.part -v dfss/net"
28
    - "go test -coverprofile dfssp_authority.part -v dfss/dfssp/authority"
29 30
    - "go test -coverprofile dfssp_user.part -v dfss/dfssp/user"
    - "go test -coverprofile dfssp_contract.part -v dfss/dfssp/contract"
31
    - "go test -coverprofile dfssp_templates.part -v dfss/dfssp/templates"
32
    - "go test -coverprofile dfssd.part -v dfss/dfssd"
33 34 35
    - "go test -coverprofile dfssc_common.part -v dfss/dfssc/common"
    - "go test -coverprofile dfssc_security.part -v dfss/dfssc/security"
    - "go test -coverprofile dfssc_user.part -v dfss/dfssc/user"
Loïck Bonniot's avatar
Loïck Bonniot committed
36
    - "go test -coverprofile dfssc_user.part -v dfss/dfssc/sign"
Tristan Claverie's avatar
Tristan Claverie committed
37 38
    - "echo 'mode: set' *part > c.out"
    - "grep -h -v 'mode: set' *part >> c.out"
Loïck Bonniot's avatar
Loïck Bonniot committed
39
    - "go tool cover -html=c.out -o coverage.html"
Loïck Bonniot's avatar
Add CI  
Loïck Bonniot committed
40

41
Integration tests:
Loïck Bonniot's avatar
Loïck Bonniot committed
42 43
  stage: test
  tags:
44 45
    - golang
    - mongo
46 47
  services:
    - "lesterpig/mongo:latest"
Loïck Bonniot's avatar
Loïck Bonniot committed
48
  script:
Loïck Bonniot's avatar
Loïck Bonniot committed
49
    - "ln -s -f $(pwd) $GOPATH/src/dfss"
Richer Maximilien's avatar
Richer Maximilien committed
50
    - "./build/deps.sh"
51
    - "cd $GOPATH/src/dfss && go install ./..."
52
    - "go test -v dfss/tests"
Loïck Bonniot's avatar
Loïck Bonniot committed
53

Loïck Bonniot's avatar
Loïck Bonniot committed
54
Code lint:
Loïck Bonniot's avatar
Add CI  
Loïck Bonniot committed
55 56 57 58 59 60
  stage: test
  allow_failure: True
  tags:
    - golang
    - lint
  script:
61
    - "ln -s $(pwd) $GOPATH/src/dfss"
Loïck Bonniot's avatar
Add CI  
Loïck Bonniot committed
62
    - "go get github.com/alecthomas/gometalinter"
Richer Maximilien's avatar
Richer Maximilien committed
63
    - "./build/deps.sh"
Loïck Bonniot's avatar
Loïck Bonniot committed
64
    - "cd $GOPATH/src/dfss && go install ./..."
Loïck Bonniot's avatar
Add CI  
Loïck Bonniot committed
65
    - "gometalinter --install"
Loïck Bonniot's avatar
Loïck Bonniot committed
66
    - "gometalinter -t --deadline=600s -j1 --skip=api --skip=fixtures --disable=aligncheck ./..."
Loïck Bonniot's avatar
Loïck Bonniot committed
67 68 69 70 71 72 73 74 75 76 77 78 79 80

Deploy:
  stage: deploy
  only:
    - /^v[0-9]/
    - master
  tags:
    - golang
    - strong
  script:
    - "ln -s -f $(pwd) $GOPATH/src/dfss"
    - "./build/deps.sh"
    - "make release"
    - "make deploy"