docker-pi-hole/.circleci/config.yml

71 lines
1.8 KiB
YAML

version: 2
.job_template: &job_template
machine:
enabled: true
steps:
- checkout
- run:
command: |
# setup qemu/variables
docker run --rm --privileged multiarch/qemu-user-static:register --reset
HUB_NAMESPACE=$CIRCLE_PROJECT_USERNAME
[[ $CIRCLE_PROJECT_USERNAME == "pi-hole" ]] && HUB_NAMESPACE="pihole"
[[ $IMAGE != *"/"* ]] && IMAGE="${HUB_NAMESPACE}/${IMAGE}"
[[ $IMAGE != *":"* ]] && IMAGE="${IMAGE}:$CIRCLE_JOB"
if [[ -n "$CIRCLE_TAG" ]]; then
# remove latest tag if used
IMAGE="${IMAGE/:latest/:}"
# and tack the github tag (version) on the front of the tag. image:arch = image:v1.0-arch
IMAGE="${IMAGE/:/:${CIRCLE_TAG}-}"
# latest gets a trailing slash, remove it
IMAGE="${IMAGE/%-/}"
fi
# generate and build dockerfile
pip install --upgrade pip
pip install -r requirements.txt
./Dockerfile.py --arch=${CIRCLE_JOB} -v
docker images
# run docker build & tests
# 2 parallel max b/c race condition with docker fixture (I think?)
py.test -vv -n 2 -k "${CIRCLE_JOB}" ./test/
# push image
# [[ "$CIRCLE_PR_NUMBER" == "" ]] && sudo docker push $IMAGE
jobs:
amd64:
<<: *job_template
aarch64:
<<: *job_template
armhf:
<<: *job_template
#armel:
# <<: *job_template
workflows:
version: 2
build:
jobs:
- amd64:
filters:
tags:
only: /^v.*/
- aarch64:
filters:
tags:
only: /^v.*/
- armhf:
filters:
tags:
only: /^v.*/
#- armel:
# filters:
# tags:
# only: /^v.*/