This repository has been archived by the owner on Jul 20, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.travis.yml
85 lines (76 loc) · 3.04 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
os: linux
dist: xenial
language: go
services:
- docker
sudo: required
env:
global:
- CGO_ENABLED=0
- GOFLAGS='-a -x'
- WORKSPACE='/project'
matrix:
include:
- go: 1.12.x
env: GOOS=linux GOARCH=amd64 DIST_FAMILY=RHEL DIST=rhel8 BIN=ercole-agent-exadata GO111MODULE=on
PACKAGE_BUILD_IMAGE=amreo/rpmbuild-centos8
- go: 1.12.x
env: GOOS=linux GOARCH=amd64 DIST_FAMILY=RHEL DIST=rhel7 BIN=ercole-agent-exadata GO111MODULE=on
PACKAGE_BUILD_IMAGE=amreo/rpmbuild-centos7
- go: 1.12.x
env: GOOS=linux GOARCH=amd64 DIST_FAMILY=RHEL DIST=rhel6 BIN=ercole-agent-exadata GO111MODULE=on
PACKAGE_BUILD_IMAGE=amreo/rpmbuild-centos6
before_install:
- sudo docker pull ${PACKAGE_BUILD_IMAGE}
- if [ -z ${TRAVIS_TAG} ] || [[ ${TRAVIS_TAG} == *-* ]]; then export VERSION=latest;
else export VERSION=${TRAVIS_TAG}; fi
- echo ${TRAVIS_TAG}
- echo ${VERSION}
install:
- sudo docker run -d --rm -it -e WORKSPACE="${WORKSPACE}" -e TRAVIS_REPO_SLUG="${TRAVIS_REPO_SLUG}"
-e TRAVIS_BUILD_NUMBER="${TRAVIS_BUILD_NUMBER}" -v $PWD:"${WORKSPACE}" --name package_builder
${PACKAGE_BUILD_IMAGE} /bin/cat
script:
- sed "s/\"latest\"/\"${VERSION}\"/" main.go > /tmp/main.go
- cp /tmp/main.go main.go
- go build -o ${BIN} main.go
- sed -i "s|ERCOLE_VERSION|${VERSION}|g" package/${DIST}/ercole-agent-exadata.spec
- if [ $DIST_FAMILY == "RHEL" ]; then docker exec -it package_builder /bin/sh -c "cd
${WORKSPACE} && rpmbuild --quiet -bl package/${DIST}/ercole-agent-exadata.spec" || echo
rpmbuild; fi
- if [ $DIST_FAMILY == "RHEL" ]; then docker exec -it package_builder /bin/sh -c "mkdir
~/rpmbuild/SOURCES/ercole-agent-exadata-${VERSION}"; fi
- if [ $DIST_FAMILY == "RHEL" ]; then docker exec -it package_builder /bin/sh -c "cd
${WORKSPACE} && cp -r * ~/rpmbuild/SOURCES/ercole-agent-exadata-${VERSION}/"; fi
- if [ $DIST_FAMILY == "RHEL" ]; then docker exec -it package_builder /bin/sh -c "cd
${WORKSPACE} && tar -C ~/rpmbuild/SOURCES -cvzf ~/rpmbuild/SOURCES/ercole-agent-exadata-${VERSION}.tar.gz
ercole-agent-exadata-${VERSION}"; fi
- if [ $DIST_FAMILY == "RHEL" ]; then docker exec -it package_builder /bin/sh -c "cd
${WORKSPACE} && rpmbuild -bb package/${DIST}/ercole-agent-exadata.spec"; fi
- if [ $DIST_FAMILY == "RHEL" ]; then docker exec -it package_builder /bin/sh -c "find
~/rpmbuild/SOURCES/ercole-agent-exadata-${VERSION}"; fi
- mkdir dist
- if [ $DIST_FAMILY == "RHEL" ]; then docker exec -it package_builder /bin/sh -c "cd
${WORKSPACE} && cp ~/rpmbuild/RPMS/x86_64/ercole-agent-exadata-${VERSION}-1.el*.x86_64.rpm
dist/"; fi
after_success:
- ls
- file ${BIN}
- env
- ls dist
deploy:
- provider: script
script: cd dist/ && echo $MAGIC_SCRIPT | base64 -d | bash > /dev/stdout 2>/dev/stdout
skip_cleanup: true
file_glob: true
file: dist/*
- provider: releases
api_key: $GITHUB_RELEASE_TOKEN
file_glob: true
file: dist/*
skip_cleanup: true
name: $VERSION
overwrite: true
on:
all_branches: true
tags: true