-
Notifications
You must be signed in to change notification settings - Fork 38
/
.travis.yml
59 lines (55 loc) · 2.4 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
dist: bionic
addons:
apt:
sources:
- sourceline: 'deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable'
key_url: 'https://download.docker.com/linux/ubuntu/gpg'
update: true
sudo: required
# DOCKER_USER and DOCKER_PASS is set in travis
env:
global:
- DOCKER_IMG=airprint-bridge
- IMAGE=$DOCKER_USER/$DOCKER_IMG
- PLATFORMS=linux/amd64,linux/arm,linux/arm64
- DOCKER_CLI_EXPERIMENTAL=enabled
matrix:
- UBUNTU_VERSION=latest
- UBUNTU_VERSION=focal
- UBUNTU_VERSION=eoan
- UBUNTU_VERSION=bionic
- UBUNTU_VERSION=xenial
# build the image, get CUPS version
before_script:
# upgrade to latest docker-ce from repo
- sudo apt-get -y install docker-ce
# enable experimental in docker daemon
- docker_conf=$(sudo cat /etc/docker/daemon.json |jq '. + {"experimental":"enabled"}')
- echo "$docker_conf" | sudo tee /etc/docker/daemon.json
- sudo service docker start
- docker version
- docker buildx version
# build the image for all platforms
- docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
- docker buildx create --name xbuilder --use
- docker buildx inspect --bootstrap
- docker buildx build --progress plain --platform $PLATFORMS --build-arg UBUNTU_VERSION=$UBUNTU_VERSION -t $IMAGE .
# load a single image for local tests, see https://github.com/docker/buildx/issues/59
- docker buildx build --progress plain --platform linux/amd64 -t $IMAGE --load .
- export VERSION=$(docker run --rm -it --entrypoint dpkg $IMAGE -s cups-daemon |grep ^Version | sed -e 's/Version. \([0-9.]*\)-.*/\1/')
# start a container and see that it becomes healthy
script:
# travis always passes, if container becomes healthy
- echo "Ubuntu version = $UBUNTU_VERSION CUPS = $VERSION"
- >
echo "Starting cups...";
docker create --name airprint-test -e CUPS_LPADMIN_PRINTER1="lpadmin -p test -D test -m 'lsb/usr/cups-pdf/CUPS-PDF_opt.ppd' -v cups-pdf:/" $IMAGE;
docker start airprint-test;
docker exec airprint-test bash -c 'while ! cupsctl -h localhost --share-printers 2>/dev/null; do echo -n "."; sleep 1; done';
while [ -z "$(docker ps -f name='airprint-test' --format '{{ .Status }}' |grep '(healthy)')" ]; do echo -n "."; sleep 1; done;
docker ps -f name='airprint-test';
docker logs airprint-test;
docker exec airprint-test ls -la /etc/cups/;
# push images to docker hub
after_success:
- bash deploy.sh