Skip to content
Snippets Groups Projects
.gitlab-ci.yml 2.06 KiB
Newer Older
  • Learn to ignore specific revisions
  • François Agneray's avatar
    François Agneray committed
    stages:
        - install
    
    François Agneray's avatar
    François Agneray committed
        - build
        - deploy
    
    variables:
    
        VERSION: "3.0"
        SONARQUBE_URL: https://sonarqube.lam.fr
    
    François Agneray's avatar
    François Agneray committed
        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
    
    François Agneray's avatar
    François Agneray committed
            policy: push
        only:
            refs:
    
    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
    
        cache:
            paths:
                - dist
                - node_modules
                - coverage
            policy: pull-push
        only:
            refs:
                - develop
    
    
    
    sonar_scanner:
        image: portus.lam.fr/ci-tools/sonar-scanner:latest
        stage: sonar
        script:
    
    Tifenn Guillas's avatar
    Tifenn Guillas committed
            - sonar-scanner -Dsonar.projectKey=anis-client -Dsonar.sources=src -Dsonar.projectVersion=$VERSION -Dsonar.host.url=$SONARQUBE_URL -Dsonar.login=$SONAR_TOKEN -Dsonar.typescript.lcov.reportPaths=./coverage/lcov.info
    
        cache:
            paths:
                - node_modules
            policy: pull
    
    François Agneray's avatar
    François Agneray committed
    
    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:
    
    François Agneray's avatar
    François Agneray committed
    
    deploy:
        image: alpine
        stage: deploy
        script:
            - apk add --update curl
            - curl -XPOST $DEV_WEBHOOK
        only:
            refs: