version: 2 jobs: 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: - build: filters: tags: only: /.*/