Created
August 27, 2018 06:01
-
-
Save luceos/977b080e8964c7d98d362afd334bdc11 to your computer and use it in GitHub Desktop.
CircleCI config for laravel and forge token deployment
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
# 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: phpdocker/phpdocker:7.1 | |
environment: | |
- CI: true | |
- DB_DATABASE: testing | |
- DB_USERNAME: testing | |
- DB_PASSWORD: testing | |
- APP_KEY: daala5kinohw0haekoothahSh8eexach | |
working_directory: ~/repo | |
steps: | |
- checkout | |
# Download and cache dependencies | |
- restore_cache: | |
keys: | |
- v1-dependencies-{{ arch }}-{{ checksum "composer.lock" }} | |
# fallback to using the latest cache if no exact match is found | |
- v1-dependencies- | |
- run: docker-php-ext-install pcntl | |
- run: service mysql start | |
- run: mysql -e "create database if not exists testing;" | |
- run: mysql -e "create or replace user testing@localhost identified by 'testing';" | |
- run: mysql -e "grant all privileges on *.* to testing@localhost;" | |
- run: composer config -g github-oauth.github.com $GITHUB_TOKEN | |
- run: composer install -n --prefer-dist --no-progress -o | |
- run: php artisan migrate --force -n | |
- run: php artisan passport:install -n | |
- save_cache: | |
key: v1-dependencies-{{ arch }}-{{ checksum "composer.lock" }} | |
paths: | |
- ./vendor | |
# run tests! | |
- run: ./vendor/bin/phpunit -vvv | |
deploy: | |
docker: | |
# specify the version you desire here | |
- image: circleci/php:7.1.8-browsers | |
working_directory: ~/repo | |
steps: | |
- run: wget https://forge.laravel.com/servers/<serverId>/sites/<siteId>/deploy/http?token=<token> | |
workflows: | |
version: 2 | |
test-and-deploy: | |
jobs: | |
- build | |
- deploy: | |
requires: | |
- build | |
filters: | |
tags: | |
only: /.*/ | |
branches: | |
only: | |
- master | |
- circleci |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment