-
Notifications
You must be signed in to change notification settings - Fork 153
/
config.yml
174 lines (166 loc) · 5.62 KB
/
config.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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
version: 2.1
workflows:
pr_acceptance:
jobs:
- test
- build
build_accept_deploy:
jobs:
- test
- build
- package:
requires:
- build
- deploy:
requires:
- test
- build
- package
publish_release:
jobs:
- test:
filters:
branches:
ignore: /.*/
tags:
only: /v[0-9]+(\.[0-9]+)*(-.*)*/
- build:
requires:
- test
filters:
branches:
ignore: /.*/
tags:
only: /v[0-9]+(\.[0-9]+)*(-.*)*/
- package:
requires:
- test
- build
filters:
branches:
ignore: /.*/
tags:
only: /v[0-9]+(\.[0-9]+)*(-.*)*/
- deploy:
requires:
- test
- build
- package
filters:
branches:
ignore: /.*/
tags:
only: /v[0-9]+(\.[0-9]+)*(-.*)*/
- github_binaries:
requires:
- test
- build
- package
- deploy
filters:
branches:
ignore: /.*/
tags:
only: /v[0-9]+(\.[0-9]+)*(-.*)*/
jobs:
test:
working_directory: /home/circleci/go/src/github.com/grafana/carbon-relay-ng
docker:
- image: cimg/go:1.20.3
steps:
- checkout
- run: make test
build:
working_directory: /home/circleci/go/src/github.com/grafana/carbon-relay-ng
docker:
- image: cimg/go:1.20.4
steps:
- checkout
- run: go install github.com/go-bindata/go-bindata/...@latest
- run: make LINUX_PACKAGE_GOARCH=amd64 build-linux
- run: make LINUX_PACKAGE_GOARCH=arm64 build-linux
# note, build-linux runs go-bindata again
# ideally we'd make sure that if go-bindata generated new content, we fail.
# because devs should have run go-bindata and checked in changes already.
# but because git checkout will change the timestamps and mode, it'll generate slight differences, and it's hard to filter those out
# so for now, we just let it slip and assume devs will do a good enough job maintaining the generated data
# - git diff --exit-code
- run: make build-win
- run: make build-darwin
- run: make build-bsd
- persist_to_workspace:
root: .
paths:
- carbon-relay-ng
- carbon-relay-ng.exe
- carbon-relay-ng-darwin
- carbon-relay-ng-linux-amd64
- carbon-relay-ng-linux-arm64
- carbon-relay-ng-bsd
package:
docker:
- image: cimg/ruby:2.5
steps:
- run: sudo apt-get update
- run: sudo apt-get install rpm
- checkout
- attach_workspace:
at: .
- run: gem install fpm
- run: make packages
- setup_remote_docker
- run: make docker
- run: docker save -o build/carbon-relay-ng.tar grafana/carbon-relay-ng
- run: git describe --tags --always | sed 's/^v//' > build/version.txt
- persist_to_workspace:
root: .
paths:
- build
deploy:
docker:
- image: cimg/ruby:2.5
steps:
- setup_remote_docker
- attach_workspace:
at: .
- run: gem install package_cloud
- store_artifacts:
path: build
- store_artifacts:
path: carbon-relay-ng.exe
- store_artifacts:
path: carbon-relay-ng
- deploy:
command: |
if [ "${CIRCLE_BRANCH}" == "master" ]; then
# only versions without a hyphen - e.g. actual releases - go to the main repo.
# in-between-release versions go to testing.
version=$(cat build/version.txt)
repo=raintank/raintank
[[ "$version" == *-* ]] && repo=raintank/testing
# Ubuntu 14.04 (trusty), 16.04 (xenial), debian 8 (jessie), debian 9 (stretch), debian 10 (buster, testing) Centos6 and Centos7.
# (no debian 7 wheezy because that's sysvinit which we don't have packages for)
package_cloud push $repo/ubuntu/trusty build/deb-upstart/carbon-relay-ng-*.deb
package_cloud push $repo/ubuntu/xenial build/deb-systemd/carbon-relay-ng-*.deb
package_cloud push $repo/debian/jessie build/deb-systemd/carbon-relay-ng-*.deb
package_cloud push $repo/debian/stretch build/deb-systemd/carbon-relay-ng-*.deb
package_cloud push $repo/debian/buster build/deb-systemd/carbon-relay-ng-*.deb
package_cloud push $repo/el/6 build/centos-6/carbon-relay-ng-*.el6.*.rpm
package_cloud push $repo/el/7 build/centos-7/carbon-relay-ng-*.el7.*.rpm
docker load -i build/carbon-relay-ng.tar
docker login -u $DOCKER_USER -p $DOCKER_KEY
docker push grafana/carbon-relay-ng:$version
# only versions without a hyphen - e.g. actual releases - are tagged as latest.
# in-between-release versions are tagged as master.
tag=latest
[[ "$version" == *-* ]] && tag=master
docker push grafana/carbon-relay-ng:$tag
fi
github_binaries:
docker:
- image: cimg/go:1.20.4
steps:
- checkout
- run: curl -sfL https://goreleaser.com/static/run | bash
# For dry runs use the following and comment the above
# - run: curl -sfL https://goreleaser.com/static/run | bash -s -- --clean --skip-publish --snapshot