.gitlab-ci.yml 2.36 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
  stage: test
10
11
  except:
    - /^[0-9]+\./
Loïck Bonniot's avatar
Add CI  
Loïck Bonniot committed
12
13
14
15
16
17
  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
18
    - "lesterpig/postfix:latest"
Loïck Bonniot's avatar
Loïck Bonniot committed
19
20
21
  artifacts:
    paths:
      - "coverage.html"
Loïck Bonniot's avatar
Loïck Bonniot committed
22
  script:
23
    - "ln -s $(pwd) $GOPATH/src/dfss"
Richer Maximilien's avatar
Richer Maximilien committed
24
    - "./build/deps.sh"
25
    - "cd $GOPATH/src/dfss && make install"
26
27
28
    - "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
29
    - "go test -coverprofile net.part -v dfss/net"
30
    - "go test -coverprofile dfssp_authority.part -v dfss/dfssp/authority"
31
32
    - "go test -coverprofile dfssp_user.part -v dfss/dfssp/user"
    - "go test -coverprofile dfssp_contract.part -v dfss/dfssp/contract"
33
    - "go test -coverprofile dfssp_templates.part -v dfss/dfssp/templates"
34
    - "go test -coverprofile dfssp_common.part -v dfss/dfssp/common"
35
36
37
    - "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
38
    - "go test -coverprofile dfssc_user.part -v dfss/dfssc/sign"
Tristan Claverie's avatar
Tristan Claverie committed
39
40
    - "echo 'mode: set' *part > c.out"
    - "grep -h -v 'mode: set' *part >> c.out"
Loïck Bonniot's avatar
Loïck Bonniot committed
41
    - "go tool cover -html=c.out -o coverage.html"
Loïck Bonniot's avatar
Add CI  
Loïck Bonniot committed
42

43
Integration tests:
Loïck Bonniot's avatar
Loïck Bonniot committed
44
  stage: test
45
46
  except:
    - /^[0-9]+\./
Loïck Bonniot's avatar
Loïck Bonniot committed
47
  tags:
48
49
    - golang
    - mongo
50
51
  services:
    - "lesterpig/mongo:latest"
Loïck Bonniot's avatar
Loïck Bonniot committed
52
  script:
Loïck Bonniot's avatar
Loïck Bonniot committed
53
    - "ln -s -f $(pwd) $GOPATH/src/dfss"
Richer Maximilien's avatar
Richer Maximilien committed
54
    - "./build/deps.sh"
55
    - "cd $GOPATH/src/dfss && make install"
56
    - "go test -v dfss/tests"
Loïck Bonniot's avatar
Loïck Bonniot committed
57

Loïck Bonniot's avatar
Loïck Bonniot committed
58
Code lint:
Loïck Bonniot's avatar
Add CI  
Loïck Bonniot committed
59
  stage: test
60
61
  except:
    - /^[0-9]+\./
Loïck Bonniot's avatar
Add CI  
Loïck Bonniot committed
62
63
64
65
66
  allow_failure: True
  tags:
    - golang
    - lint
  script:
67
    - "ln -s $(pwd) $GOPATH/src/dfss"
Loïck Bonniot's avatar
Add CI  
Loïck Bonniot committed
68
    - "go get github.com/alecthomas/gometalinter"
Richer Maximilien's avatar
Richer Maximilien committed
69
    - "./build/deps.sh"
Loïck Bonniot's avatar
Loïck Bonniot committed
70
    - "cd $GOPATH/src/dfss && make install_all"
Loïck Bonniot's avatar
Add CI  
Loïck Bonniot committed
71
    - "gometalinter --install"
72
    - "gometalinter -t --deadline=600s -j1 --skip=api --skip=fixtures --skip=gui --skip=dfssd --disable=aligncheck ./..."
Loïck Bonniot's avatar
Loïck Bonniot committed
73
74
75
76
77
78
79
80
81
82
83
84
85
86

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"