-
Notifications
You must be signed in to change notification settings - Fork 2
/
.gitlab-ci.yml
81 lines (74 loc) · 2.19 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
stages:
- test
- report
- report-upload
cache:
key: composer-cache
paths:
- .composer-cache/
.test:
before_script:
# display PHP version
- php -v
# install system packages
- apt-get update && apt-get install -y git unzip libgmp-dev
# install extensions
- docker-php-ext-install gmp bcmath
- if [ "$INSTALL_XDEBUG" -eq 1 ]; then pecl install xdebug; docker-php-ext-enable xdebug; fi
# install composer
- php -r "copy('https://composer.github.io/installer.sig', '/tmp/composer.sig');"
- php -r "copy('https://getcomposer.org/installer', '/tmp/composer-setup.php');"
- php -r '$expected = file_get_contents("/tmp/composer.sig"); $actual = hash_file("sha384", "/tmp/composer-setup.php"); exit(intval(!hash_equals($expected, $actual)));'
- php /tmp/composer-setup.php --install-dir=/usr/local/bin --filename=composer
- chmod +x /usr/local/bin/composer
- rm /tmp/composer-setup.php /tmp/composer.sig
# cache dependencies
- composer config -g cache-dir "$(pwd)/.composer-cache"
script:
- composer update
- vendor/bin/phpunit --fail-on-deprecation --fail-on-notice --fail-on-warning
# coverage
coverage:
variables:
INSTALL_XDEBUG: 1
extends: .test
stage: report
only:
- master
image: php:8.1 # todo: php:8.4
artifacts:
paths:
- reports
expire_in: 1h
script:
- composer update
- XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-clover reports/coverage.xml --log-junit reports/junit.xml
coverage-upload:
stage: report-upload
image: python:3.12
only:
- master
before_script:
- pip install codecov-cli
script:
- codecovcli do-upload --report-type test_results --file reports/junit.xml --token $CODECOV_TOKEN
- codecovcli upload-process --file reports/coverage.xml --token $CODECOV_TOKEN
# lowest version
test-8.1:
extends: .test
stage: test
image: php:8.1
# lowest bcmath
test-8.4:
extends: .test
stage: test
image: php:8.4-rc
script:
- composer config platform.php '8.3.99' # fake version for now
- composer update
- vendor/bin/phpunit --fail-on-deprecation --fail-on-notice --fail-on-warning
# latest PHP 8
test-8:
extends: .test
stage: test
image: php:8