Commit e5596e4f authored by Pedro Eduardo Trujillo's avatar Pedro Eduardo Trujillo
Browse files

Disgrega definición de CI en varios ficheros

parent 9056a49e
Loading
Loading
Loading
Loading

.gitlab-ci.build.yml

0 → 100644
+56 −0
Original line number Diff line number Diff line
.web-build:
  image: ${WEB_BUILD_IMAGE_NAME}:${WEB_BUILD_IMAGE_TAG}
  variables:
    GIT_SUBMODULE_STRATEGY: normal
    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/
      - public/javascript/redmic-widgets/node_modules/
      - public/javascript/templates/node_modules/
      - public/stylesheets/node_modules/

prepare-unbuilt-version:
  extends: .web-build
  stage: pre-build
  script: ':'
  artifacts:
    name: ${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}
    expire_in: 1 week
    paths:
      - node_modules/
      - public/javascript/proj4js/dist/proj4.js
      - public/javascript/redmic-widgets/src/app/
      - public/javascript/templates/dist/
      - public/stylesheets/style.styl
      - public/stylesheets/src/
      - public/stylesheets/submodules/
  rules:
    - if: $CI_MERGE_REQUEST_ID ||
          $CI_COMMIT_TAG ||
          $CI_PIPELINE_SOURCE == "schedule" ||
          $CI_COMMIT_BRANCH == "master"
      when: never
    - if: $CI_COMMIT_BRANCH

prepare-built-version:
  extends: .web-build
  stage: build
  script:
    - grunt
  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_PIPELINE_SOURCE == "schedule"
      when: never
    - if: $CI_COMMIT_BRANCH || $CI_COMMIT_TAG

.gitlab-ci.test.yml

0 → 100644
+118 −0
Original line number Diff line number Diff line
.run-tests:
  extends: .web-build
  tags:
    - custom-runner
  cache:
    policy: pull

.run-pre-build-tests:
  extends: .run-tests
  stage: pre-build
  rules:
    - if: $CI_MERGE_REQUEST_ID ||
          $CI_COMMIT_TAG ||
          $CI_PIPELINE_SOURCE == "schedule" ||
          $CI_COMMIT_BRANCH == "master"
      when: never
    - if: $CI_COMMIT_BRANCH
  allow_failure: true

.run-local-tests:
  variables: &run-local-tests-variables
    TEST_BROWSER: chrome

.run-remote-tests:
  variables: &run-remote-tests-variables
    TEST_REMOTE_HOST: selenium-hub

.run-unit-tests:
  extends: .run-pre-build-tests
  after_script:
    - coverage=$(grep '^All files.*' test.out | cut -d '|' -f 2 | tr -d ' ')
    - echo "Coverage - ${coverage}%"
    - rm test.out

run-local-unit-tests:
  extends: .run-unit-tests
  variables:
    <<: *run-local-tests-variables
  script:
    - grunt test-unit-local --headless --browser=${TEST_BROWSER} | tee test.out

.run-remote-unit-tests:
  extends: .run-unit-tests
  variables:
    <<: *run-remote-tests-variables
  script:
    - >
      grunt test-unit-remote --headless --browser=${TEST_BROWSER} --ownServerHost="${TEST_OWN_SERVER_HOST}"
      --remoteHost=${TEST_REMOTE_HOST} | tee test.out

run-remote-unit-tests-chrome:
  extends: .run-remote-unit-tests
  variables:
    TEST_BROWSER: chrome

run-remote-unit-tests-firefox:
  extends: .run-remote-unit-tests
  variables:
    TEST_BROWSER: firefox

.run-functional-tests:
  artifacts: &run-functional-tests-artifacts
    name: ${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}
    expire_in: 1 month
    when: always
    paths:
      - 'test_reports/test-functional*'

run-local-modules-functional-tests:
  extends: .run-pre-build-tests
  variables:
    <<: *run-local-tests-variables
  script:
    - grunt buildStyles
    - npm start &
    - >
      grunt test-functional-local --functionalSuites=tests/functional/modules/**/!\(*Script\).js --headless
      --browser=${TEST_BROWSER}
  artifacts: &run-functional-tests-artifacts

.run-remote-modules-functional-tests:
  extends: .run-pre-build-tests
  variables:
    <<: *run-remote-tests-variables
  script:
    - grunt buildStyles
    - npm start &
    - >
      grunt test-functional-remote --functionalSuites=tests/functional/modules/**/!\(*Script\).js --headless
      --browser=${TEST_BROWSER} --ownServerHost="${TEST_OWN_SERVER_HOST}" --remoteHost=${TEST_REMOTE_HOST}
  artifacts: &run-functional-tests-artifacts

run-remote-modules-functional-tests-chrome:
  extends: .run-remote-modules-functional-tests
  variables:
    TEST_BROWSER: chrome

run-remote-modules-functional-tests-firefox:
  extends: .run-remote-modules-functional-tests
  variables:
    TEST_BROWSER: firefox

run-scheduled-remote-functional-tests:
  extends: .run-tests
  stage: test-deploy
  variables:
    <<: *run-remote-tests-variables
    SERVER_URL: https://${DEV_PUBLIC_HOSTNAME}
    TEST_BROWSER: chrome
    TEST_ROLE: administrator
  script:
    - >
      grunt test-functional-remote --serverUrl="${SERVER_URL}" --user="${REDMIC_TEST_USER}" --pass="${REDMIC_TEST_PASS}"
      --role=${TEST_ROLE} --suitesGroups="${SUITES_GROUPS}" --browser=${TEST_BROWSER} --remoteHost=${TEST_REMOTE_HOST}
  dependencies: []
  artifacts: &run-functional-tests-artifacts
  rules:
    - if: $CI_PIPELINE_SOURCE == "schedule"
+2 −173
Original line number Diff line number Diff line
@@ -11,6 +11,8 @@ include:
  - project: 'redmic-project/gitlab-ci-templates'
    ref: master
    file: '/deployment-custom-image.yml'
  - local: '/.gitlab-ci.build.yml'
  - local: '/.gitlab-ci.test.yml'

stages:
  - pre-build
@@ -22,181 +24,8 @@ stages:
  - deploy
  - test-deploy

.web-build:
  image: ${WEB_BUILD_IMAGE_NAME}:${WEB_BUILD_IMAGE_TAG}
  variables:
    GIT_SUBMODULE_STRATEGY: normal
    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/
      - public/javascript/redmic-widgets/node_modules/
      - public/javascript/templates/node_modules/
      - public/stylesheets/node_modules/

.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
  script: ':'
  artifacts:
    name: ${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}
    expire_in: 1 week
    paths:
      - node_modules/
      - public/javascript/proj4js/dist/proj4.js
      - public/javascript/redmic-widgets/src/app/
      - public/javascript/templates/dist/
      - public/stylesheets/style.styl
      - public/stylesheets/src/
      - public/stylesheets/submodules/
  rules: *only-non-master-branches-job-rules

.run-tests:
  extends: .web-build
  tags:
    - custom-runner
  cache:
    policy: pull

.run-pre-build-tests:
  extends: .run-tests
  stage: pre-build
  rules: *only-non-master-branches-job-rules
  allow_failure: true

.run-local-tests:
  variables: &run-local-tests-variables
    TEST_BROWSER: chrome

.run-remote-tests:
  variables: &run-remote-tests-variables
    TEST_REMOTE_HOST: selenium-hub

.run-unit-tests:
  extends: .run-pre-build-tests
  after_script:
    - coverage=$(grep '^All files.*' test.out | cut -d '|' -f 2 | tr -d ' ')
    - echo "Coverage - ${coverage}%"
    - rm test.out

run-local-unit-tests:
  extends: .run-unit-tests
  variables:
    <<: *run-local-tests-variables
  script:
    - grunt test-unit-local --headless --browser=${TEST_BROWSER} | tee test.out

.run-remote-unit-tests:
  extends: .run-unit-tests
  variables:
    <<: *run-remote-tests-variables
  script:
    - >
      grunt test-unit-remote --headless --browser=${TEST_BROWSER} --ownServerHost="${TEST_OWN_SERVER_HOST}"
      --remoteHost=${TEST_REMOTE_HOST} | tee test.out

run-remote-unit-tests-chrome:
  extends: .run-remote-unit-tests
  variables:
    TEST_BROWSER: chrome

run-remote-unit-tests-firefox:
  extends: .run-remote-unit-tests
  variables:
    TEST_BROWSER: firefox

.run-functional-tests:
  artifacts: &run-functional-tests-artifacts
    name: ${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}
    expire_in: 1 month
    when: always
    paths:
      - 'test_reports/test-functional*'

run-local-modules-functional-tests:
  extends: .run-pre-build-tests
  variables:
    <<: *run-local-tests-variables
  script:
    - grunt buildStyles
    - npm start &
    - >
      grunt test-functional-local --functionalSuites=tests/functional/modules/**/!\(*Script\).js --headless
      --browser=${TEST_BROWSER}
  artifacts: &run-functional-tests-artifacts

.run-remote-modules-functional-tests:
  extends: .run-pre-build-tests
  variables:
    <<: *run-remote-tests-variables
  script:
    - grunt buildStyles
    - npm start &
    - >
      grunt test-functional-remote --functionalSuites=tests/functional/modules/**/!\(*Script\).js --headless
      --browser=${TEST_BROWSER} --ownServerHost="${TEST_OWN_SERVER_HOST}" --remoteHost=${TEST_REMOTE_HOST}
  artifacts: &run-functional-tests-artifacts

run-remote-modules-functional-tests-chrome:
  extends: .run-remote-modules-functional-tests
  variables:
    TEST_BROWSER: chrome

run-remote-modules-functional-tests-firefox:
  extends: .run-remote-modules-functional-tests
  variables:
    TEST_BROWSER: firefox

prepare-built-version:
  extends: .web-build
  stage: build
  script:
    - grunt
  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_PIPELINE_SOURCE == "schedule"
      when: never
    - if: $CI_COMMIT_BRANCH || $CI_COMMIT_TAG

.deploy:
  variables:
    STACK: client
  environment:
    url: https://${PUBLIC_HOSTNAME}

run-scheduled-remote-functional-tests:
  extends: .run-tests
  stage: test-deploy
  variables:
    <<: *run-remote-tests-variables
    SERVER_URL: https://${DEV_PUBLIC_HOSTNAME}
    TEST_BROWSER: chrome
    TEST_ROLE: administrator
  script:
    - >
      grunt test-functional-remote --serverUrl="${SERVER_URL}" --user="${REDMIC_TEST_USER}" --pass="${REDMIC_TEST_PASS}"
      --role=${TEST_ROLE} --suitesGroups="${SUITES_GROUPS}" --browser=${TEST_BROWSER} --remoteHost=${TEST_REMOTE_HOST}
  dependencies: []
  artifacts: &run-functional-tests-artifacts
  rules:
    - if: $CI_PIPELINE_SOURCE == "schedule"