forked from TheThingsNetwork/lorawan-stack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
156 lines (156 loc) · 5.21 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
sudo: required
conditions: v1
if: type = pull_request OR branch = master OR tag IS present
os: linux
git:
depth: false
language: go
go: 1.14.x
go_import_path: go.thethings.network/lorawan-stack
env:
global:
- GOPROXY=https://proxy.golang.org
- NODE_ENV=production
- YARN_CACHE_FOLDER=$HOME/.cache/yarn
- MAGE=$HOME/.cache/mage/mage
- TEST_SLOWDOWN=8
- TEST_REDIS=1
- PATH=/snap/bin:$PATH
- HUGO_BASE_URL=https://thethingsstack.io/
- DOCKER_IMAGE=thethingsnetwork/lorawan-stack
- DOCKER_IMAGE_DEV=thethingsnetwork/lorawan-stack-dev
matrix:
include:
- env: RUNTYPE=js
- env: RUNTYPE=go.test RUN_GOARCH=amd64
- env: RUNTYPE=go.test RUN_GOARCH=386
- env: RUNTYPE=go.lint
- env: RUNTYPE=release
if: tag IS present OR (type != pull_request AND branch = master)
services:
- docker
cache:
directories:
- '$GOPATH/pkg/mod'
- '$HOME/.cache/go-build'
- '$HOME/.cache/mage'
- '$HOME/.cache/yarn'
before_install:
- |
if [[ "$TRAVIS_EVENT_TYPE" == "push" ]] && [[ "$TRAVIS_BRANCH" == "master" ]]; then
set -e
go clean -modcache
go clean -cache
rm -rf $HOME/.cache/mage/*
rm -rf $HOME/.cache/yarn/*
fi
- |
if [[ ! -z "$encrypted_fc3d5d829302_key" ]]; then
openssl aes-256-cbc -K $encrypted_fc3d5d829302_key \
-iv $encrypted_fc3d5d829302_iv \
-in pkg/blob/testdata/gcloud.json.enc \
-out pkg/blob/testdata/gcloud.json \
-d
fi
- |
if [[ "$RUNTYPE" == "go.test" ]]; then
set -e
sudo rm /usr/local/bin/docker-compose
curl -L https://github.com/docker/compose/releases/download/1.23.2/docker-compose-$(uname -s)-$(uname -m) > docker-compose
chmod +x docker-compose
sudo mv docker-compose /usr/local/bin
fi
- |
if [[ "$RUNTYPE" == "release" ]]; then
echo "$SNAPCRAFT_LOGIN_ENCRYPTION_PASS" | gpg --passphrase-fd 0 snapcraft.login.gpg
nvm install 10.16.0
fi
- |
if [[ "$RUNTYPE" == "js" ]]; then
nvm install 10.16.0
fi
install:
- make init
- |
if [[ "$RUNTYPE" == "js" ]]; then
$MAGE js:devDeps js:deps jsSDK:deps
$MAGE docs:deps
fi
- |
if [[ "$RUNTYPE" == "release" ]]; then
set -e
sudo apt-get -y update
sudo apt-get install -y rpm snapd
sudo snap install snapcraft --classic
$MAGE jsSDK:deps js:deps
$MAGE docs:deps
fi
before_script:
- |
if [[ "$RUNTYPE" == "go.test" ]]; then
set -e
$MAGE dev:dbStart
fi
script:
- if [[ "$RUNTYPE" == "js" ]]; then $MAGE proto:swaggerClean proto:swagger; fi
- if [[ "$RUNTYPE" == "js" ]]; then $MAGE proto:markdownClean proto:markdown; fi
- if [[ "$RUNTYPE" == "js" ]]; then $MAGE proto:jsSDKClean proto:jsSDK; fi
- if [[ "$RUNTYPE" == "js" ]]; then $MAGE jsSDK:clean jsSDK:build; fi
- if [[ "$RUNTYPE" == "js" ]]; then $MAGE js:translations; fi
- if [[ "$RUNTYPE" == "js" ]]; then $MAGE js:backendTranslations; fi
- if [[ "$RUNTYPE" == "js" ]]; then $MAGE js:test jsSDK:test; fi
- if [[ "$RUNTYPE" == "js" ]]; then $MAGE js:lint jsSDK:lint; fi
- if [[ "$RUNTYPE" == "js" ]]; then $MAGE version:files; fi
- if [[ "$RUNTYPE" == "js" ]]; then $MAGE docs:build; fi
- if [[ "$RUNTYPE" == "go.lint" ]]; then $MAGE headers:check; fi
- if [[ "$RUNTYPE" == "go.lint" ]]; then $MAGE proto:goClean proto:go; fi
- if [[ "$RUNTYPE" == "go.lint" ]]; then $MAGE go:messages; fi
- if [[ "$RUNTYPE" == "go.lint" ]]; then $MAGE go:lint; fi
- if [[ "$RUNTYPE" == "go.lint" ]]; then $MAGE go:unconvert; fi
- if [[ "$RUNTYPE" == "go.lint" ]]; then $MAGE go:fmt; fi
- if [[ "$RUNTYPE" == "go.lint" ]]; then $MAGE dev:misspell; fi
- |
if [[ "$RUNTYPE" == "go.test" ]]; then
if [[ "$RUN_GOARCH" == "amd64" ]]; then
GOARCH=$RUN_GOARCH $MAGE go:coveralls
else
GOARCH=$RUN_GOARCH $MAGE go:test
fi
fi
- if [[ "$RUNTYPE" == "go.test" ]]; then $MAGE go:testBinaries; fi
- if [[ "$RUNTYPE" == "release" ]]; then $MAGE version:files; fi
- $MAGE git:diff
after_success:
- |
if [[ "$RUNTYPE" == "release" ]]; then
set -e
rm -rf doc/public
mkdir doc/public
git fetch
git --work-tree=doc/public checkout origin/gh-pages -- .
git reset -- .
fi
- |
if [[ "$RUNTYPE" == "release" ]]; then
set -e
$MAGE js:build
$MAGE docs:build
docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD"
snapcraft login --with snapcraft.login
if [[ ! -z "$TRAVIS_TAG" && "$TRAVIS_TAG" =~ ^v3\.[0-9]+\.[0-9]+ ]]; then
GO111MODULE=on go run github.com/goreleaser/goreleaser --release-notes <(printf "[Release notes](https://github.com/TheThingsNetwork/lorawan-stack/blob/${TRAVIS_TAG}/CHANGELOG.md#$(echo ${TRAVIS_TAG} | sed "s/v\([1-9]\+\)\.\([1-9]\+\)\.\([1-9]\+\)/\1\2\3---$(date +%Y-%m-%d)/"))")
else
GO111MODULE=on go run github.com/goreleaser/goreleaser --snapshot
docker push $DOCKER_IMAGE_DEV:$TRAVIS_COMMIT
fi
fi
deploy:
- provider: pages
local_dir: doc/public
skip_cleanup: true
github_token: $GITHUB_TOKEN
keep_history: true
fqdn: thethingsstack.io
on:
tags: true
condition: $RUNTYPE = "release"