forked from diyhue/diyHue
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
60 lines (56 loc) · 2.76 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
sudo: required
services:
- docker
language: bash
env:
- ARCH=amd64
- ARCH=arm
- ARCH=aarch64
script:
# Setup QEMU for ARM image build
- docker run --rm --privileged multiarch/qemu-user-static:register
# Build image
- docker build -t diyhue/core:$ARCH -f ./.build/$ARCH.Dockerfile .
# Login, tag and push dev image
#- docker login -u="$DOCKER_USER" -p="$DOCKER_PASS"
#- docker tag diyhue/core:$ARCH diyhue/core:$ARCH-dev
#- docker push diyhue/core:$ARCH-dev
# Pull dev image to run tests
- docker run -d --name "diyHue" --network="host" -v '/mnt/hue-emulator/export/':'/opt/hue-emulator/export/':'rw' -e 'MAC=b8:27:eb:d4:dc:11' -e 'IP=192.168.1.123' -e 'DECONZ=192.168.1.111' -e 'IP_RANGE=5,200' -e 'DEBUG=true' diyhue/core:$ARCH
# Wait for logs to populate, then list them
- sleep 30
- docker logs diyHue
# Kill and remove test container
- docker kill diyHue
- docker rm diyHue
- docker history diyhue/core:$ARCH
- docker images
after_success:
- >
# do not push pull requests
if [ "$TRAVIS_PULL_REQUEST" == "false" ] && [[ $TRAVIS_BRANCH != *"-"* ]]; then
# login to docker hub
echo "$DOCKER_PASS" | docker login -u "$DOCKER_USER" --password-stdin
# install manifest tool
wget -O /tmp/manifest-tool https://github.com/estesp/manifest-tool/releases/download/v0.7.0/manifest-tool-linux-amd64
chmod +x /tmp/manifest-tool
# push version if tagged
if [ "$TRAVIS_BRANCH" == "$TRAVIS_TAG" ]; then
docker tag diyhue/core:$ARCH diyhue/core:$TRAVIS_TAG-$ARCH && docker push diyhue/core:$TRAVIS_TAG-$ARCH
/tmp/manifest-tool push from-args --ignore-missing --platforms linux/amd64,linux/arm --template "diyhue/core:$TRAVIS_BRANCH-ARCH-$TRAVIS_TAG" --target "diyhue/core:$TRAVIS_BRANCH-$TRAVIS_TAG"
else
# push branch-arch
docker tag diyhue/core:$ARCH diyhue/core:$TRAVIS_BRANCH-$ARCH && docker push diyhue/core:$TRAVIS_BRANCH-$ARCH
# push branch-arch-commit id
docker tag diyhue/core:$ARCH diyhue/core:$TRAVIS_BRANCH-$ARCH-$TRAVIS_COMMIT && docker push diyhue/core:$TRAVIS_BRANCH-$ARCH-$TRAVIS_COMMIT
# push branch-latest
/tmp/manifest-tool push from-args --ignore-missing --platforms linux/amd64,linux/arm --template "diyhue/core:$TRAVIS_BRANCH-ARCH" --target "diyhue/core:$TRAVIS_BRANCH-latest"
# push branch-commit id
/tmp/manifest-tool push from-args --ignore-missing --platforms linux/amd64,linux/arm --template "diyhue/core:$TRAVIS_BRANCH-ARCH-$TRAVIS_COMMIT" --target "diyhue/core:$TRAVIS_BRANCH-$TRAVIS_COMMIT"
fi
if [ "$TRAVIS_BRANCH" == "master" ]; then
# push latest if master branch
/tmp/manifest-tool push from-args --ignore-missing --platforms linux/amd64,linux/arm --template "diyhue/core:$TRAVIS_BRANCH-ARCH" --target "diyhue/core:latest"
fi
notifications:
slack: diyhue:84x97ehqLW4B6pe9ntP16SOI