monolithic/.circleci/config.yml

75 lines
2.3 KiB
YAML
Raw Normal View History

workflows:
version: 2
build_test_deploy:
jobs:
- test
- publish_latest:
context: docker-hub
requires:
- test
filters:
branches:
only:
- master
version: 2
jobs:
test:
docker:
- image: circleci/python:2-jessie
steps:
- checkout
- setup_remote_docker: # (2)
docker_layer_caching: false # (3)
- run:
name: Install goss
command: |
# rather than give internet scripts SU rights, we install to local user bin and add to path
mkdir ~/bin
export GOSS_DST=~/bin
export PATH=$PATH:~/bin
curl -fsSL https://goss.rocks/install | sh
goss -version
- run:
name: Test
command: |
# Don't forget path!
export PATH=$PATH:~/bin
# Important, change from mount to work on remote docker, see https://github.com/aelsabbahy/goss/pull/271
# If using machine image you do not need this.
export GOSS_FILES_STRATEGY=cp
./run-tests.sh circleci keepimage
- run:
name: Save docker image
command: |
mkdir -p workspace
2019-05-30 20:30:25 +00:00
docker save -o workspace/lancachenet-monolithic.tar lancachenet/monolithic:goss-test
- persist_to_workspace:
root: workspace
paths:
2019-05-30 20:30:25 +00:00
lancachenet-monolithic.tar
- store_test_results:
path: reports
- store_artifacts:
path: reports
destination: reports
- store_artifacts:
path: workspace/lancachenet-monolithic.tar
destination: docker-lancachenet-monolithic.tar
publish_latest:
docker:
- image: circleci/python:2-jessie
steps:
- setup_remote_docker: # (2)
docker_layer_caching: false # (3)
- attach_workspace:
at: /tmp/workspace
- run:
name: "Deploy latest to docker hub"
command: |
docker login -u $DOCKER_USER -p $DOCKER_PASS
2019-05-30 20:30:25 +00:00
docker load -i /tmp/workspace/lancachenet-monolithic.tar
docker tag lancachenet/monolithic:goss-test lancachenet/monolithic:latest
docker push lancachenet/monolithic:latest