stages: - install_dependencies - test - sonar - build - dockerize - deploy 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 paths: - client/node_modules policy: pull-push script: - cd client - yarn install test: image: node:16-slim stage: test cache: key: ${CI_COMMIT_REF_SLUG}_client paths: - node_modules policy: pull script: - cd client - npx jest --coverage --coverageReporters lcov artifacts: paths: - client/coverage sonar_scanner: image: sonarsource/sonar-scanner-cli:latest stage: sonar cache: key: ${CI_COMMIT_REF_SLUG}_client paths: - client/node_modules policy: pull script: - cd client - sonar-scanner -Dsonar.projectKey=anis-client -Dsonar.sources=src -Dsonar.projectVersion=$VERSION -Dsonar.host.url=$SONARQUBE_URL -Dsonar.login=$SONAR_TOKEN_CLIENT -Dsonar.exclusions=**.spec.ts,**/assets/** -Dsonar.javascript.lcov.reportPaths=./coverage/anis-client/lcov.info build: image: node:16-slim stage: build cache: key: ${CI_COMMIT_REF_SLUG}_client paths: - client/node_modules policy: pull script: - cd client - yarn global add @angular/cli@latest - ng build artifacts: paths: - client/dist dockerize: image: docker:stable stage: dockerize cache: {} script: - cd client - 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 deploy: image: alpine stage: deploy variables: GIT_STRATEGY: none cache: {} dependencies: [] script: - apk add --update curl - curl -XPOST $DEV_WEBHOOK_CLIENT only: refs: - develop