This repository has been archived by the owner on Sep 18, 2024. It is now read-only.
forked from fmartinou/tydom2mqtt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
54 lines (39 loc) · 1.57 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
os: linux
language: python
python:
- 3.9
env:
global:
- DOCKER_CLI_EXPERIMENTAL=enabled
before_install:
- export IMAGE_VERSION=${TRAVIS_BRANCH//\//\_}
- export IMAGE_VERSION=${IMAGE_VERSION//\#/\_}
# Install docker with buildx
- sudo rm -rf /var/lib/apt/lists/*
- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
- lsb_release -cs
- sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) edge"
- sudo apt-get update
- sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce
- docker run --rm --privileged docker/binfmt:820fdd95a9972a5308930a2bdfb8573dd4447ad3
- cat /proc/sys/fs/binfmt_misc/qemu-aarch64
install:
# Install dependencies
- (cd app && pip install -r requirements.txt)
# Install dev dependencies
- (cd app && pip install -r requirements.dev.txt)
# Code static analysis
- (cd app && autopep8 --in-place --aggressive --aggressive *.py)
# Run UT (todo)
script:
# Build docker image
- docker build -t tydom2mqtt .
after_success:
# Override image version with latest if master branch
- if [ "$TRAVIS_BRANCH" == "master" ] ; then export IMAGE_VERSION=latest; fi
# Override image version with tag name if any
- if [ ! -z "$TRAVIS_TAG" ] ; then export IMAGE_VERSION=$TRAVIS_TAG; fi
# Build & push image
- docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD"
- make prepare
- make build IMAGE_NAME=tydom2mqtt IMAGE_VERSION=$IMAGE_VERSION PLATFORMS=linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/amd64 DOCKER_USERNAME=$DOCKER_USERNAME