-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy path.travis.yml
104 lines (99 loc) · 3.16 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
98
99
100
101
102
103
104
language: minimal
dist: focal
os: linux
env:
global:
- REPO="${TRAVIS_REPO_SLUG#*/}"
- OWNER=plus3it
- DEPLOY_SLUG=$OWNER/$REPO
- TF_INPUT=0
stages:
- test
- deploy
- tag
if: branch = master OR type = pull_request OR tag is present
before_install:
- tmpdaemon=$(mktemp)
- sudo jq '."registry-mirrors" += ["https://mirror.gcr.io"]' /etc/docker/daemon.json > "$tmpdaemon"
- sudo mv "$tmpdaemon" /etc/docker/daemon.json
- sudo systemctl daemon-reload
- sudo systemctl restart docker
- docker system info
jobs:
include:
- stage: test
name: Lint all the things
script:
- make docker/run target=lint
- stage: test
name: Ensure python deps install
language: python
python: "3.8"
install:
- python -m pip install -r requirements.txt
- pipenv install
script: skip
- stage: tag
if: type != pull_request AND branch = master AND tag is not present
name: Create GitHub Release
before_script:
- PRIOR_VERSION=$(git describe --abbrev=0 --tags)
- RELEASE_VERSION=$(grep '^current_version' $TRAVIS_BUILD_DIR/.bumpversion.cfg | sed 's/^.*= //')
- RELEASE_BODY="[$REPO v$RELEASE_VERSION changes](https://github.com/$OWNER/$REPO/compare/$PRIOR_VERSION...$RELEASE_VERSION)"
- export PRIOR_VERSION RELEASE_VERSION RELEASE_BODY
script: skip
before_deploy:
- echo PRIOR_VERSION = $PRIOR_VERSION
- echo RELEASE_VERSION = $RELEASE_VERSION
- echo RELEASE_BODY = $RELEASE_BODY
deploy:
provider: releases
name: $RELEASE_VERSION
tag_name: $RELEASE_VERSION
target_commitish: $TRAVIS_COMMIT
release_notes: $RELEASE_BODY
draft: false
token: $GH_RELEASES_TOKEN
on:
branch: master
repo: $DEPLOY_SLUG
condition: '"$PRIOR_VERSION" != "$RELEASE_VERSION"'
- stage: deploy
if: type != pull_request AND (branch = master OR tag is present)
name: Deploy to target environment (master branch=dev; tag=release)
language: python
python: "3.8"
env:
- TF_CLI_ARGS_apply="-auto-approve"
install:
- python -m pip install -r requirements.txt
- pipenv install
- make init
- make rclone/install terraform/install terragrunt/install
script: skip
before_deploy:
- echo TAG = $TRAVIS_TAG
- echo BRANCH = $TRAVIS_BRANCH
deploy:
- provider: script
script: >-
TF_VAR_bucket_name="$DEV_BUCKET"
TF_VAR_repo_endpoint="$DEV_REPO"
WRANGLER_DISTRIBUTION="$DEV_DISTRIBUTION"
travis-wait-improved --timeout 45m
make deploy/dev
on:
branch: master
repo: $DEPLOY_SLUG
cleanup: false
- provider: script
script: >-
TF_VAR_bucket_name="$RELEASE_BUCKET"
TF_VAR_repo_endpoint="$RELEASE_REPO"
WRANGLER_DISTRIBUTION="$RELEASE_DISTRIBUTION"
travis-wait-improved --timeout 120m
make deploy/release
on:
tags: true
repo: $DEPLOY_SLUG
cleanup: false