2021-06-30 00:36:27 +00:00
|
|
|
test:
|
2021-07-19 06:23:38 +00:00
|
|
|
image: ${CI_REGISTRY}/leenooks/php:8.0-fpm-ext-test
|
2021-06-30 00:36:27 +00:00
|
|
|
|
|
|
|
stage: test
|
|
|
|
|
|
|
|
# NOTE: This service is dependant on project file configuration, which is not there if the cache was deleted
|
|
|
|
# resulting in the testing to fail on the first run.
|
|
|
|
services:
|
|
|
|
- mariadb:10.5
|
|
|
|
|
|
|
|
variables:
|
|
|
|
MYSQL_DATABASE: testing
|
|
|
|
MYSQL_ROOT_PASSWORD: test
|
|
|
|
MYSQL_USER: test
|
|
|
|
MYSQL_PASSWORD: test
|
|
|
|
|
|
|
|
tags:
|
|
|
|
- php
|
|
|
|
only:
|
|
|
|
- master
|
|
|
|
- test
|
|
|
|
|
|
|
|
before_script:
|
|
|
|
- mv .env.testing .env
|
|
|
|
|
|
|
|
# Install Composer and project dependencies.
|
2021-07-09 03:19:21 +00:00
|
|
|
- mkdir -p /root/.config/composer
|
|
|
|
- if [ -n "$GITHUB_TOKEN" ]; then cat $GITHUB_TOKEN |base64 -d > /root/.config/composer/auth.json ; fi
|
2021-06-30 00:36:27 +00:00
|
|
|
- composer install
|
|
|
|
|
2021-07-13 03:19:14 +00:00
|
|
|
# Add mysql client for schema pre-load
|
|
|
|
- apt update && apt install -f mariadb-client
|
|
|
|
|
2021-06-30 00:36:27 +00:00
|
|
|
# Generate an application key. Re-cache.
|
|
|
|
- php artisan key:generate --env=testing
|
|
|
|
- php artisan config:cache --env=testing
|
|
|
|
- php artisan migrate
|
|
|
|
- php artisan db:seed
|
|
|
|
|
|
|
|
script:
|
|
|
|
# run laravel tests
|
|
|
|
- XDEBUG_MODE=coverage php vendor/bin/phpunit --coverage-text --colors=never
|
|
|
|
|
|
|
|
# run frontend tests
|
|
|
|
# if you have any task for testing frontend
|
|
|
|
# set it in your package.json script
|
|
|
|
# comment this out if you don't have a frontend test
|
|
|
|
# npm test
|