Skip to content

Instantly share code, notes, and snippets.

@Noogic
Created December 4, 2018 11:14
Show Gist options
  • Select an option

  • Save Noogic/b1fd78cb57dac6b3807b607d10db8fbf to your computer and use it in GitHub Desktop.

Select an option

Save Noogic/b1fd78cb57dac6b3807b607d10db8fbf to your computer and use it in GitHub Desktop.
CircleCi config for Laravel with phpunit, yarn test and dusk
version: 2
jobs:
build:
docker:
# specify the version you desire here
- image: circleci/php:7.2-cli-node-browsers-legacy
# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/docs/2.0/circleci-images/
- image: circleci/mysql:5.7.23-ram
environment:
MYSQL_DATABASE: circle_test
MYSQL_USER: ubuntu
MYSQL_PASSWORD: secret
MYSQL_ROOT_PASSWORD: root
working_directory: ~/laravel
steps:
- checkout
- run:
name: Install PHP PDO
command: sudo -E docker-php-ext-install pdo_mysql
- run:
name: Install bcmath
command: sudo -E docker-php-ext-install bcmath && sudo docker-php-ext-enable bcmath
- run:
name: Install PHP GD
command: sudo apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng-dev && sudo -E docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ && sudo -E docker-php-ext-install -j$(nproc) gd exif
- run:
name: Download NodeJS v8
command: curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
- run:
name: Setup Laravel testing environment variables for CircleCI test
command: cp .env.circle .env
- run:
name: Update composer to latest version
command: composer self-update
- restore_cache:
keys:
- composer-v1-{{ checksum "composer.json" }}
- composer-v1-
- run: composer install -n --prefer-dist --ignore-platform-reqs
- save_cache:
key: composer-v1-{{ checksum "composer.json" }}
paths:
- vendor
- restore_cache:
key: dependency-cache-{{ checksum "package.json" }}
- run: npm install
- save_cache:
key: dependency-cache-{{ checksum "package.json" }}
paths:
- ./node_modules
- run: npm run dev
- run:
name: Run migrations
command: php artisan migrate --seed
- run: ./vendor/bin/phpunit
- run: yarn test
- run:
name: Start Chrome Driver
command: ./vendor/laravel/dusk/bin/chromedriver-linux
background: true
- run:
name: Run Laravel Server
command: php artisan serve
background: true
- run:
name: Run Laravel Dusk Tests
command: php artisan dusk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment