CircleCI 2.0 Configuration for Laravel 5.5 with Laravel Dusk

# PHP CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-php/ for more details
#
version: 2
jobs:
build:
docker:
- image: circleci/php:7.0-browsers
working_directory: ~/laravel
steps:
- checkout

#https://askubuntu.com/questions/594656/how-to-install-the-latest-versions-of-nodejs-and-npm
#We are using Node JS 6 because that's the current version on our local vagrant/homestead machines
- run:
name: Download NodeJS v6
command: curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -

#sqlite needed for laravel database
#nodejs6 needed to run `npm run watch` later
- run:
name: Install PHP sqlite and nodejs 6
command: sudo apt-get install -y libsqlite3-dev nodejs


# Leave this for future use if php-zip is ever required
# If you remove the flag 'composer install --ignore-platform-reqs`
# composer will require php-zip to be installed. It appers that
# this isn't currently needed, so we are removing this from CircleCI
# to save 30 seconds of build time. The php-zip package isn't currently
# used by anything. If it ever does need to be used again, this can be
# uncommented.

#- run:
# name: Install PHP libzip-dev
# command: sudo apt-get install -y libzip-dev

#- run:
# name: Install zip package for PHP
# command: sudo docker-php-ext-install zip

- run:
name: Setup Laravel testing environment variables for CircleCI test
command: cp .env.testing .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:
name: Install NodeJS Packages
command: npm install
- save_cache:
key: dependency-cache-{{ checksum "package.json" }}
paths:
- ./node_modules

- run:
name: Create SQLite Database
command: touch database/database.sqlite

- run:
name: Migrate Laravel Database
command: php artisan migrate --env=testing --force

- run:
name: Compile Javascript & CSS for Browser Testing
command: npm run production

- 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: Test 1 - Run Phpunit for Server-Side HTTP Requests & PHP Unit Testing
command: vendor/bin/phpunit

- run:
name: Test 2 - Run Laravel Desk for Browser Testing
command: php artisan dusk

--

--

--

Passionate about helping others realize their full potential and becoming financially free.

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Wes Mahler

Wes Mahler

Passionate about helping others realize their full potential and becoming financially free.

More from Medium

Laravel Console: Options for your Seeders

How to run a Laravel Application into Kubernetes

How To Install Old Version Laravel Using Composer

How to Setup Laravel Valet on Mac