2017-10-05 14:14:08 +03:00
|
|
|
version: 2.0
|
2016-06-27 11:57:25 +03:00
|
|
|
|
2017-10-05 14:14:08 +03:00
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
machine: true
|
|
|
|
working_directory: ~/addons-server
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- run: >
|
|
|
|
printf '{"commit":"%s","version":"%s","source":"https://github.com/%s/%s","build":"%s"}\n'
|
|
|
|
"$CIRCLE_SHA1"
|
|
|
|
"$CIRCLE_TAG"
|
|
|
|
"$CIRCLE_PROJECT_USERNAME"
|
|
|
|
"$CIRCLE_PROJECT_REPONAME"
|
|
|
|
"$CIRCLE_BUILD_URL"
|
|
|
|
> version.json
|
|
|
|
- run: docker build -t app:build -f Dockerfile.deploy .
|
|
|
|
- persist_to_workspace:
|
|
|
|
root: .
|
|
|
|
paths: .
|
|
|
|
integration_test:
|
|
|
|
working_directory: ~/addons-server
|
|
|
|
machine: true
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- restore_cache:
|
|
|
|
keys:
|
|
|
|
- uitest-cache-{{ checksum "requirements/docs.txt" }}
|
|
|
|
- uitest-cache-{{ checksum "requirements/prod.txt" }}
|
|
|
|
- uitest-cache-{{ checksum "requirements/dev.txt" }}
|
|
|
|
- uitest-cache-{{ checksum "requirements/uitests.txt" }}
|
|
|
|
- uitest-cache-
|
|
|
|
- run:
|
|
|
|
name: Install Docker Compose
|
|
|
|
command: |
|
|
|
|
set -x
|
|
|
|
sudo pip install docker-compose
|
|
|
|
- run:
|
|
|
|
name: Start container, verify it's running and start tests
|
|
|
|
command: |
|
|
|
|
set -x
|
|
|
|
sudo sysctl -w vm.max_map_count=262144
|
|
|
|
docker-compose up -d
|
|
|
|
sleep 10
|
|
|
|
docker-compose exec web bash /code/scripts/ui-test.sh
|
|
|
|
- store_artifacts:
|
|
|
|
path: ui-test-results
|
|
|
|
- save_cache:
|
|
|
|
key: uitest-cache-{{ checksum "requirements/docs.txt" }}
|
|
|
|
paths:
|
|
|
|
- .tox
|
|
|
|
- save_cache:
|
|
|
|
key: uitest-cache-{{ checksum "requirements/prod.txt" }}
|
|
|
|
paths:
|
|
|
|
- .tox
|
|
|
|
- save_cache:
|
|
|
|
key: uitest-cache-{{ checksum "requirements/dev.txt" }}
|
|
|
|
paths:
|
|
|
|
- .tox
|
|
|
|
- save_cache:
|
|
|
|
key: uitest-cache-{{ checksum "requirements/uitests.txt" }}
|
|
|
|
paths:
|
|
|
|
- .tox
|
|
|
|
- save_cache:
|
|
|
|
key: uitest-cache-
|
|
|
|
paths:
|
|
|
|
- .tox
|
|
|
|
deploy:
|
|
|
|
machine: true
|
|
|
|
steps:
|
|
|
|
- attach_workspace:
|
|
|
|
at: ~/addons-server
|
|
|
|
- run:
|
|
|
|
name: Dockerfile deploy
|
|
|
|
command: |
|
|
|
|
docker tag app:build ${DOCKERHUB_REPO}:latest
|
|
|
|
docker login -e $DOCKERHUB_EMAIL -u $DOCKERHUB_USER -p $DOCKERHUB_PASS
|
|
|
|
docker push ${DOCKERHUB_REPO}:latest
|
|
|
|
release:
|
|
|
|
machine: true
|
|
|
|
steps:
|
|
|
|
- attach_workspace:
|
|
|
|
at: ~/addons-server
|
|
|
|
- run:
|
|
|
|
Name: Release
|
|
|
|
command: |
|
|
|
|
docker tag app:build ${DOCKERHUB_REPO}:${CIRCLE_TAG}
|
|
|
|
docker login -e $DOCKERHUB_EMAIL -u $DOCKERHUB_USER -p $DOCKERHUB_PASS
|
|
|
|
docker push ${DOCKERHUB_REPO}:${CIRCLE_TAG}
|
|
|
|
workflows:
|
|
|
|
version: 2
|
|
|
|
build_test_deploy_release:
|
|
|
|
jobs:
|
|
|
|
- build
|
|
|
|
- integration_test
|
|
|
|
- deploy:
|
|
|
|
requires:
|
|
|
|
- build
|
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
only: master
|
|
|
|
- release:
|
|
|
|
requires:
|
|
|
|
- build
|
|
|
|
filters:
|
|
|
|
tags:
|
|
|
|
only: /.*/
|
|
|
|
branches:
|
|
|
|
ignore: /.*/
|