Created
June 4, 2018 08:30
-
-
Save foxted/1a9893b4bce26de60dd0d36c57eaf416 to your computer and use it in GitHub Desktop.
Laravel CircleCI config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: 2 | |
jobs: | |
build: | |
docker: | |
- image: invokedigital/laravel:7.2 | |
environment: | |
DB_HOST: 127.0.0.1 | |
- image: circleci/mysql:5.7 | |
command: mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_bin --innodb-large-prefix=true --innodb-file-format=Barracuda | |
environment: | |
MYSQL_USER: homestead | |
MYSQL_PASSWORD: secret | |
MYSQL_DATABASE: homestead | |
MYSQL_ROOT_PASSWORD: secret | |
working_directory: ~/repo | |
steps: | |
- checkout | |
- run: | |
name: Set up permissions | |
command: chmod -R 777 storage | |
- run: | |
name: Set up environment | |
command: cp .env.testing .env | |
# 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: Install wget & dockerize | |
command: apt-get update && apt-get install -y wget && wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz && tar -C /usr/local/bin -xzvf dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz && rm dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz | |
environment: | |
DOCKERIZE_VERSION: v0.6.1 | |
- run: | |
name: Wait for database | |
command: dockerize -wait tcp://localhost:3306 -timeout 1m | |
- run: | |
name: Install composer | |
command: composer install -n --prefer-dist | |
- run: | |
name: Run database migrations | |
command: php artisan migrate:fresh | |
- save_cache: | |
paths: | |
- ./vendor | |
key: v1-dependencies-{{ checksum "composer.json" }} | |
# run tests! | |
- run: | |
name: Run tests | |
command: vendor/bin/phpunit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment