clrghouz/.gitlab-test.yml

47 lines
1.2 KiB
YAML

x86_64:test:
image: ${CI_REGISTRY}/leenooks/php:8.1-fpm-pgsql-server-test
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:
- name: postgres:15-alpine
alias: postgres-test
variables:
POSTGRES_USER: test
POSTGRES_PASSWORD: test
tags:
- php
- x86_64
only:
- master
before_script:
- mv .env.testing .env
# Install Composer and project dependencies.
- mkdir -p ${COMPOSER_HOME}
- if [ -n "$GITHUB_TOKEN" ]; then cat $GITHUB_TOKEN |base64 -d > ${COMPOSER_HOME}/auth.json; fi
- composer install
# Generate an application key. Re-cache.
- php artisan key:generate
- php artisan migrate
- php artisan db:seed
script:
# run laravel tests
- touch storage/app/test/*ZIP storage/app/test/file/*
- XDEBUG_MODE=coverage php vendor/bin/phpunit --coverage-text --colors=never
coverage: '/^\s*Lines:\s*\d+.\d+\%/'
# 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