-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
131 lines (116 loc) · 3.57 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
# Copyright 2022-2024 Roman Ondráček
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
image: $CI_REGISTRY_IMAGE:testing
stages:
- build-docker-testing
- test
- coding-style
- deploy
.base_template: &base_template
tags:
- linux
- amd64
.coding-style_template: &coding-style_template
stage: coding-style
needs: [build-docker-testing]
<<: *base_template
.test_template: &test_template
stage: test
needs: [build-docker-testing]
<<: *base_template
.composer_template: &composer_template
before_script:
- cp app/config/local.example.neon app/config/local.neon
- composer install --no-progress
cache:
paths:
- temp/composer/cache
variables:
COMPOSER_CACHE_DIR: temp/composer/cache
build-docker-testing:
stage: build-docker-testing
image: docker:latest
services:
- docker:dind
before_script: []
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build -f docker/testing/Dockerfile -t $CI_REGISTRY_IMAGE:testing docker/testing/
- docker push $CI_REGISTRY_IMAGE:testing
only:
refs:
- master
before_script:
- cp app/config/local.example.neon app/config/local.neon
- composer install
test:
before_script:
- !reference [.composer_template, before_script]
- update-alternatives --set php /usr/bin/php${PHP_VERSION}
script:
- vendor/bin/tester -p phpdbg${PHP_VERSION} -c ./tests/php.ini -s ./tests
after_script:
- 'for i in $(find ./tests -name \*.actual); do echo "--- $i"; cat $i; echo; echo; done'
parallel:
matrix:
- PHP_VERSION:
- '8.3'
<<: *test_template
<<: *composer_template
coverage:
before_script:
- update-alternatives --set php /usr/bin/php8.3
- !reference [.composer_template, before_script]
- vendor/bin/tester -c ./tests/php-coverage.ini --info
script:
- vendor/bin/tester -c ./tests/php-coverage.ini -o none -o junit:junit.xml --coverage ./coverage.html --coverage-src ./app ./tests
allow_failure: true
after_script:
- 'for i in $(find ./tests -name \*.actual); do echo "--- $i"; cat $i; echo; echo; done'
coverage: '/^\d+% covered/'
artifacts:
paths:
- 'coverage.html'
expire_in: 2 weeks
reports:
junit:
- junit.xml
<<: *test_template
<<: *composer_template
code-checker:
script:
- composer create-project nette/code-checker temp/code-checker --no-interaction
- php temp/code-checker/code-checker -l --no-progress --strict-types -i "coverage.*" -i "tests/temp/"
<<: *coding-style_template
<<: *composer_template
phpstan:
script:
- NETTE_TESTER_RUNNER=1 php vendor/bin/phpstan analyse -c phpstan.neon
<<: *coding-style_template
<<: *composer_template
codesniffer:
script:
- vendor/bin/codesniffer --runtime-set php_version 80300 app bin db tests
<<: *coding-style_template
<<: *composer_template
doctrine_mapping:
script:
- bin/manager orm:validate-schema --skip-sync
<<: *coding-style_template
<<: *composer_template
latte_lint:
script:
- vendor/bin/latte-lint app --strict
<<: *coding-style_template
<<: *composer_template