-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
108 lines (100 loc) · 2.86 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
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
#
# Copyright (c) 2016 - 2024 Itspire.
# This software is licensed under the BSD-3-Clause license. (see LICENSE.md for full license)
# All Right Reserved.
#
variables:
PHP_IMAGE: $CI_REGISTRY/devops/docker-webservers/php-fpm-dev:5.0.1
COMPOSER_IMAGE: $CI_REGISTRY/itspire-devops/webservers/composer-ci:4.0.0
default:
cache:
key: $CI_COMMIT_REF_NAME
paths:
- build
- vendor
tags:
- docker-build
stages:
- prepare
- deps
- analyse
- test
- artifacts
prepare:
stage: prepare
script:
- mkdir -p build/coverage build/logs
- rm -rf build/logs/*
- rm -rf build/coverage/*
deps:
stage: deps
before_script:
- echo $CI_REGISTRY_PASSWORD | docker login -u $CI_REGISTRY_USER $CI_REGISTRY --password-stdin
script:
- >
docker run \
--rm \
-v $(pwd):/project \
-w /project \
-e DEV_UID=$(id -u) \
-e DEV_GID=$(id -g) \
$COMPOSER_IMAGE install --prefer-dist
after_script:
- docker logout $CI_REGISTRY
phplint:
stage: analyse
before_script:
- echo $CI_REGISTRY_PASSWORD | docker login -u $CI_REGISTRY_USER $CI_REGISTRY --password-stdin
script:
- >
docker run \
--rm \
-v $(pwd):/project \
-w /project \
-e DEV_UID=$(id -u) \
-e DEV_GID=$(id -g) \
$PHP_IMAGE -l src/main/php src/test/php
after_script:
- docker logout $CI_REGISTRY
phpcs:
stage: analyse
before_script:
- echo $CI_REGISTRY_PASSWORD | docker login -u $CI_REGISTRY_USER $CI_REGISTRY --password-stdin
script:
- >
docker run \
--rm \
-v $(pwd):/project \
-w /project \
-e DEV_UID=$(id -u) \
-e DEV_GID=$(id -g) \
$PHP_IMAGE vendor/bin/phpcs \
--report=full \
--standard=PSR12 \
--extensions=php \
--ignore=bootstrap.php \
src/main/php src/test/php
after_script:
- docker logout $CI_REGISTRY
test:
stage: test
before_script:
- echo $CI_REGISTRY_PASSWORD | docker login -u $CI_REGISTRY_USER $CI_REGISTRY --password-stdin
script:
- >
docker run \
--rm \
-v $(pwd):/project \
-w /project \
-e DEV_UID=$(id -u) \
-e DEV_GID=$(id -g) \
$PHP_IMAGE vendor/bin/phpunit --configuration /project/phpunit.xml
after_script:
- docker logout $CI_REGISTRY
artifacts:
stage: artifacts
script:
- echo "Generating Artifact..."
artifacts:
paths:
- build