about summary refs log tree commit diff stats
path: root/.gitlab-ci.yml
blob: b4f63152d805839e3ebd7748b57c222c9e0e9ed3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
variables:
  REGISTRY_PROJECT: cthulhoo
  IMAGE_TAR_DICT: image-dict.tar
  IMAGE_TAR_FPM: image-fpm.tar
  IMAGE_TAR_WEB: image-web.tar

stages:
  - lint
  - build
  - image
  - push
  - publish

include:
  - project: 'ci/ci-templates'
    ref: master
    file: .ci-build-docker-kaniko.yml
  - project: 'ci/ci-templates'
    ref: master
    file: .ci-registry-push.yml
  - project: 'ci/ci-templates'
    ref: master
    file: .ci-lint-common.yml
  - project: 'ci/ci-templates'
    ref: master
    file: .ci-update-helm-imagetag.yml
  - project: 'ci/ci-templates'
    ref: master
    file: .ci-build-npm.yml
  - project: 'ci/ci-templates'
    ref: master
    file: .ci-mr-review.yml

phpunit:
  extends: .phpunit
  variables:
    PHPUNIT_ARGS: --coverage-filter classes --coverage-filter include

phpunit:integration:
  extends: .phpunit
  variables:
    PHPUNIT_ARGS: --coverage-filter classes --coverage-filter include --do-not-cache-result
      --log-junit phpunit-report.xml --coverage-cobertura phpunit-coverage.xml --coverage-text --colors=never
  script:
    - chown -R user tests_integration
    - chmod +x tests_integration/pg_helper.sh tests_integration/run.sh
    - su user -c "./tests_integration/run.sh ${PHPUNIT_ARGS}" # can't run initdb as root

tsc:
  extends: .tsc
  after_script:
    - sh ./utils/show-codequality.sh

phpstan:
  extends: .phpstan

build:
  extends: .build
  artifacts:
    when: always
    paths:
      - dist/
      - worker.js

the-epube-dict:build:
  extends: .build-docker-kaniko-no-push
  variables:
    DOCKERFILE: ${CI_PROJECT_DIR}/.docker/dict/Dockerfile
    IMAGE_TAR: ${IMAGE_TAR_DICT}

the-epube-dict:push-master:
  extends: .crane-image-registry-push-master
  variables:
    IMAGE_TAR: ${IMAGE_TAR_DICT}
  needs:
    - job: the-epube-dict:build

the-epube-dict:push-master-gitlab:
  extends: .crane-image-registry-push-master-gitlab
  variables:
    IMAGE_TAR: ${IMAGE_TAR_DICT}
  needs:
    - job: the-epube-dict:build

the-epube-dict:push-master-docker-hub:
  extends: .crane-image-registry-push-master-docker-hub
  variables:
    IMAGE_TAR: ${IMAGE_TAR_DICT}
  needs:
    - job: the-epube-dict:build

the-epube-fpm-static:build:
  extends: .build-docker-kaniko-no-push
  variables:
    DOCKERFILE: ${CI_PROJECT_DIR}/.docker/app/Dockerfile
    IMAGE_TAR: ${IMAGE_TAR_FPM}

the-epube-fpm-static:push-master:
  extends: .crane-image-registry-push-master
  variables:
    IMAGE_TAR: ${IMAGE_TAR_FPM}
  needs:
    - job: the-epube-fpm-static:build

the-epube-fpm-static:push-master-gitlab:
  extends: .crane-image-registry-push-master-gitlab
  variables:
    IMAGE_TAR: ${IMAGE_TAR_FPM}
  needs:
    - job: the-epube-fpm-static:build

the-epube-fpm-static:push-master-docker-hub:
  extends: .crane-image-registry-push-master-docker-hub
  variables:
    IMAGE_TAR: ${IMAGE_TAR_FPM}
  needs:
    - job: the-epube-fpm-static:build

the-epube-web-nginx:build:
  extends: .build-docker-kaniko-no-push
  variables:
    DOCKERFILE: ${CI_PROJECT_DIR}/.docker/web-nginx/Dockerfile
    IMAGE_TAR: ${IMAGE_TAR_WEB}

the-epube-web-nginx:push-master:
  extends: .crane-image-registry-push-master
  variables:
    IMAGE_TAR: ${IMAGE_TAR_WEB}
  needs:
    - job: the-epube-web-nginx:build

the-epube-web-nginx:push-master-gitlab:
  extends: .crane-image-registry-push-master-gitlab
  variables:
    IMAGE_TAR: ${IMAGE_TAR_WEB}
  needs:
    - job: the-epube-web-nginx:build

the-epube-web-nginx:push-master-docker-hub:
  extends: .crane-image-registry-push-master-docker-hub
  variables:
    IMAGE_TAR: ${IMAGE_TAR_WEB}
  needs:
    - job: the-epube-web-nginx:build

update-demo:
  extends: .update-helm-imagetag
  variables:
    CHART_REPO: gitlab.fakecake.org/git/helm-charts/the-epube.git
    CHART_VALUES: values-demo.yaml
    ACCESS_TOKEN: ${DEMO_HELM_TOKEN}
  rules:
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $DEMO_HELM_TOKEN != null
  stage: publish

update-prod:
  extends: .update-helm-imagetag
  variables:
    CHART_REPO: gitlab.fakecake.org/git/helm-charts/the-epube-prod.git
    CHART_VALUES: values-prod.yaml
    ACCESS_TOKEN: ${PROD_HELM_TOKEN}
  rules:
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $PROD_HELM_TOKEN != null
  stage: publish

update-ru-prod:
  extends: .update-helm-imagetag
  variables:
    CHART_REPO: gitlab.fakecake.org/git/helm-charts/the-epube-prod.git
    CHART_VALUES: values-ru-prod.yaml
    ACCESS_TOKEN: ${PROD_HELM_TOKEN}
  needs:
    - job: update-prod
  rules:
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $PROD_HELM_TOKEN != null
  stage: publish