This repository has been archived by the owner on Feb 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.travis.yml
160 lines (159 loc) · 12 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
sudo: false
language: go
#go_import_path: github.com/TeaWeb/code/teaweb
env: GO111MODULE=on CGO_ENABLED=0
go: 1.14.x
os: linux
install:
- go mod download
script:
- go generate -x ./... && git diff --exit-code; code=$?; git checkout -- .; (exit $code) # Check that go generate ./... produces a zero diff; clean up any changes afterwards.
# - go vet ./...
# - go test -v -race -coverprofile=coverage.txt -covermode=atomic ./...
# - go test -v -tags=integration -run=^$ ./test/integration # Check that integration test builds successfully, but don't run any of the tests (they hit live GitHub API).
- curl -s "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-City&license_key=${MAXMIND_LICENSE_KEY}&suffix=tar.gz" -o GeoLite2-City.tar.gz
- tar -xzf GeoLite2-City.tar.gz
- find . -name '*.mmdb' -exec mv {} ./web/resources/GeoLite2-City/ \;
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then go build -o core -ldflags '-s -w' misc/exe/teaweb/main.go ; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then go build -o agent -ldflags '-s -w' misc/exe/pluginsAgent/main.go ; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then go build -o core-agent -ldflags '-s -w' misc/exe/agent/main.go ; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then go build -o agentinstaller -ldflags '-s -w' misc/exe/agentinstaller/main.go ; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then go build -o service_install -ldflags '-s -w' misc/exe/service_install/main.go ; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then go build -o service_uninstall -ldflags '-s -w' misc/exe/service_uninstall/main.go ; fi
after_success:
- bash <(curl -s https://codecov.io/bash)
before_deploy:
- curl -s "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-City&license_key=${MAXMIND_LICENSE_KEY}&suffix=tar.gz" -o GeoLite2-City.tar.gz
- tar -xzf GeoLite2-City.tar.gz
- find . -name '*.mmdb' -exec mv {} ./web/resources/GeoLite2-City/ \;
- mkdir -p releases/{bin,plugins}
- cp -R ./{configs,scripts,web,www,logs,upgrade.sh} releases/
- cp configs/admin.sample.conf releases/configs/admin.conf
- cp configs/server.sample.conf releases/configs/server.conf
- cp configs/mongo.sample.conf releases/configs/mongo.conf
- cp configs/mysql.sample.conf releases/configs/mysql.conf
- cp configs/postgres.sample.conf releases/configs/postgres.conf
- cp configs/server.sample.www.proxy.conf releases/configs/server.www.proxy.conf
- cp -R configs/widgets releases/web/libs/
- mkdir releases/web/tmp
- touch releases/web/tmp/.keep
- GOOS=windows GOARCH=amd64 go build -o releases/upgrades/windows/amd64/teaweb-agent.exe -ldflags '-s -w' misc/exe/agent/main.go
- GOOS=windows GOARCH=386 go build -o releases/upgrades/windows/386/teaweb-agent.exe -ldflags '-s -w' misc/exe/agent/main.go
- GOOS=darwin GOARCH=amd64 go build -o releases/upgrades/darwin/amd64/teaweb-agent -ldflags '-s -w' misc/exe/agent/main.go
- GOOS=darwin GOARCH=386 go build -o releases/upgrades/darwin/386/teaweb-agent -ldflags '-s -w' misc/exe/agent/main.go
- GOOS=linux GOARCH=amd64 go build -o releases/upgrades/linux/amd64/teaweb-agent -ldflags '-s -w' misc/exe/agent/main.go
- GOOS=linux GOARCH=386 go build -o releases/upgrades/linux/386/teaweb-agent -ldflags '-s -w' misc/exe/agent/main.go
- GOOS=linux GOARCH=arm64 go build -o releases/upgrades/linux/arm64/teaweb-agent -ldflags '-s -w' misc/exe/agent/main.go
- GOOS=linux GOARCH=arm go build -o releases/upgrades/linux/arm/teaweb-agent -ldflags '-s -w' misc/exe/agent/main.go
- GOOS=linux GOARCH=mips64 go build -o releases/upgrades/linux/mips64/teaweb-agent -ldflags '-s -w' misc/exe/agent/main.go
- GOOS=linux GOARCH=mips64le go build -o releases/upgrades/linux/mips64le/teaweb-agent -ldflags '-s -w' misc/exe/agent/main.go
- GOOS=linux GOARCH=mips GOMIPS=softfloat go build -o releases/upgrades/linux/mips/teaweb-agent -ldflags '-s -w' misc/exe/agent/main.go
- GOOS=linux GOARCH=mipsle GOMIPS=softfloat go build -o releases/upgrades/linux/mipsle/teaweb-agent -ldflags '-s -w' misc/exe/agent/main.go
- GOOS=freebsd GOARCH=386 go build -o releases/upgrades/freebsd/386/teaweb-agent -ldflags '-s -w' misc/exe/agent/main.go
- GOOS=freebsd GOARCH=amd64 go build -o releases/upgrades/freebsd/amd64/teaweb-agent -ldflags '-s -w' misc/exe/agent/main.go
- chmod -R 755 releases/upgrades
- GOOS=windows GOARCH=amd64 go build -o releases/installers/agentinstaller_windows_amd64.exe -ldflags '-s -w' misc/exe/agentinstaller/main.go
- GOOS=windows GOARCH=386 go build -o releases/installers/agentinstaller_windows_386.exe -ldflags '-s -w' misc/exe/agentinstaller/main.go
- GOOS=darwin GOARCH=amd64 go build -o releases/installers/agentinstaller_darwin_amd64 -ldflags '-s -w' misc/exe/agentinstaller/main.go
- GOOS=darwin GOARCH=386 go build -o releases/installers/agentinstaller_darwin_386 -ldflags '-s -w' misc/exe/agentinstaller/main.go
- GOOS=linux GOARCH=amd64 go build -o releases/installers/agentinstaller_linux_amd64 -ldflags '-s -w' misc/exe/agentinstaller/main.go
- GOOS=linux GOARCH=386 go build -o releases/installers/agentinstaller_linux_386 -ldflags '-s -w' misc/exe/agentinstaller/main.go
- GOOS=linux GOARCH=arm64 go build -o releases/installers/agentinstaller_linux_arm64 -ldflags '-s -w' misc/exe/agentinstaller/main.go
- GOOS=linux GOARCH=arm go build -o releases/installers/agentinstaller_linux_arm -ldflags '-s -w' misc/exe/agentinstaller/main.go
- GOOS=linux GOARCH=mips64 go build -o releases/installers/agentinstaller_linux_mips64 -ldflags '-s -w' misc/exe/agentinstaller/main.go
- GOOS=linux GOARCH=mips64le go build -o releases/installers/agentinstaller_linux_mips64le -ldflags '-s -w' misc/exe/agentinstaller/main.go
- GOOS=linux GOARCH=mips GOMIPS=softfloat go build -o releases/installers/agentinstaller_linux_mips -ldflags '-s -w' misc/exe/agentinstaller/main.go
- GOOS=linux GOARCH=mipsle GOMIPS=softfloat go build -o releases/installers/agentinstaller_linux_mipsle -ldflags '-s -w' misc/exe/agentinstaller/main.go
- GOOS=freebsd GOARCH=386 go build -o releases/installers/agentinstaller_linux_386 -ldflags '-s -w' misc/exe/agentinstaller/main.go
- GOOS=freebsd GOARCH=amd64 go build -o releases/installers/agentinstaller_linux_amd64 -ldflags '-s -w' misc/exe/agentinstaller/main.go
- chmod -R 755 releases/installers
- GOOS=windows GOARCH=amd64 go build -o releases/bin/teaweb.exe -ldflags '-s -w' misc/exe/teaweb/main.go
- GOOS=windows GOARCH=amd64 go build -o releases/bin/service_install.exe -ldflags '-s -w' misc/exe/service_install/main.go
- GOOS=windows GOARCH=amd64 go build -o releases/bin/service_uninstall.exe -ldflags '-s -w' misc/exe/service_uninstall/main.go
- GOOS=windows GOARCH=amd64 go build -o releases/plugins/agent.tea.exe -ldflags '-s -w' misc/exe/pluginsAgent/main.go
- zip -9qr teaweb-windows-amd64.zip releases/
- GOOS=windows GOARCH=386 go build -o releases/bin/teaweb.exe -ldflags '-s -w' misc/exe/teaweb/main.go
- GOOS=windows GOARCH=386 go build -o releases/bin/service_install.exe -ldflags '-s -w' misc/exe/service_install/main.go
- GOOS=windows GOARCH=386 go build -o releases/bin/service_uninstall.exe -ldflags '-s -w' misc/exe/service_uninstall/main.go
- GOOS=windows GOARCH=386 go build -o releases/plugins/agent.tea.exe -ldflags '-s -w' misc/exe/pluginsAgent/main.go
- zip -9qr teaweb-windows-386.zip releases/
- rm releases/bin/teaweb.exe
- rm releases/bin/service_install.exe
- rm releases/bin/service_uninstall.exe
- rm releases/plugins/agent.tea.exe
- GOOS=darwin GOARCH=amd64 go build -o releases/bin/teaweb -ldflags '-s -w' misc/exe/teaweb/main.go
- GOOS=darwin GOARCH=amd64 go build -o releases/plugins/agent.tea -ldflags '-s -w' misc/exe/pluginsAgent/main.go
- chmod 755 releases/plugins/agent.tea
- chmod 755 releases/bin/teaweb
- zip -9qr teaweb-darwin-amd64.zip releases/
- GOOS=darwin GOARCH=386 go build -o releases/bin/teaweb -ldflags '-s -w' misc/exe/teaweb/main.go
- GOOS=darwin GOARCH=386 go build -o releases/plugins/agent.tea -ldflags '-s -w' misc/exe/pluginsAgent/main.go
- zip -9qr teaweb-darwin-386.zip releases/
- GOOS=freebsd GOARCH=386 go build -o releases/bin/teaweb -ldflags '-s -w' misc/exe/teaweb/main.go
- GOOS=freebsd GOARCH=386 go build -o releases/plugins/agent.tea -ldflags '-s -w' misc/exe/pluginsAgent/main.go
- zip -9qr teaweb-freebsd-386.zip releases/
- GOOS=freebsd GOARCH=amd64 go build -o releases/bin/teaweb -ldflags '-s -w' misc/exe/teaweb/main.go
- GOOS=freebsd GOARCH=amd64 go build -o releases/plugins/agent.tea -ldflags '-s -w' misc/exe/pluginsAgent/main.go
- zip -9qr teaweb-freebsd-amd64.zip releases/
- GOOS=linux GOARCH=mips64 go build -o releases/bin/teaweb -ldflags '-s -w' misc/exe/teaweb/main.go
- GOOS=linux GOARCH=mips64 go build -o releases/plugins/agent.tea -ldflags '-s -w' misc/exe/pluginsAgent/main.go
- zip -9qr teaweb-linux-mips64.zip releases/
- GOOS=linux GOARCH=mips64le go build -o releases/bin/teaweb -ldflags '-s -w' misc/exe/teaweb/main.go
- GOOS=linux GOARCH=mips64le go build -o releases/plugins/agent.tea -ldflags '-s -w' misc/exe/pluginsAgent/main.go
- zip -9qr teaweb-linux-mips64le.zip releases/
- GOOS=linux GOARCH=mips GOMIPS=softfloat go build -o releases/bin/teaweb -ldflags '-s -w' misc/exe/teaweb/main.go
- GOOS=linux GOARCH=mips GOMIPS=softfloat go build -o releases/plugins/agent.tea -ldflags '-s -w' misc/exe/pluginsAgent/main.go
- zip -9qr teaweb-linux-mips.zip releases/
- GOOS=linux GOARCH=mipsle GOMIPS=softfloat go build -o releases/bin/teaweb -ldflags '-s -w' misc/exe/teaweb/main.go
- GOOS=linux GOARCH=mipsle GOMIPS=softfloat go build -o releases/plugins/agent.tea -ldflags '-s -w' misc/exe/pluginsAgent/main.go
- zip -9qr teaweb-linux-mipsle.zip releases/
- GOOS=linux GOARCH=arm go build -o releases/bin/teaweb -ldflags '-s -w' misc/exe/teaweb/main.go
- GOOS=linux GOARCH=arm go build -o releases/plugins/agent.tea -ldflags '-s -w' misc/exe/pluginsAgent/main.go
- zip -9qr teaweb-linux-arm.zip releases/
- GOOS=linux GOARCH=arm64 go build -o releases/bin/teaweb -ldflags '-s -w' misc/exe/teaweb/main.go
- GOOS=linux GOARCH=arm64 go build -o releases/plugins/agent.tea -ldflags '-s -w' misc/exe/pluginsAgent/main.go
- zip -9qr teaweb-linux-arm64.zip releases/
- GOOS=linux GOARCH=386 go build -o releases/bin/teaweb -ldflags '-s -w' misc/exe/teaweb/main.go
- GOOS=linux GOARCH=386 go build -o releases/bin/service_install -ldflags '-s -w' misc/exe/service_install/main.go
- GOOS=linux GOARCH=386 go build -o releases/bin/service_uninstall -ldflags '-s -w' misc/exe/service_uninstall/main.go
- GOOS=linux GOARCH=386 go build -o releases/plugins/agent.tea -ldflags '-s -w' misc/exe/pluginsAgent/main.go
- zip -9qr teaweb-linux-386.zip releases/
- GOOS=linux GOARCH=amd64 go build -o releases/bin/teaweb -ldflags '-s -w' misc/exe/teaweb/main.go
- GOOS=linux GOARCH=amd64 go build -o releases/bin/service_install -ldflags '-s -w' misc/exe/service_install/main.go
- GOOS=linux GOARCH=amd64 go build -o releases/bin/service_uninstall -ldflags '-s -w' misc/exe/service_uninstall/main.go
- GOOS=linux GOARCH=amd64 go build -o releases/plugins/agent.tea -ldflags '-s -w' misc/exe/pluginsAgent/main.go
- zip -9r teaweb-linux-amd64.zip releases/
- sed -i "s/CI_TAG/${TRAVIS_TAG}/g" Dockerfile
- rm releases/bin/service_install
- rm releases/bin/service_uninstall
- docker build -t tossp/teaweb:${TRAVIS_TAG} .
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
- docker tag tossp/teaweb:${TRAVIS_TAG} tossp/teaweb:latest
- docker push tossp/teaweb
deploy:
provider: releases
api_key: $CI_USER_TOKEN
skip_cleanup: true
file:
- teaweb-linux-arm64.zip
- teaweb-linux-arm.zip
- teaweb-linux-386.zip
- teaweb-linux-amd64.zip
- teaweb-linux-mips64.zip
- teaweb-linux-mips64le.zip
- teaweb-linux-mips.zip
- teaweb-linux-mipsle.zip
- teaweb-darwin-amd64.zip
- teaweb-darwin-386.zip
- teaweb-windows-amd64.zip
- teaweb-windows-386.zip
- teaweb-freebsd-amd64.zip
- teaweb-freebsd-386.zip
on:
tags: true
all_branches: true
condition: $TRAVIS_OS_NAME=linux
services:
- docker
- mongodb
- mysql