.gitlab-ci.yml 3.06 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"
Caro Axel's avatar
Caro Axel committed
39 40 41
    - "go test -coverprofile dfsst_entities.part -v dfss/dfsst/entities"
    - "go test -coverprofile dfsst_resolve.part -v dfss/dfsst/resolve"
    - "go test -coverprofile dfsst_server.part -v dfss/dfsst/server"
Tristan Claverie's avatar
Tristan Claverie committed
42 43
    - "echo 'mode: set' *part > c.out"
    - "grep -h -v 'mode: set' *part >> c.out"
Loïck Bonniot's avatar
Loïck Bonniot committed
44
    - "go tool cover -html=c.out -o coverage.html"
Loïck Bonniot's avatar
Add CI  
Loïck Bonniot committed
45

46
Integration tests:
Loïck Bonniot's avatar
Loïck Bonniot committed
47
  stage: test
48 49
  except:
    - /^[0-9]+\./
Loïck Bonniot's avatar
Loïck Bonniot committed
50
  tags:
51 52
    - golang
    - mongo
53
    - goqt
54 55
  services:
    - "lesterpig/mongo:latest"
Loïck Bonniot's avatar
Loïck Bonniot committed
56
  script:
Loïck Bonniot's avatar
Loïck Bonniot committed
57
    - "ln -s -f $(pwd) $GOPATH/src/dfss"
Richer Maximilien's avatar
Richer Maximilien committed
58
    - "./build/deps.sh"
59
    - "cd $GOPATH/src/dfss && make install"
60 61 62 63 64 65 66
    # 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
67 68
    - "cp $GOPATH/src/dfss/dfssd/dfssd $GOPATH/bin/"
    - "cp $GOPATH/src/dfss/dfssd/libqtdrv.ui.so.1 /lib/"
69
    # Start integration tests
70
    - "go test -v dfss/tests"
Loïck Bonniot's avatar
Loïck Bonniot committed
71

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

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