60 lines
1.6 KiB
YAML
60 lines
1.6 KiB
YAML
version: 2
|
|
|
|
jobs:
|
|
build_and_test:
|
|
docker:
|
|
- image: circleci/php:7.1
|
|
steps:
|
|
- checkout
|
|
- restore_cache:
|
|
keys:
|
|
- v1-dependencies-{{ checksum "composer.json" }}
|
|
- v1-dependencies-
|
|
- run: composer install -n --prefer-dist
|
|
- save_cache:
|
|
paths:
|
|
- ./vendor
|
|
key: v1-dependencies-{{ checksum "composer.json" }}
|
|
- run: ./vendor/bin/phpunit --log-junit ~/phpunit/junit.xml
|
|
- store_test_results:
|
|
path: ~/phpunit
|
|
- store_artifacts:
|
|
path: ~/phpunit
|
|
|
|
deploy:
|
|
docker:
|
|
- image: ansible/ansible:ubuntu1604
|
|
environment:
|
|
ANSIBLE_HOST_KEY_CHECKING: no
|
|
steps:
|
|
- run:
|
|
name: Install system packages.
|
|
command: pip install --upgrade pip && pip install ansible
|
|
- checkout
|
|
- restore_cache:
|
|
key: v1-{{ .Branch }}-{{ checksum "./ansible/requirements.yml" }}
|
|
- run: ansible-galaxy install -r ansible/requirements.yml
|
|
- save_cache:
|
|
key: v1-{{ .Branch }}-{{ checksum "./ansible/requirements.yml" }}
|
|
paths:
|
|
- '/root/.ansible/roles'
|
|
- run: ansible-playbook ansible/deploy.yml -i ansible/hosts -e 'git_branch=master' -u opdavies --become
|
|
|
|
workflows:
|
|
version: 2
|
|
build_test_and_deploy:
|
|
jobs:
|
|
- build_and_test
|
|
- deploy:
|
|
requires:
|
|
- build_and_test
|
|
nightly:
|
|
jobs:
|
|
- build_test_and_deploy
|
|
triggers:
|
|
- schedule:
|
|
cron: "0 4 * * *"
|
|
filters:
|
|
branches:
|
|
only: master
|