Skip to content

Instantly share code, notes, and snippets.

@satoryu
Created July 10, 2018 11:59
Show Gist options
  • Select an option

  • Save satoryu/77742981503ecbf9a70c8ac3a3511534 to your computer and use it in GitHub Desktop.

Select an option

Save satoryu/77742981503ecbf9a70c8ac3a3511534 to your computer and use it in GitHub Desktop.
Configuration file for running PHPUnit tests for Laravel app on CircleCI
# PHP CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-php/ for more details
#
version: 2
jobs:
build:
docker:
# specify the version you desire here
- image: satoryu/php-mssql:0.0.4
environment:
- APP_ENV: CI
- DB_CONNECTION: sqlsrv
- DB_HOST: 127.0.0.1
- DB_PORT: 1433
- DB_DATABASE: blog
- DB_USERNAME: sa
- DB_PASSWORD: 1234abcD
- image: microsoft/mssql-server-linux:2017-CU8
environment:
- ACCEPT_EULA: Y
- SA_PASSWORD: 1234abcD
working_directory: ~/repo
steps:
- checkout
# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "composer.json" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- run:
name: Wait to ensure sql server becomes ready
command: sleep 60
- run:
name: Create Database
command: /opt/mssql-tools/bin/sqlcmd -S 'localhost,1433' -U sa -P 1234abcD -Q 'create database blog'
- run: ./bin/composer install -n --prefer-dist
- save_cache:
paths:
- ./vendor
key: v1-dependencies-{{ checksum "composer.json" }}
- run:
name: Generate application encryption key
command: |
cp .env.example .env
php artisan key:generate
- run:
name: Migrate
command: php artisan migrate
# run tests!
- run: ./bin/composer exec -v phpunit -- --coverage-html ./coverage
- store_artifacts:
path: ~/repo/coverage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment