Skip to content

Instantly share code, notes, and snippets.

@Stetzon
Created Jan 11, 2021
Embed
What would you like to do?
Running phpunit tests and caching composer
image: php:7.3-fpm
definitions:
caches:
composer-custom: /composer/cache
services:
mysql:
image: mysql:8.0
environment:
MYSQL_DATABASE: 'homestead'
MYSQL_RANDOM_ROOT_PASSWORD: 'yes'
MYSQL_USER: 'homestead'
MYSQL_PASSWORD: 'secret'
steps:
- step: &install-composer-packages
name: Composer install
caches:
- composer-custom
script:
- apt-get update && apt-get install -qy git curl unzip
- curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
- composer install --no-progress --no-scripts
artifacts:
- vendor/**
.scripts:
- &setup-tests |
apt-get update && apt-get install -qy libmcrypt-dev default-mysql-client
yes | pecl install mcrypt-1.0.2
echo "memory_limit = 256M" > $PHP_INI_DIR/conf.d/php-memory-limits.ini
cp .env.pipelines .env
php artisan key:generate
pipelines:
pull-requests:
'**':
- step: *install-composer-packages
- parallel:
- step:
name: Unit
script:
- *setup-tests
- vendor/bin/phpunit tests/Unit --testdox
services:
- mysql
- step:
name: Feature
script:
- *setup-tests
- vendor/bin/phpunit tests/Feature --testdox
services:
- mysql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment