-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
82 lines (74 loc) · 1.59 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:
- tests
- build
- badges
include:
- template: Composer.gitlab-ci.yml
.template-qa-step:
stage: tests
image: composer:latest
timeout: 5m
variables:
QA_TOOL: ${CI_JOB_NAME}
STATUS: 0
before_script:
- composer install -o --ignore-platform-reqs
- echo "QA_TOOL_STATUS=failed" > ${QA_TOOL}.env
after_script:
- if [[ -f SUCCESS ]]; then echo "QA_TOOL_STATUS=success" > ${QA_TOOL}.env; fi
artifacts:
reports:
dotenv: ${QA_TOOL}.env
when: always
expire_in: 1 day
phpstan:
extends: .template-qa-step
script:
- vendor/bin/codecept build --quiet
- composer phpstan
- touch SUCCESS
code-sniffer:
extends: .template-qa-step
script:
- vendor/bin/codecept build --quiet
- composer cs-check
- touch SUCCESS
tests:
stage: tests
image: docker/compose:latest
services:
- docker:dind
script:
- docker-compose up composer
- docker-compose up --detach php db
- docker-compose exec -T php composer tests
- docker-compose down
.template-create-badge:
stage: badges
image: python:3-alpine
variables:
COLOR: green
before_script:
- pip install anybadge
script:
- anybadge -l ${QA_TOOL} -v ${QA_TOOL_STATUS} -c ${COLOR} -f ${QA_TOOL}.svg
artifacts:
paths:
- ${QA_TOOL}.svg
when: always
expire_in: 4 weeks
when: always
only:
- main
badge_phpstan:
extends: .template-create-badge
variables:
QA_TOOL: phpstan
dependencies:
- phpstan
badge_codesniffer:
extends: .template-create-badge
variables:
QA_TOOL: code-sniffer
dependencies:
- code-sniffer