-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy path.travis.yml
79 lines (74 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# The following environment variables need to be defined in the Travis UI:
# DOCKERHUB_USER ....... for deploying docker images to DockerHub
# DOCKERHUB_PASSWORD ... (secret) for deploying docker images to DockerHub
# GITHUB_TOKEN ......... (secret) for creating a GitHub Release
os: linux
dist: xenial # Ubuntu: 16.04 (xenial), 18.04 (bionic)
language: shell
services: docker
git:
depth: 1
jobs:
include:
# Build instructions for one stage (= docker build), one Debian version.
- &build-env
stage: build-env
# This build is expensive O(hours).
# Only run on dedicated deployment branch.
if: branch = deploy
arch: arm64
env: debian_version=stretch
before_install: &env_setup
- export GITHUB_REPO="${TRAVIS_REPO_SLUG/*\//}"
- export GITHUB_USER="${TRAVIS_REPO_SLUG/\/*/}"
# We use before_script instead of script because we want to error out at
# the first sign of trouble.
before_script:
- stage="$(echo ${TRAVIS_BUILD_STAGE_NAME} | tr '[A-Z]' '[a-z]')"
# For some reason executing a function with 'set -e; f' hangs Travis
# on error in the function, whereas 'bash -ec f' errors the build as
# expected.
- bash -ec "source ./build-functions.sh; build ${stage}"
- docker login -u="$DOCKERHUB_USER" -p="$DOCKERHUB_PASSWORD"
- bash -ec "source ./build-functions.sh; push ${stage}"
# Do the same (in parallel) for other Debian versions.
- <<: *build-env
env: debian_version=buster
- <<: *build-env
env: debian_version=bullseye
# This stanza repeats for every build stage. It's rather obscure and ugly,
# but Travis' expressibility for job dependencies is quite limited. This is
# the most concise way I have found to express an approximation of the
# actual dependencies.
- &server-deb
<<: *build-env
stage: server-deb
- <<: *server-deb
env: debian_version=buster
- <<: *server-deb
env: debian_version=bullseye
- &server
<<: *build-env
stage: server
- <<: *server
env: debian_version=buster
- <<: *server
env: debian_version=bullseye
- &desktop-deb
<<: *build-env
stage: desktop-deb
- <<: *desktop-deb
env: debian_version=buster
- <<: *desktop-deb
env: debian_version=bullseye
- stage: Create GitHub Release
if: tag IS NOT blank
arch: amd64 # This can run on a regular x86 host.
before_install: *env_setup
install: |
# Install GitHub API script.
bash -ec "source ./build-functions.sh; install_github_api"
script: |
# Create a new draft release.
bash -ec "source ./build-functions.sh; \
create_github_release $TRAVIS_TAG stretch buster bullseye"