Skip to content

Instantly share code, notes, and snippets.

@n1c0l4stournier
Last active March 9, 2021 10:43
Show Gist options
  • Save n1c0l4stournier/d4290059a9c74cbf7f87b654447bf92c to your computer and use it in GitHub Desktop.
Save n1c0l4stournier/d4290059a9c74cbf7f87b654447bf92c to your computer and use it in GitHub Desktop.
Code quality testing with SonarQube and Gitlab CI for PHP applications - 05
phpunit:
stage: build
image:
name: php:8.0
before_script:
- apt-get update -yqq
- apt-get install git unzip -yqq
- php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
- php composer-setup.php --install-dir=/usr/bin --filename=composer --version=2.0.9
- php -r "unlink('composer-setup.php');"
- pecl install xdebug-3.0.0
- docker-php-ext-enable xdebug
variables:
XDEBUG_MODE: "coverage"
script:
- composer install
- |
./vendor/bin/phpunit \
--coverage-text \
--log-junit build/phpunit.xml \
--whitelist src \
--colors=never \
tests
cache:
key: "${CI_JOB_NAME}-build"
paths:
- vendor
artifacts:
reports:
junit: build/phpunit.xml
expire_in: 30 min
only:
- merge_requests
- master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment