Commit 8f233181 authored by Pedro Eduardo Trujillo's avatar Pedro Eduardo Trujillo
Browse files

Actualiza CI/CD con nuevas plantillas

parent 771cc1fb
Loading
Loading
Loading
Loading
+45 −40
Original line number Diff line number Diff line
@@ -8,24 +8,32 @@ include:
  - project: 'redmic-project/gitlab-ci-templates'
    ref: master
    file: '/deployment.yml'
  - project: 'redmic-project/gitlab-ci-templates'
    ref: master
    file: '/deployment-custom-image.yml'

stages:
  - pre-build
  - test-code
  - build
  - license-list
  - pre-package
  - package
  - test-package
  - post-package
  - deploy
  - test-deploy

variables:
  STACK: client
  WEB_BUILD_IMAGE_NAME: registry.gitlab.com/redmic-project/docker/web-build
  WEB_BUILD_IMAGE_TAG: latest
  PROJECT_PARENT_NAME: client

.web-build:
  image: ${WEB_BUILD_IMAGE_NAME}:${WEB_BUILD_IMAGE_TAG}
  variables:
    WEB_BUILD_IMAGE_NAME: registry.gitlab.com/redmic-project/docker/web-build
    WEB_BUILD_IMAGE_TAG: latest
  before_script:
    - type yarn grunt java
    - yarn install
    - grunt preBuild
  cache:
    paths:
      - node_modules/
@@ -34,24 +42,21 @@ variables:
      - public/stylesheets/node_modules/
    policy: pull

.prepare-dependencies:
  extends: .web-build
  variables:
    GIT_SUBMODULE_STRATEGY: normal
  before_script:
    - type yarn grunt java
    - yarn install || yarn install
.only-non-master-branches-job:
  rules: &only-non-master-branches-job-rules
    - if: $CI_MERGE_REQUEST_ID ||
          $CI_COMMIT_TAG ||
          $CI_PIPELINE_SOURCE == "schedule" ||
          $CI_COMMIT_BRANCH == "master"
      when: never
    - if: $CI_COMMIT_BRANCH

prepare-unbuilt-version:
  extends: .web-build
  stage: pre-build
  extends: .prepare-dependencies
  script:
    - grunt preBuild
  only:
    - branches
  except:
    - master
    - schedules
  variables:
    GIT_SUBMODULE_STRATEGY: normal
  script: ':'
  cache:
    policy: pull-push
  artifacts:
@@ -65,50 +70,50 @@ prepare-unbuilt-version:
      - public/stylesheets/style.styl
      - public/stylesheets/src/
      - public/stylesheets/submodules/
  rules: *only-non-master-branches-job-rules

run-unit-tests:
  stage: test-code
  extends: .web-build
  stage: pre-build
  script:
    - grunt test | tee test.out
    - coverage=$(grep '^All files.*' test.out | cut -d '|' -f 2 | tr -d ' ')
    - echo "Coverage - ${coverage}%"
    - rm test.out
  only:
    - branches
  except:
    - master
    - schedules
  rules: *only-non-master-branches-job-rules

run-modules-functional-tests:
  stage: test-code
  extends: .web-build
  stage: pre-build
  script:
    - npm start &
    - grunt test-functional-local --functionalSuites=tests/functional/modules/**/!\(*Script\).js --headless
  only:
    - branches
  except:
    - master
    - schedules
  rules: *only-non-master-branches-job-rules

prepare-built-version:
  extends: .web-build
  stage: build
  extends: .prepare-dependencies
  variables:
    GIT_SUBMODULE_STRATEGY: normal
  script:
    - grunt
  only:
    - branches
  except:
    - schedules
  dependencies: []
  artifacts:
    name: ${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}
    expire_in: 1 month
    paths:
      - dist*.tar.gz
  rules:
    - if: $CI_MERGE_REQUEST_ID ||
          $CI_COMMIT_TAG ||
          $CI_PIPELINE_SOURCE == "schedule"
      when: never
    - if: $CI_COMMIT_BRANCH

.deploy:
  variables:
    STACK: ${PROJECT_PARENT_NAME}
    SERVICES_TO_CHECK: ${PROJECT_PARENT_NAME}_${CI_PROJECT_NAME}
  environment:
    url: https://${PUBLIC_HOSTNAME}

@@ -121,14 +126,12 @@ prepare-built-version:
    DD_PRODUCTION: 1

run-functional-tests:
  extends: .web-build
  stage: test-deploy
  extends: .prepare-dependencies
  script:
    - >
      grunt test-functional-local --serverUrl="https://${DEV_PUBLIC_HOSTNAME}" --user="${REDMIC_TEST_USER}"
      --pass="${REDMIC_TEST_PASS}" --role=administrator --suitesGroups="${SUITES_GROUPS}" --headless
  only:
    - schedules
  cache:
    paths:
      - node_modules/
@@ -139,3 +142,5 @@ run-functional-tests:
    when: always
    paths:
      - 'test_reports/test-functional-local*'
  rules:
    - if: $CI_PIPELINE_SOURCE == "schedule"
+1 −1
Original line number Diff line number Diff line
# REDMIC web client

| Metrics | Master | Develop |
| Metric | Master | Dev |
|:-:|:-:|:-:|
| CI status | [![pipeline status](https://gitlab.com/redmic-project/client/web/badges/master/pipeline.svg)](https://gitlab.com/redmic-project/client/web/commits/master) | [![pipeline status](https://gitlab.com/redmic-project/client/web/badges/dev/pipeline.svg)](https://gitlab.com/redmic-project/client/web/commits/dev) |
| Test coverage | [![coverage report](https://gitlab.com/redmic-project/client/web/badges/master/coverage.svg)](https://gitlab.com/redmic-project/client/web/commits/master) | [![coverage report](https://gitlab.com/redmic-project/client/web/badges/dev/coverage.svg)](https://gitlab.com/redmic-project/client/web/commits/dev) |