.gitlab-ci.yml 2.87 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
    - goqt
51 52
  services:
    - "lesterpig/mongo:latest"
Loïck Bonniot's avatar
Loïck Bonniot committed
53
  script:
Loïck Bonniot's avatar
Loïck Bonniot committed
54
    - "ln -s -f $(pwd) $GOPATH/src/dfss"
Richer Maximilien's avatar
Richer Maximilien committed
55
    - "./build/deps.sh"
56
    - "cd $GOPATH/src/dfss && make install"
57 58 59 60 61 62 63
    # Copy required files
    - "cp $GOPATH/src/github.com/visualfc/goqt/bin/* $GOPATH/src/dfss/dfssd/"
    # Build ressources
    - "cd $GOPATH/src/dfss/dfssd/gui && ../goqt_rcc -go gui -o application.qrc.go application.qrc"
    # Build binary
    - "cd $GOPATH/src/dfss/dfssd && go build -ldflags \"-r .\" -o dfssd"
    # Install binary
64 65
    - "cp $GOPATH/src/dfss/dfssd/dfssd $GOPATH/bin/"
    - "cp $GOPATH/src/dfss/dfssd/libqtdrv.ui.so.1 /lib/"
66
    # Start integration tests
67
    - "go test -v dfss/tests"
Loïck Bonniot's avatar
Loïck Bonniot committed
68

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

Deploy:
  stage: deploy
  only:
88 89
   - /^v[0-9]/
   - master
Loïck Bonniot's avatar
Loïck Bonniot committed
90 91 92
  tags:
    - golang
    - strong
93
    - goqt
94
    - deploy
Loïck Bonniot's avatar
Loïck Bonniot committed
95 96 97 98 99
  script:
    - "ln -s -f $(pwd) $GOPATH/src/dfss"
    - "./build/deps.sh"
    - "make release"
    - "make deploy"