forked from senthilrch/kube-fledged
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
56 lines (56 loc) · 2.5 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
dist: bionic
language: go
go:
- 1.16.4
services:
- docker
env:
# Enable docker buildx plugin
- DOCKER_CLI_EXPERIMENTAL=enabled COVERALLS_SERVICE_JOB_ID=$TRAVIS_JOB_ID COVERALLS_SERVICE_NAME="kube-fledged code coverage"
before_install:
# Install latest stable version of docker-engine as described in docker documentation:-
# https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository
- sudo apt-get remove docker docker-engine docker.io containerd runc
- sudo apt-get update
- sudo apt install apt-transport-https ca-certificates curl gnupg-agent software-properties-common -y
- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
- sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
- sudo apt-get update
- sudo apt-get install docker-ce docker-ce-cli containerd.io -y
install:
# Install dependencies required for unit test coverage
- go get golang.org/x/tools/cmd/cover
- go get github.com/mattn/goveralls
- go get -u golang.org/x/lint/golint
stages:
# This stage builds all four amd64 images, performs tests in "hack" and runs unit tests with coverage
- name: build_amd64
if: (type = push AND branch = develop) or (type = pull_request)
# This stage builds all four multi-arch images and pushes them to docker hub (only for PR builds)
- name: build_multiarch
if: type = push and branch = master
# This stage is a placeholder for future (only for release tags)
- name: build_release
if: tag IS present
jobs:
include:
- stage: build_amd64
script:
- hack/verify-codegen.sh
- hack/verify-boilerplate.sh
- hack/verify-gofmt.sh
- hack/verify-golint.sh
- hack/verify-govet.sh
- echo "$DOCKERHUB_PSWD" | docker login --username "$DOCKERHUB_USER" --password-stdin
# BUILD_OUTPUT is left empty to indicate buildx to leave the built images in it's cache
- travis_wait 30 make BUILD_OUTPUT= PROGRESS=plain release-amd64
- make test
- $(go env GOPATH | awk 'BEGIN{FS=":"} {print $1}')/bin/goveralls -coverprofile=coverage.out -service=travis-ci
- stage: build_multiarch
script:
- echo "$DOCKERHUB_PSWD" | docker login --username "$DOCKERHUB_USER" --password-stdin
# BUILD_OUTPUT=--push requests buildx to push the built images to docker hub
- travis_wait 60 make PROGRESS=plain release
- stage: build_release
script:
- echo "Release tag pushed. nothing to do!!"