.gitlab-ci.yml 2.99 KB
Newer Older
1 2
include:
  - project: 't3o/t3olayout'
3
    ref: 4.1.5
4 5
    file: '/Configuration/GitLab/t3o-builds.yml'

6
stages:
7
  - maintenance
8 9 10 11 12
  - dump
  - test
  - build
  - layout
  - deploy
Thomas Löffler's avatar
Thomas Löffler committed
13

14
variables:
15 16
  GIT_STRATEGY: "none"
  GIT_SSL_NO_VERIFY: "true"
17
  STAGE_HOST: "extensions.typo3.dev"
18
  PRODUCTION_PORT: 22201
19
  PRODUCTION_HOST: "extensions.typo3.org"
20
  STAGE_USER: "extensions-stage"
21
  DUMP_EXCLUDE_TABLES_LIST: "be_groups,be_sessions,be_users,cf_cache_hash,cf_cache_hash_tags,cf_cache_imagesizes,cf_cache_imagesizes_tags,cf_cache_news_category,cf_cache_news_category_tags,cf_cache_pages,cf_cache_pages_tags,cf_cache_pagesection,cf_cache_pagesection_tags,cf_cache_rootline,cf_cache_rootline_tags,cf_extbase_datamapfactory_datamap,cf_extbase_datamapfactory_datamap_tags,cf_extbase_object,cf_extbase_object_tags,cf_extbase_reflection,cf_extbase_reflection_tags,cf_tx_solr,cf_tx_solr_configuration,cf_tx_solr_configuration_tags,cf_tx_solr_tags,fe_groups,fe_sessions,fe_users,sys_domain,sys_log,tx_solr_cache,tx_solr_cache_tags"
22
  PHP_EXECUTABLE: "PHP_INI_SCAN_DIR=:/etc/php72/user/${DUMP_USER}/:/home/${DUMP_USER}/cnf/ /opt/php/php72/bin/php"
23

24
test:unit:
25
  stage: test
26
  image: composer:1
27
  variables:
Thomas Löffler's avatar
Thomas Löffler committed
28 29
    GIT_STRATEGY: "clone"
    GIT_SUBMODULE_STRATEGY: "recursive"
30
  before_script:
Thomas Löffler's avatar
Thomas Löffler committed
31
    - apk add git --update
Thomas Löffler's avatar
Thomas Löffler committed
32
    - export TYPO3_PATH_WEB="$PWD/private"
33
    - composer config cache-dir /cache/composer
Thomas Löffler's avatar
Thomas Löffler committed
34
    - mkdir $TYPO3_PATH_WEB/fileadmin/ && touch $TYPO3_PATH_WEB/fileadmin/currentcoredata.json
35
  script:
36
    - composer install --ignore-platform-reqs
Thomas Löffler's avatar
Thomas Löffler committed
37
    - composer test:unit
38

39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
layout:
  stage: layout
  image: node:8
  before_script:
    - cd private/typo3conf/ext/t3olayout/Build
  script:
    - npm install
    - npm run build
  after_script:
    - rm -Rf private/typo3conf/ext/t3olayout/Build/node_modules
  artifacts:
    paths:
      - ./
    expire_in: '4h'
  dependencies:
    - build


57 58
.deploy-template: &deploy_template
  stage: deploy
Thomas Löffler's avatar
Thomas Löffler committed
59
  image: composer:1
60
  before_script:
61
    - apk add rsync --update
62 63 64 65
    - mkdir -p /root/.ssh/
    - eval $(ssh-agent -s)
    - echo "$SSH_PRIVATE_KEY_STAGE" | ssh-add -
    - echo "$SSH_PRIVATE_KEY_PRODUCTION" | ssh-add -
66
    - ssh-keyscan ${STAGE_HOST} >> /root/.ssh/known_hosts
67
    - ssh-keyscan -p ${PRODUCTION_PORT} ${PRODUCTION_HOST} >> /root/.ssh/known_hosts
Thomas Löffler's avatar
Thomas Löffler committed
68 69 70
    - composer config cache-dir /cache/composer
    - composer global require deployer/deployer
    - composer global require deployer/recipes
71
  script:
72
    - /tmp/vendor/bin/dep --file=./.gitlab-ci/deployer/deploy.php deploy ${CI_BUILD_REF_NAME}
73 74 75 76 77
  dependencies:
    - layout
  except:
    - assets

78 79 80 81 82 83 84 85 86 87 88
deploy-develop:
  <<: *deploy_template
  environment:
    name: develop
    url: https://${STAGE_HOST}
  script:
    - /tmp/vendor/bin/dep --file=./.gitlab-ci/deployer/deploy.php deploy develop
  only:
    - develop
    - task/new-server-2

89 90 91 92 93 94
deploy-master:
  <<: *deploy_template
  environment:
    name: master
    url: https://${PRODUCTION_HOST}
  script:
95
    - /tmp/vendor/bin/dep --file=./.gitlab-ci/deployer/deploy.php deploy master -vv
96 97 98
  only:
    - master