-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
123 lines (110 loc) · 3.62 KB
/
Copy path.gitlab-ci.yml
File metadata and controls
123 lines (110 loc) · 3.62 KB
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
image: docker:18.09.7
variables:
CARTRIDGE_MODE: single
CLUSTER_COOKIE: password
DATA_PASSWORD: password
DOCKER_DRIVER: overlay2
DOCKER_HOST: tcp://localhost:2375
image_branch: $registry/$CI_PROJECT_NAME:$CI_BUILD_REF_NAME
image_latest: $registry/$CI_PROJECT_NAME:latest
image_master: $registry/$CI_PROJECT_NAME:master
image_pipeline: $registry/$CI_PROJECT_NAME:$CI_PIPELINE_ID
image_quay_latest: quay.io/basis-company/skeleton:latest
image_quay_tag: quay.io/basis-company/skeleton:$CI_COMMIT_TAG
image_tag: $registry/$CI_PROJECT_NAME:$CI_COMMIT_TAG
stages:
- build
- test
- release
build-image:
stage: build
retry: 2
services:
- name: docker:18.09.7-dind
command: ["--registry-mirror", "https://registry-proxy.nx.basis.services"]
script:
- cat $registrykey | docker login --username json_key --password-stdin cr.yandex
- docker pull $image_latest || true
- >
echo "<?php return ['tag'=>'$CI_COMMIT_TAG','sha'=>'$CI_COMMIT_SHA','short_sha'=>'$CI_COMMIT_SHORT_SHA','ref_name'=>'$CI_COMMIT_REF_NAME'];" > version.php
- docker build -f skeleton/Dockerfile --cache-from $image_latest -t $image_pipeline .
- docker push $image_pipeline
test-php:
stage: test
image: $image_pipeline
allow_failure: false
interruptible: true
except:
- tags
script:
- cd /var/www/html
- composer require phpunit/phpunit vimeo/psalm squizlabs/php_codesniffer
- curl -o phpcs.xml https://linter.basis.services/php
- vendor/bin/phpcs php --standard=phpcs.xml
- vendor/bin/psalm --init
- vendor/bin/psalm
test-phpunit:
stage: test
image: php:8.1-cli
allow_failure: true
interruptible: true
variables:
TARANTOOL_CONNECTION: tcp://test-coverage-db:3302
TARANTOOL_PORT: 3302
DATA_CONNECTION: tcp://admin:password@test-coverage-data:3301
XDEBUG_MODE: coverage
NATS_HOST: nats
services:
- name: nats
command: ['--js']
- name: tarantool/tarantool:2.6.2
alias: test-coverage-db
- name: cr.yandex/crpf255p88b3bourvm4f/data
alias: test-coverage-data
- name: yandex/clickhouse-server
alias: test-ch
except:
- tags
script:
- apt-get update && apt-get install zip git -y
- pecl install xdebug
- docker-php-ext-enable xdebug
- curl -sS https://getcomposer.org/installer | php && chmod +x composer.phar
- ./composer.phar require phpunit/phpunit
- export
- vendor/bin/phpunit --coverage-clover=coverage.xml --coverage-text --colors=never
release-branch:
stage: release
except:
- tags
services:
- name: docker:18.09.7-dind
command: ["--registry-mirror", "https://registry-proxy.nx.basis.services"]
script:
- export
- cat $registrykey | docker login --username json_key --password-stdin cr.yandex
- docker pull $image_pipeline
- docker tag $image_pipeline $image_branch
- docker push $image_branch
release-tag:
stage: release
only:
- tags
services:
- name: docker:18.09.7-dind
command: ["--registry-mirror", "https://registry-proxy.nx.basis.services"]
script:
- export
- cat $registrykey | docker login --username json_key --password-stdin cr.yandex
- docker pull $image_pipeline
- docker tag $image_pipeline $image_branch
- docker tag $image_pipeline $image_latest
- docker tag $image_pipeline $image_tag
- docker push $image_branch
- docker push $image_latest
- docker push $image_tag
- docker tag $image_pipeline $image_quay_tag
- docker tag $image_pipeline $image_quay_latest
- docker login -u="$quay_login" -p="$quay_password" quay.io
- docker push $image_quay_tag
- docker push $image_quay_latest