addons-server/circle.yml

130 строки
4.3 KiB
YAML
Исходник Обычный вид История

version: 2.0
2016-06-27 11:57:25 +03:00
jobs:
build-deploy: # build for the master branch
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:
name: Build docker image and push to repo
command: |
docker version
docker build -t app:build -f Dockerfile.deploy .
docker tag app:build ${DOCKERHUB_REPO}:latest
docker login -u $DOCKERHUB_USER -p $DOCKERHUB_PASS
docker push ${DOCKERHUB_REPO}:latest
build-release: # build for releases (tags)
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:
name: Build docker image and push to repo
command: |
docker version
docker build -t app:build -f Dockerfile.deploy .
docker tag app:build ${DOCKERHUB_REPO}:${CIRCLE_TAG}
docker login -u $DOCKERHUB_USER -p $DOCKERHUB_PASS
docker push ${DOCKERHUB_REPO}:${CIRCLE_TAG}
integration_test:
working_directory: ~/addons-server
machine: true
steps:
2018-02-05 10:19:36 +03:00
- run:
name: Checkout git repository
command: |
2018-02-05 12:06:57 +03:00
git clone --single-branch --depth 1 --branch $CIRCLE_BRANCH https://github.com/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME.git ~/addons-server
2018-02-05 11:57:47 +03:00
2018-02-05 10:19:36 +03:00
if [ -n "$CIRCLE_TAG" ]
then
git reset --hard "$CIRCLE_SHA1"
git checkout -q "$CIRCLE_TAG"
elif [ -n "$CIRCLE_BRANCH" ]
then
git reset --hard "$CIRCLE_SHA1"
git checkout -q -B "$CIRCLE_BRANCH"
fi
2018-02-05 11:53:06 +03:00
- 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: |
2018-02-05 12:22:40 +03:00
set -x
pip install docker-compose>=1.18
docker-compose --version
- 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 20
docker-compose ps
# Make sure dependencies get updated in worker and web container
docker-compose exec worker make -f Makefile-docker update_deps
docker-compose exec worker supervisorctl restart all
docker-compose exec web make -f Makefile-docker update_deps
docker-compose exec web supervisorctl restart all
# Start Test in Firefox docker container
docker-compose exec selenium-firefox tox -e ui-tests
- store_artifacts:
path: ui-test.html
- 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
workflows:
version: 2
build_test_deploy_release:
jobs:
- build-deploy:
filters:
branches:
only: master
- build-release:
filters:
tags:
only: /.*/
branches:
ignore: /.*/
- integration_test