-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
174 lines (161 loc) · 3.95 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
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
cache:
key: "${CI_PROJECT_NAME}_${CI_COMMIT_REF_NAME}"
paths:
- ~/.composer # cache the composer directory
# set the default docker image
image: registry.gitlab.com/tjvb/phpimages:php80
stages:
- prepare
- check
- test
- report
prepare_cache:
stage: prepare
script:
- composer validate
- composer install
cache:
key: "${CI_PROJECT_NAME}"
# we use the with this job to create an artifact with the composer parts and use the cache to speed it up
policy: pull-push
paths:
- vendor/
# we use this artifact for all the jobs
artifacts:
name: "vendor"
paths:
- vendor/*
expire_in: 2 hour
lint:
stage: check
script:
# lint recursive
- find src/ -type f -name '*.php' -exec php -l {} \; | (! grep -v "No syntax errors detected" )
dependencies: []
phpstan:
stage: check
script:
# check for phpstan errors
- php -d memory_limit=500M vendor/bin/phpstan analyse --error-format=gitlab | tee phpstan.json
- cat phpstan.json
dependencies:
- prepare_cache
needs:
- prepare_cache
artifacts:
paths:
- phpstan.json
reports:
codequality: phpstan.json
when: always
phpmd:
stage: check
script:
- composer phpmd
needs:
- prepare_cache
dependencies:
- prepare_cache
code-style:
stage: check
script:
- vendor/bin/ecs
dependencies:
- prepare_cache
needs:
- prepare_cache
# We check the content with vale
vale:
image:
name: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/jdkato/vale
entrypoint: [""]
stage: check
script:
- /bin/vale --config=tools/vale/.vale.ini README.md CONTRIBUTING.md
needs: []
dependencies: []
infection:
image: registry.gitlab.com/tjvb/phpimages:php83
stage: test
script:
- composer install
- vendor/bin/phpunit --migrate-configuration
- vendor/bin/infection
dependencies:
- prepare_cache
needs:
- prepare_cache
artifacts:
paths:
- build/infection/
reports:
codequality: build/infection/code-climate-gitlab.json
when: always
test_lowest:
parallel:
image: registry.gitlab.com/tjvb/phpimages:php80
stage: test
script:
- composer update --prefer-lowest
- vendor/bin/phpunit --coverage-text --colors=never --coverage-cobertura=phpunitresult/cobertura-coverage.xml --log-junit=phpunitresult/junit.xml
- sed -i 's~ filename="~ filename="src/~' phpunitresult/cobertura-coverage.xml
coverage: '/^\s*Lines:\s*\d+.\d+\%/'
artifacts:
reports:
junit: phpunitresult/junit.xml
coverage_report:
coverage_format: cobertura
path: phpunitresult/cobertura-coverage.xml
needs:
- prepare_cache
dependencies:
- prepare_cache
test:
parallel:
matrix:
- LARAVEL: 9
TESTBENCH: 7
PHP:
- 80
- 81
- 82
- 83
- LARAVEL: 10
TESTBENCH: 8
PHP:
- 81
- 82
- 83
- LARAVEL: 11
TESTBENCH: 9
PHP:
- 82
- 83
- 84
image: registry.gitlab.com/tjvb/phpimages:php$PHP
stage: test
script:
- echo "Laravel $LARAVEL"
- composer require --dev "orchestra/testbench=^$TESTBENCH"
- vendor/bin/phpunit --migrate-configuration || true
- XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-text --colors=never --coverage-cobertura=phpunitresult/cobertura-coverage.xml --log-junit=phpunitresult/junit.xml
- sed -i 's~ filename="~ filename="src/~' phpunitresult/cobertura-coverage.xml
coverage: '/^\s*Lines:\s*\d+.\d+\%/'
artifacts:
reports:
junit: phpunitresult/junit.xml
coverage_report:
coverage_format: cobertura
path: phpunitresult/cobertura-coverage.xml
needs:
- prepare_cache
dependencies:
- prepare_cache
mlc:
image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/becheran/mlc
stage: check
script:
# Run mlc to check for broken links: https://github.com/becheran/mlc
- mlc doc
needs: []
dependencies: []