.gitlab-ci.yml 2.16 KB
Newer Older
François Agneray's avatar
François Agneray committed
1
2
stages:
    - install
3
    - test
4
    - sonar
François Agneray's avatar
François Agneray committed
5
6
7
8
    - build
    - deploy

variables:
9
10
    VERSION: "3.0"
    SONARQUBE_URL: https://sonarqube.lam.fr
François Agneray's avatar
François Agneray committed
11
12
13
14
15
16
17
18
19
20
21
22
    CONTAINER_IMAGE: portus.lam.fr/anis/anis-client

install:
    image: node:11
    stage: install
    script:
        - yarn global add @angular/cli
        - yarn install
        - ng build --prod
    cache:
        paths:
            - dist
23
            - node_modules
François Agneray's avatar
François Agneray committed
24
25
26
        policy: push
    only:
        refs:
27
            - develop
28

29
30
31
32
33
34
35
36
37
test:
    image: node:11
    stage: test
    script:
        - yarn global add @angular/cli
        - echo 'deb http://dl.google.com/linux/chrome/deb/ stable main' > /etc/apt/sources.list.d/chrome.list
        - wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
        - apt-get update
        - apt-get install -y google-chrome-stable
38
        - ng test --no-watch
39
40
41
42
43
44
45
46
47
48
49
    cache:
        paths:
            - dist
            - node_modules
            - coverage
        policy: pull-push
    only:
        refs:
            - develop


50
51
52
53
sonar_scanner:
    image: portus.lam.fr/ci-tools/sonar-scanner:latest
    stage: sonar
    script:
Tifenn Guillas's avatar
Tifenn Guillas committed
54
55
56
        - sonar-scanner \
         -Dsonar.projectKey=anis-client \
         -Dsonar.sources=src \
Tifenn Guillas's avatar
Tifenn Guillas committed
57
58
59
60
         -Dsonar.projectVersion=$VERSION \
         -Dsonar.host.url=$SONARQUBE_URL \
         -Dsonar.login=$SONAR_TOKEN \
         -Dsonar.exclusions=**.spec.ts \
Tifenn Guillas's avatar
Tifenn Guillas committed
61
         -Dsonar.typescript.lcov.reportPaths=./coverage/lcov.info
62
63
64
65
    cache:
        paths:
            - node_modules
        policy: pull
66
67
    only:
        refs:
68
            - develop
François Agneray's avatar
François Agneray committed
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83

build:
    image: docker:stable
    stage: build
    script:
        - docker login -u fagneray -p $PORTUS_TOKEN portus.lam.fr
        - docker pull $CONTAINER_IMAGE:latest-dev || true
        - docker build --cache-from $CONTAINER_IMAGE:latest-dev -t $CONTAINER_IMAGE:latest-dev .
        - docker push $CONTAINER_IMAGE:latest-dev
    cache:
        paths:
            - dist
        policy: pull
    only:
        refs:
84
            - develop
François Agneray's avatar
François Agneray committed
85
86
87
88
89
90
91
92
93

deploy:
    image: alpine
    stage: deploy
    script:
        - apk add --update curl
        - curl -XPOST $DEV_WEBHOOK
    only:
        refs:
94
            - develop