t3o-builds.yml 3.71 KB
Newer Older
1
2
3
variables:
  GIT_STRATEGY: "none"
  GIT_SSL_NO_VERIFY: "true"
4
  ADDITIONAL_TABLE_EXCLUDES: ""
5

6
7
8
cache:
  key: "$CI_COMMIT_REF_NAME-$CI_JOB_STAGE"
  paths:
9
10
    - vendor/
    - private/typo3conf/ext/t3olayout/Build/node_modules/
11

12
before_script:
13
  - apk add bash --no-cache
14
15

stages:
16
17
18
19
20
  - maintenance
  - test
  - build
  - layout
  - deploy
21

22
23
24
test:typoscript:
  stage: test
  image: composer:1
25
26
  variables:
    GIT_STRATEGY: "clone"
27
  before_script:
28
    - composer global require helmich/typo3-typoscript-lint --update-with-all-dependencies
29
30
31
  script:
    - /tmp/vendor/bin/typoscript-lint -c typoscript-lint.yml --fail-on-warnings

32
33
34
35
36
37
test:php:
  stage: test
  image: ekreative/php-cs-fixer:2
  variables:
    GIT_STRATEGY: "clone"
  script:
38
39
40
41
42
    - php-cs-fixer fix --dry-run --config=.gitlab-ci/build/.php_cs --diff

test:composer:
  stage: test
  image: composer:1
43
44
  variables:
    GIT_STRATEGY: "clone"
45
46
47
48
  before_script:
    - composer global require sensiolabs/security-checker
  script:
    - /tmp/vendor/bin/security-checker security:check
49
50
51

build:
  stage: build
52
  image: composer:1
53
54
55
56
  variables:
    GIT_STRATEGY: "clone"
    GIT_SUBMODULE_STRATEGY: "recursive"
  before_script:
57
58
59
60
61
    - apk add bash --no-cache
    - apk add git --update
    - export COMPOSER_CACHE_DIR=/cache/composer
    - composer config store-auths false
    - composer config http-basic.git-t3o.typo3.org gitlab-ci-token ${CI_BUILD_TOKEN}
62
  script:
63
64
65
    - composer config store-auths false
    - composer config http-basic.git-t3o.typo3.org gitlab-ci-token ${CI_BUILD_TOKEN}
    - composer install --no-dev --ignore-platform-reqs
66
67
  artifacts:
    paths:
68
      - ./
69
70
71
72
73
    expire_in: '1h'


layout:
  stage: layout
74
  image: node:12
75
  before_script:
76
    - cd private/typo3conf/ext/t3olayout/Build
77
  script:
78
79
    - npm install
    - npm run build
80
  after_script:
81
    - rm -Rf private/typo3conf/ext/t3olayout/Build/node_modules
82
83
  artifacts:
    paths:
84
      - ./
85
    expire_in: '4h'
86
  dependencies:
87
    - build
88
89
90

.deploy-template: &deploy_template
  stage: deploy
91
  image: composer:1
92
  before_script:
93
94
95
96
97
98
99
100
101
102
    - apk add rsync --update
    - mkdir -p /root/.ssh/
    - eval $(ssh-agent -s)
    - echo "$SSH_PRIVATE_KEY_STAGE" | ssh-add -
    - echo "$SSH_PRIVATE_KEY_PRODUCTION" | ssh-add -
    - ssh-keyscan ${STAGE_HOST} >> /root/.ssh/known_hosts
    - ssh-keyscan ${PRODUCTION_HOST} >> /root/.ssh/known_hosts
    - composer config cache-dir /cache/composer
    - composer global require deployer/deployer:6.6.0 --update-with-dependencies
    - composer global require deployer/recipes
103
  script:
104
    - /tmp/vendor/bin/dep --file=./.gitlab-ci/deployer/deploy.php deploy -vv ${CI_BUILD_REF_NAME}
105
  dependencies:
106
    - layout
107
108
109
110
111
112
113

deploy-master:
  <<: *deploy_template
  environment:
    name: master
    url: https://${PRODUCTION_HOST}
  only:
114
    - master
115
116
117
118
119
120
121

deploy-develop:
  <<: *deploy_template
  environment:
    name: develop
    url: https://${STAGE_HOST}
  only:
122
    - develop
123

124
.maintenance: &maintenance_template
125
  variables:
126
127
128
129
130
131
    GIT_STRATEGY: none
  stage: maintenance
  when: manual
  image:
    name: composer:1
    entrypoint: ["/bin/sh", "-c"]
132
  before_script:
133
134
135
136
137
138
139
140
141
142
143
    - apk add rsync --update
    - mkdir -p /root/.ssh/
    - eval $(ssh-agent -s)
    - mkdir -p ~/.ssh
    - echo "$SSH_PRIVATE_KEY_STAGE" | ssh-add -
    - ssh-keyscan ${STAGE_HOST} >> /root/.ssh/known_hosts

Get dump for local environment:
  <<: *maintenance_template
  script:
    - mkdir dump
144
    - ssh ${STAGE_USER}@${STAGE_HOST} "php ./ci/current/vendor/bin/typo3cms database:export -c Default -e 'cf_*' -e 'cache_*' -e '[bf]e_sessions' -e '[bf]e_users' -e 'sys_log' -e 'sys_history' -e 'sys_registry' -e 'tx_solr_*' -e 'tx_igldapssoauth_config' ${ADDITIONAL_TABLE_EXCLUDES} | gzip -9 -c" > ./dump/dump.sql.gz
145
146
  artifacts:
    paths:
147
148
      - ./dump/
    expire_in: 1d