91 lines
2.1 KiB
YAML
91 lines
2.1 KiB
YAML
stages:
|
|
- test
|
|
- report
|
|
|
|
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
|
|
- 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
|
|
|
|
# coverage
|
|
coverage:
|
|
variables:
|
|
INSTALL_XDEBUG: 1
|
|
extends: .test
|
|
stage: report
|
|
only:
|
|
- master
|
|
- tags
|
|
image: php:8.1
|
|
script:
|
|
- composer update
|
|
- docker-php-ext-install gmp
|
|
- XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-clover coverage.xml
|
|
- bash <(curl -s https://codecov.io/bash)
|
|
|
|
# test in every version
|
|
test:
|
|
extends: .test
|
|
stage: test
|
|
image: ${ARCH}/php:${PHP_VERSION}
|
|
parallel:
|
|
matrix:
|
|
- PHP_VERSION:
|
|
- '7.1'
|
|
- '7.2'
|
|
- '7.3'
|
|
- '7.4'
|
|
- '8.0'
|
|
- '8.1'
|
|
ARCH:
|
|
- amd64
|
|
- i386
|
|
|
|
test-gmp:
|
|
extends: .test
|
|
stage: test
|
|
image: ${ARCH}/php:${PHP_VERSION}
|
|
parallel:
|
|
matrix:
|
|
- PHP_VERSION:
|
|
- '7.4'
|
|
- '8.0'
|
|
- '8.1'
|
|
ARCH:
|
|
- amd64
|
|
- i386
|
|
script:
|
|
- docker-php-ext-install gmp
|
|
- composer update
|
|
- vendor/bin/phpunit
|
|
|
|
# control that our tests are valid
|
|
test-8.2-control:
|
|
extends: .test
|
|
stage: test
|
|
image: php:8.2
|
|
script:
|
|
- composer update
|
|
- vendor/bin/phpunit
|