-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
160 lines (147 loc) · 3.85 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
# set the default docker image
image: registry.gitlab.com/tjvb/phpimages:php81
stages:
- prepare # prepare the cache
- check # check the codestyles
- test
default:
interruptible: true
prepare_cache:
stage: prepare
script:
# Install composer
- composer validate
- composer install
# we use this artifact for all the jobs
artifacts:
name: "vendor"
paths:
- vendor/*
lint:
stage: check
script:
# lint recursive
- find src/ -type f -name '*.php' -exec php -l {} \; | (! grep -v "No syntax errors detected" )
dependencies: []
needs: []
phpstan:
stage: check
script:
# check for phpstan errors
- php -d memory_limit=500M vendor/bin/phpstan analyse --error-format=gitlab > 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
dependencies:
- prepare_cache
needs:
- prepare_cache
code-style:
stage: check
script:
- composer cs
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:
stage: test
interruptible: true
script:
- composer install
- vendor/bin/phpunit --migrate-configuration
- vendor/bin/infection
artifacts:
name: "Infection result ${CI_PROJECT_NAME}_${CI_PIPELINE_ID}"
when: always
paths:
- build/infection/infection-summary.log
- build/infection/infection-per-mutator.md
- build/infection/infection.log
- build/infection/infection-log-gitlab.json
- build/infection/infection-log.json
- build/infection/infection-log.html
reports:
codequality:
- build/infection/infection-log-gitlab.json
expire_in: 1 day
expose_as: Infection log
dependencies:
- prepare_cache
needs:
- prepare_cache
# this is a template that we reuse for the different test jobs
.test_base:
stage: test
coverage: '/^\s*Lines:\s*\d+.\d+\%/'
artifacts:
reports:
junit: phpunitresult/junit.xml
coverage_report:
coverage_format: cobertura
path: phpunitresult/cobertura-coverage.xml
dependencies:
- prepare_cache
needs:
- prepare_cache
test_lowest:
extends: .test_base
image: registry.gitlab.com/tjvb/phpimages:php81
script:
# Install composer
- rm -f composer.lock
- 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
test:
extends: .test_base
parallel:
matrix:
- LARAVEL: 9
TESTBENCH: 7
PHP:
- 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
script:
- echo "Laravel $LARAVEL"
- echo "PHP $PHP"
- echo "TESTBENCH $TESTBENCH"
- composer require --dev "orchestra/testbench=^$TESTBENCH"
- 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