Skip to content
Snippets Groups Projects
.gitlab-ci.yml 1.74 KiB
Newer Older
  • Learn to ignore specific revisions
  • François Agneray's avatar
    François Agneray committed
    stages:
        - install_dependencies
        - sonar
        - build
        - dockerize
    
    variables:
        VERSION: "3.7.0"
        SONARQUBE_URL: https://sonarqube.lam.fr
    
    install_dependencies:
        image: node:16-slim
        stage: install_dependencies
        cache: 
    
            key: ${CI_COMMIT_REF_SLUG}_client
    
    François Agneray's avatar
    François Agneray committed
            paths:
    
                - client/node_modules
    
    François Agneray's avatar
    François Agneray committed
            policy: pull-push
        script:
    
    François Agneray's avatar
    François Agneray committed
            - yarn install
    
    sonar_scanner:
        image: sonarsource/sonar-scanner-cli:latest
        stage: sonar
        cache: 
    
            key: ${CI_COMMIT_REF_SLUG}_client
    
    François Agneray's avatar
    François Agneray committed
            paths:
    
                - client/node_modules
    
    François Agneray's avatar
    François Agneray committed
            policy: pull
        script:
    
    François Agneray's avatar
    François Agneray committed
            - sonar-scanner
    
                -Dsonar.projectKey=anis-client
    
    François Agneray's avatar
    François Agneray committed
                -Dsonar.sources=src
                -Dsonar.projectVersion=$VERSION 
                -Dsonar.host.url=$SONARQUBE_URL 
                -Dsonar.login=$SONAR_TOKEN_CLIENT
                -Dsonar.exclusions=**.spec.ts
                -Dsonar.typescript.lcov.reportPaths=./coverage/anis-next/lcov.info
    
    build:
        image: node:16-slim
        stage: build
        cache: 
    
            key: ${CI_COMMIT_REF_SLUG}_client
    
    François Agneray's avatar
    François Agneray committed
            paths:
    
                - client/node_modules
    
    François Agneray's avatar
    François Agneray committed
            policy: pull
        script:
    
    François Agneray's avatar
    François Agneray committed
            - yarn global add @angular/cli@latest
            - ng build
        artifacts:
            paths:
    
                - client/dist
    
    François Agneray's avatar
    François Agneray committed
    
    dockerize:
        image: docker:stable
        stage: dockerize
        cache: {}
        script:
    
    François Agneray's avatar
    François Agneray committed
            - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
            - docker pull $CI_REGISTRY/anis/anis-next/client:latest || true
            - docker build --cache-from $CI_REGISTRY/anis/anis-next/client:latest -t $CI_REGISTRY/anis/anis-next/client:latest .
            - docker push $CI_REGISTRY/anis/anis-next/client:latest