Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
214 changes: 214 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,214 @@
version: 2
jobs:

build:
environment:
- TZ: "/usr/share/zoneinfo/America/Los_Angeles"
- CONTAINER_NAME: "vanessa/scif"
docker:
- image: docker:18.01.0-ce-git
working_directory: /tmp/src/scif
steps:
- run:
name: Install parallel gzip and python3
command: apk add --no-cache pigz python3
- restore_cache:
keys:
- docker-v1-{{ .Branch }}-{{ epoch }}
- docker-v1-{{ .Branch }}-
- docker-v1-master-
- docker-v1-
paths:
- /tmp/cache/container.tar.gz

- checkout
- setup_remote_docker
- run:
name: Load Docker image layer cache
no_output_timeout: 30m
command: |
docker info
set +o pipefail
if [ -f /tmp/cache/container.tar.gz ]; then
pigz -d --stdout /tmp/cache/container.tar.gz | docker load
fi
docker images
- run:
name: Build Docker images
no_output_timeout: 60m
command: |
# Build docker image
e=1 && for i in {1..5}; do
docker build \
--cache-from=${CONTAINER_NAME}:hw \
--rm=false \
-f /tmp/src/scif/Dockerfile.hello-world \
-t ${CONTAINER_NAME} \
--build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \
--build-arg VCS_REF=`git rev-parse --short HEAD` \
--build-arg VERSION="${CIRCLE_TAG:-$THISVERSION}" . \
&& e=0 && break || sleep 15
done && [ "$e" -eq "0" ]
- run:
name: Docker save
no_output_timeout: 40m
command: |
echo "Saving ${CONTAINER_NAME} to container.tar.gz"
mkdir -p /tmp/cache
docker save ${CONTAINER_NAME} \
| pigz -2 -p 3 > /tmp/cache/container.tar.gz
- persist_to_workspace:
root: /tmp
paths:
- cache/container.tar.gz
- src/scif

update_cache:
machine:
# Ubuntu 14.04 with Docker 17.10.0-ce
image: circleci/classic:201711-01
working_directory: /tmp/src/scif
steps:
- attach_workspace:
at: /tmp
- save_cache:
key: docker-v1-{{ .Branch }}-{{ epoch }}
paths:
- /tmp/cache/container.tar.gz

test_apps:
machine:
image: circleci/classic:201711-01
environment:
- CONTAINER_NAME: "vanessa/scif"
working_directory: /home/circleci/out/tests
steps:
- checkout
- attach_workspace:
at: /tmp
- run:
name: Load Docker image layer cache
no_output_timeout: 30m
command: |
echo $PWD
ls /tmp
- run:
name: Load Docker image layer cache
no_output_timeout: 30m
command: |
docker info
set +o pipefail
if [ -f /tmp/cache/container.tar.gz ]; then
sudo apt update && sudo apt -y install pigz
pigz -d --stdout /tmp/cache/container.tar.gz | docker load
docker images
fi
- run:
name: List SCIF Apps
no_output_timeout: 2h
command: |
ls /tmp
echo "The applications installed in this container are:"
docker run -it --rm=false \
${CONTAINER_NAME} apps
- run:
name: Show SCIF Help
no_output_timeout: 2h
command: |
ls $PWD
echo "Testing SCIF Client Help"
chmod u+x scif/tests/test_help.sh
/bin/bash scif/tests/test_help.sh ${CONTAINER_NAME}
- run:
name: Test SCIF Client Run
no_output_timeout: 2h
command: |
ls /tmp
echo "Testing SCIF Client Run:"
chmod u+x scif/tests/test_run.sh
/bin/bash scif/tests/test_run.sh ${CONTAINER_NAME}
- run:
name: Test SCIF Client Exec
no_output_timeout: 2h
command: |
echo "Testing SCIF Client Exec:"
chmod u+x scif/tests/test_exec.sh
/bin/bash scif/tests/test_exec.sh ${CONTAINER_NAME}
- run:
name: Test SCIF Client Test
no_output_timeout: 2h
command: |
echo "Testing SCIF Client Test:"
chmod u+x scif/tests/test_tests.sh
/bin/bash scif/tests/test_tests.sh ${CONTAINER_NAME}
- store_test_results:
path: /home/circleci/out/tests


test_python:
docker:
- image: circleci/python:3.6.1

working_directory: ~/scif

steps:
- checkout

- restore_cache:
keys:
- v1-dependencies

- run:
name: install dependencies
command: |
python3 -m venv venv
. venv/bin/activate
python3 setup.py install

- save_cache:
paths:
- ./venv
key: v1-dependencies

- run:
name: run tests
command: |
. venv/bin/activate
python setup.py test

- store_artifacts:
path: test-reports
destination: test-reports


workflows:
version: 2
build_and_test:
jobs:
- build:
filters:
tags:
only: /.*/

- update_cache:
requires:
- build
filters:
branches:
ignore: /docs?\/.*/
tags:
only: /.*/

- test_apps:
requires:
- build
filters:
branches:
ignore: /docs?\/.*/
tags:
only: /.*/

- test_python:
filters:
tags:
only: /.*/
Loading