.gitlab-ci.yml 2.73 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

Loïck Bonniot's avatar
Loïck Bonniot committed
41
42
43
44
45
ARM tests:
  stage: test
  tags:
    - arm
  script:
Loïck Bonniot's avatar
Loïck Bonniot committed
46
    - "ln -s -f $(pwd) $GOPATH/src/dfss"
Richer Maximilien's avatar
Richer Maximilien committed
47
    - "./build/deps.sh"
48
    - "cd $GOPATH/src/dfss && go install ./..."
Loïck Bonniot's avatar
Loïck Bonniot committed
49
50
    - "go test -cover -short -v dfss/auth"
    - "go test -cover -short -v dfss/mgdb"
Loïck Bonniot's avatar
Loïck Bonniot committed
51
    - "go test -cover -short -v dfss/net"
Loïck Bonniot's avatar
Loïck Bonniot committed
52
    - "go test -cover -short -v dfss/dfssp/authority"
53
54
    - "go test -cover -short -v dfss/dfssp/user"
    - "go test -cover -short -v dfss/dfssp/contract"
55
    - "go test -cover -short -v dfss/dfssp/templates"
56
    - "go test -cover -short -v dfss/dfssd"
57
58
59
    - "go test -cover -short -v dfss/dfssc/common"
    - "go test -cover -short -v dfss/dfssc/security"
    - "go test -cover -short -v dfss/dfssc/user"
Loïck Bonniot's avatar
Loïck Bonniot committed
60
    - "go test -cover -short -v dfss/dfssc/sign"
Loïck Bonniot's avatar
Loïck Bonniot committed
61

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

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"