-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
82 lines (74 loc) · 2.32 KB
/
.gitlab-ci.yml
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
stages:
- image:build
- image:push
- tests
- statistics
variables:
PHP_IMAGE: ${DOCKER_REGISTRY_INTERNAL}/${CI_PROJECT_PATH_SLUG}/php-cli:${CI_COMMIT_SHA}
PHP_IMAGE_EXTERNAL: ${DOCKER_REGISTRY_EXTERNAL}/${CI_PROJECT_PATH_SLUG}/php-cli:${CI_COMMIT_SHA}
PHP_IMAGE_DEV: ${DOCKER_REGISTRY_INTERNAL}/${CI_PROJECT_PATH_SLUG}/php-cli-dev:${CI_COMMIT_SHA}
PHP_IMAGE_CACHE: ${DOCKER_REGISTRY_INTERNAL}/${CI_PROJECT_PATH_SLUG}/php:cache
PHP_IMAGE_REMOTE: ${CONTAINER_IMG_REGISTRY_RELEASE}/txb-workflow/php-cli:${CI_COMMIT_TAG}
buildkit php cli:
stage: image:build
image: ${BUILDKIT_IMAGE}
timeout: 5m
script:
- ${BUILDKIT_SCRIPT}
--tag=${PHP_IMAGE}
--cache-repo=${PHP_IMAGE_CACHE}
--context=.
--file=./images/php/pipeline/Dockerfile
--target=php-cli
buildkit php cli dev:
stage: image:build
image: ${BUILDKIT_IMAGE}
timeout: 5m
script:
- ${BUILDKIT_SCRIPT}
--tag=${PHP_IMAGE_DEV}
--cache-repo=${PHP_IMAGE_CACHE}
--context=.
--file=./images/php/pipeline/Dockerfile
--target=php-cli-dev
unit tests:
stage: tests
image: ${PHP_IMAGE_DEV}
timeout: 5m
script:
- cd /var/www
- vendor/bin/phpunit --colors=never -c tests/phpunit.xml --coverage-text --log-junit build/phpunit.xml
artifacts:
reports:
junit: build/phpunit.xml
phpstan:
stage: tests
image: ${PHP_IMAGE_DEV}
timeout: 5m
script:
- /var/www/vendor/bin/phpstan analyse ./src ./tests -l 8
code sniffer:
stage: tests
image: ${PHP_IMAGE_DEV}
timeout: 5m
script:
- /var/www/vendor/bin/phpcs src/ tests/ --standard=./config/codesniffer_ruleset.xml
push php image:
stage: image:push
image: ${SKOPEO_IMAGE}
timeout: 5m
only:
- /release/
script:
- skopeo login --username ${DOCKER_REGISTRY_USERNAME} --password ${DOCKER_REGISTRY_PASSWORD} ${DOCKER_REGISTRY_EXTERNAL}
- skopeo login --username ${CONTAINER_IMG_REGISTRY_RELEASE_USERNAME} --password ${CONTAINER_IMG_REGISTRY_RELEASE_PASSWORD} ${CONTAINER_IMG_REGISTRY_RELEASE}
- skopeo copy docker://${PHP_IMAGE_EXTERNAL} docker://${PHP_IMAGE_REMOTE}
statistics:
stage: statistics
image: ${PHP_IMAGE}
timeout: 5m
only:
- main
script:
- cp -av /var/www/vendor ./vendor
- bin/workflow workflow:deployment:statistics:update