forked from turbonomic/prometurbo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
54 lines (47 loc) · 1.93 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
language: go
env:
global:
- DOCKER_IMAGE_NAME=$TRAVIS_REPO_SLUG
- PLATFORM_OS_ARCH_LIST="linux/amd64,linux/arm64,linux/ppc64le,linux/s390x"
services:
- docker
go:
- 1.20.5
go_import_path: github.com/turbonomic/prometurbo
before_install:
- go install -v github.com/mattn/goveralls@HEAD
script:
- make fmtcheck
- make vet
- make product
- $HOME/gopath/bin/goveralls -v -race -service=travis-ci
after_success:
- |
if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
if [ -n "$TRAVIS_TAG" ] || [ "$TRAVIS_BRANCH" == "master" ]; then
# Update docker
sudo rm -rf /var/lib/apt/lists/*
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) edge"
sudo apt-get update
sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce
docker version
# Install buildx plugin
mkdir -vp ~/.docker/cli-plugins/
curl --silent -L "https://github.com/docker/buildx/releases/download/v0.6.0/buildx-v0.6.0.linux-amd64" > ~/.docker/cli-plugins/docker-buildx
chmod a+x ~/.docker/cli-plugins/docker-buildx
# Login to docker
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
# Create and set a new buildx builder instance
docker buildx create --use
# Build and push the image
cd build
if [ -n "$TRAVIS_TAG" ]; then
# Push a release image triggered by a git tag
docker buildx build --platform $PLATFORM_OS_ARCH_LIST --build-arg GIT_COMMIT=$TRAVIS_COMMIT --label "git-version=$TRAVIS_COMMIT" .
else
# Push the latest image built from master branch
docker buildx build --platform $PLATFORM_OS_ARCH_LIST --build-arg GIT_COMMIT=$TRAVIS_COMMIT --label "git-version=$TRAVIS_COMMIT" .
fi
fi
fi