2021-06-15 12:19:14 +00:00
|
|
|
test:
|
2022-10-29 06:39:57 +00:00
|
|
|
image: ${CI_REGISTRY}/leenooks/php:8.1-fpm-server-test
|
2021-06-15 12:19:14 +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:
|
2022-10-29 06:44:17 +00:00
|
|
|
- name: postgres:15-alpine
|
2021-11-20 00:56:20 +00:00
|
|
|
alias: postgres-test
|
2021-06-15 12:19:14 +00:00
|
|
|
|
|
|
|
variables:
|
2021-11-20 00:56:20 +00:00
|
|
|
POSTGRES_PASSWORD: password
|
2021-06-15 12:19:14 +00:00
|
|
|
|
|
|
|
tags:
|
|
|
|
- php
|
|
|
|
only:
|
|
|
|
- master
|
|
|
|
|
|
|
|
before_script:
|
|
|
|
- mv .env.testing .env
|
|
|
|
|
|
|
|
# Install Composer and project dependencies.
|
|
|
|
- mkdir -p /root/.composer
|
|
|
|
- if [ -n "$GITHUB_TOKEN" ]; then cat $GITHUB_TOKEN |base64 -d > /root/.composer/auth.json ; fi
|
|
|
|
- composer install
|
|
|
|
|
|
|
|
# Generate an application key. Re-cache.
|
|
|
|
- php artisan key:generate
|
|
|
|
- php artisan migrate
|
2021-07-16 06:55:26 +00:00
|
|
|
- php artisan db:seed
|
2021-06-15 12:19:14 +00:00
|
|
|
|
|
|
|
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
|