This repository has been archived by the owner on Jul 16, 2022. It is now read-only.
forked from BrewBlox/brewblox-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path.travis.yml
97 lines (86 loc) · 2.55 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
language: python
dist: bionic
python: "3.7"
install:
- set -o allexport
- source .env
- set +o allexport
- pip install poetry
- poetry install
script:
- poetry run pytest
# Note: Deployment refers to multiple environment variables, both public and private.
# Public values should be set in the .env file in the repository.
#
# Public variables are:
# * GITHUB_REPO
# * DOCKER_REPO
#
# Private values such as passwords should not be added to the source code.
# They can be set using the Travis web client.
#
# To set these, edit your repository settings in https://travis-ci.org/,
# and add them as environment variables.
# By default, any occurrence of the variable is censored in the build log.
#
# Private variables are:
# * DOCKER_USER
# * DOCKER_PASSWORD
# * PYPI_USER
# * PYPI_PASSWORD
before_deploy:
# Install docker & enable buildx
- curl -fsSL https://get.docker.com | sh
- echo '{"experimental":"enabled"}' | sudo tee /etc/docker/daemon.json
- mkdir -p $HOME/.docker
- echo '{"experimental":"enabled"}' | sudo tee $HOME/.docker/config.json
- sudo service docker start
# Prep buildx
- docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
- docker buildx create --use
- docker buildx inspect --bootstrap
# Docker login
- if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then
echo ${DOCKER_PASSWORD} | docker login -u ${DOCKER_USER} --password-stdin;
fi
- bash docker/before_build.sh
- export TAG=$(echo ${TRAVIS_BRANCH} | tr '/' '-' | tr '[:upper:]' '[:lower:]')
deploy:
# Deploy "latest" on tag
- provider: script
script: >-
docker buildx build
--tag ${DOCKER_REPO}:latest
--tag ${DOCKER_REPO}:rpi-latest
--build-arg service_info="$(git describe) @ $(date)"
--push
--platform linux/amd64,linux/arm/v7,linux/arm64/v8
docker;
skip_cleanup: true
on:
tags: true
# Deploy branch on any push to repo
- provider: script
script: >-
docker buildx build
--tag ${DOCKER_REPO}:$TAG
--tag ${DOCKER_REPO}:rpi-$TAG
--build-arg service_info="$(git describe) @ $(date)"
--push
--platform linux/amd64,linux/arm/v7,linux/arm64/v8
docker;
skip_cleanup: true
on:
tags: false
repo: ${GITHUB_REPO}
all_branches: true
condition: ${TRAVIS_BRANCH} != master
# Deploy to PyPi any time the package version number is updated on master
- provider: pypi
username: ${PYPI_USER}
password: ${PYPI_PASSWORD}
skip_existing: true
skip_cleanup: true
on:
repo: ${GITHUB_REPO}
tags: true