-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.travis.yml
54 lines (53 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
sudo: required
matrix:
include:
# Sonar scan
- language: go
go:
- "1.14"
addons:
sonarcloud:
organization: "thecampagnards-github"
cache:
directories:
- "$HOME/.sonar/cache"
- "$GOPATH/pkg/mod"
- "client/node_modules"
install:
- nvm install 14
- git fetch --unshallow --quiet
- npm link typescript
script:
- cd "$TRAVIS_BUILD_DIR/client"
- npm install
- npm run lint
- CI=true npm run test
- cd "$TRAVIS_BUILD_DIR/server"
- go test ./... -coverprofile="coverage.out"
- cd "$TRAVIS_BUILD_DIR"
- sonar-scanner
# Docker build
- language: sh
services:
- docker
before_install:
- DOCKER_BASE="$DOCKER_USERNAME/docktor"
- DOCKER_BUILDS=""
- TAGS=""
- test "$TRAVIS_BRANCH" = master && TAGS="$TAGS latest" || true
- test -n "$TRAVIS_TAG" && TAGS="$TAGS stable $TRAVIS_TAG" || true
- echo "Tags are $TAGS"
script:
- docker build -t "$DOCKER_BASE:current" .
- name="$DOCKER_BASE"
- DOCKER_BUILDS="$DOCKER_BUILDS $name"
after_success:
- docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
- |
for repo in $DOCKER_BUILDS; do
for tag in $TAGS; do
echo "Deploying $repo:current as $repo:$tag...";
docker tag "$repo:current" "$repo:$tag" || exit 1;
docker push "$repo:$tag" || exit 1;
done;
done;