You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
95 lines
2.6 KiB
YAML
95 lines
2.6 KiB
YAML
version: 2
|
|
jobs:
|
|
test:
|
|
docker:
|
|
- image: debian:stable-slim
|
|
auth:
|
|
username: $DOCKER_USER
|
|
password: $DOCKER_PASS
|
|
working_directory: /app
|
|
steps:
|
|
- run:
|
|
name: Install Docker build dependencies
|
|
command: |
|
|
apt update
|
|
apt install -y git python-pip python2.7 build-essential python2.7-dev default-libmysqlclient-dev default-mysql-client
|
|
- checkout
|
|
- setup_remote_docker
|
|
- run:
|
|
name: install
|
|
command: |
|
|
python2.7 --version
|
|
pip install virtualenv
|
|
make build
|
|
- run:
|
|
name: test
|
|
command: |
|
|
make test
|
|
|
|
build:
|
|
docker:
|
|
- image: circleci/python
|
|
steps:
|
|
- checkout
|
|
- setup_remote_docker
|
|
|
|
- run:
|
|
name: Create version.json
|
|
command: |
|
|
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" | tee version.json
|
|
- store_artifacts:
|
|
path: version.json
|
|
|
|
- run:
|
|
name: Build deployment container image
|
|
command: docker build -t app:build .
|
|
- run:
|
|
name: Test flake8
|
|
command: docker run -it app:build test_flake8
|
|
- run:
|
|
name: Test nose
|
|
command: docker run -it app:build test_nose
|
|
- run:
|
|
name: Functional tests
|
|
command: docker run -it app:build test_functional
|
|
- run:
|
|
name: Push to Dockerhub
|
|
command: |
|
|
if [ "${CIRCLE_BRANCH}" == "master" ]; then
|
|
bin/ci/deploy-dockerhub.sh latest
|
|
fi
|
|
if [[ "${CIRCLE_BRANCH}" == feature* ]] || [[ "${CIRCLE_BRANCH}" == dockerpush* ]]; then
|
|
bin/ci/deploy-dockerhub.sh "$CIRCLE_BRANCH"
|
|
fi
|
|
if [ -n "${CIRCLE_TAG}" ]; then
|
|
bin/ci/deploy-dockerhub.sh "$CIRCLE_TAG"
|
|
fi
|
|
|
|
workflows:
|
|
version: 2
|
|
|
|
# workflow jobs are _not_ run in tag builds by default
|
|
# we use filters to whitelist jobs that should be run for tags
|
|
|
|
# workflow jobs are run in _all_ branch builds by default
|
|
# we use filters to blacklist jobs that shouldn't be run for a branch
|
|
|
|
# see: https://circleci.com/docs/2.0/workflows/#git-tag-job-execution
|
|
|
|
build-test-push:
|
|
jobs:
|
|
- test:
|
|
filters:
|
|
tags:
|
|
only: /.*/
|
|
|
|
- build:
|
|
filters:
|
|
tags:
|
|
only: /.*/
|