-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy path.travis.yml
82 lines (75 loc) · 2.83 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
language: go
go:
- "1.10"
install: skip
jobs:
include:
- stage: test
before_install:
- go get github.com/mattn/goveralls
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
- chmod +x ./cc-test-reporter
- ./cc-test-reporter before-build
- npm install -g snyk
script:
- go test ./... -v -cover -covermode=count -coverprofile=c.out
after_success:
# upload coverage stats
- $GOPATH/bin/goveralls -coverprofile=c.out -service=travis-ci || exit 0
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT || exit 0
- snyk test
- snyk monitor
- &deploy-stage
stage: build and deploy
sudo: required
script:
# build
- >
docker build -t podlike:$DOCKER_TAG \
--build-arg CC=$CC \
--build-arg CC_PKG=$CC_PKG \
--build-arg CC_GOARCH=$CC_GOARCH \
--build-arg VERSION=$TRAVIS_BRANCH \
--build-arg BUILD_ARCH=$BUILD_ARCH \
--build-arg GIT_COMMIT=$TRAVIS_COMMIT \
--build-arg BUILD_TIMESTAMP=$(date +%s) \
.
after_success:
- |
echo ${DOCKER_PASSWORD} | docker login --username "rycus86" --password-stdin
if [ "$TRAVIS_BRANCH" == "master" ]; then
docker tag podlike:${DOCKER_TAG} rycus86/podlike:${DOCKER_TAG}
docker push rycus86/podlike:${DOCKER_TAG}
else
docker tag podlike:${DOCKER_TAG} rycus86/podlike:${TRAVIS_BRANCH}-${DOCKER_TAG}
docker push rycus86/podlike:${TRAVIS_BRANCH}-${DOCKER_TAG}
fi
env:
- DOCKER_TAG=amd64
- BUILD_ARCH=amd64
- <<: *deploy-stage
env:
- DOCKER_TAG=armhf
- BUILD_ARCH=arm32v6
- CC=arm-linux-gnueabihf-gcc
- CC_PKG=gccgo-arm-linux-gnueabihf
- CC_GOARCH=arm
- <<: *deploy-stage
env:
- DOCKER_TAG=aarch64
- BUILD_ARCH=arm64v8
- CC=aarch64-linux-gnu-gcc
- CC_PKG=gccgo-aarch64-linux-gnu
- CC_GOARCH=arm64
- stage: manifest
sudo: required
script:
- |
if [ "$TRAVIS_BRANCH" != "master" ]; then
sed -i "s#rycus86/podlike:#rycus86/podlike:${TRAVIS_BRANCH}-#" manifest.yml
sed -i "s#rycus86/podlike:${TRAVIS_BRANCH}-latest#rycus86/podlike:${TRAVIS_BRANCH}#" manifest.yml
fi
- echo ${DOCKER_PASSWORD} | docker login --username "rycus86" --password-stdin
- curl -fsSL https://github.com/estesp/manifest-tool/releases/download/v0.7.0/manifest-tool-linux-amd64 > ./manifest-tool
- chmod +x ./manifest-tool
- ./manifest-tool push from-spec manifest.yml