Skip to content

Commit 0a91645

Browse files
ci: automate renovate
This was requiring manual intervention and I thought I'd try to update it.
1 parent b885f20 commit 0a91645

File tree

1 file changed

+90
-74
lines changed

1 file changed

+90
-74
lines changed

.circleci/config.yml

Lines changed: 90 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,67 @@
1-
version: 2
2-
jobs:
3-
build:
1+
version: 2.1
2+
3+
commands:
4+
configure_bazel:
5+
description: Create Bazel config file (.bazelrc)
6+
steps:
7+
- run: |
8+
cat > .bazelrc \<< EOF
9+
startup --output_base /root/.cache/_grpc_gateway_bazel
10+
build --test_output errors
11+
build --features race
12+
# Workaround https://github.com/bazelbuild/bazel/issues/3645
13+
# See https://docs.bazel.build/versions/0.23.0/command-line-reference.html
14+
build --local_ram_resources=4096 # Circle Docker runners have 4G of memory
15+
build --local_cpu_resources=2 # Circle Docker runners have 2 vCPU
16+
EOF
17+
generate:
18+
steps:
19+
- run: make realclean
20+
- run: make examples
21+
- run: make testproto
22+
- run: go mod tidy
23+
renovate_git_amend_push:
24+
description: Git amend and push changes
25+
steps:
26+
- run: |
27+
git add .
28+
if output=$(git status --porcelain) && [ ! -z "$output" ]; then
29+
git config user.name "Renovate Bot"
30+
git config user.email "[email protected]"
31+
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/grpc-ecosystem/grpc-gateway.git
32+
git commit --amend --no-edit
33+
git push --force-with-lease origin ${CIRCLE_BRANCH}
34+
fi
35+
36+
executors:
37+
build-env:
438
environment:
539
## Split key to avoid github from revoking it
640
password0: '99544cdcb19ad4e3fd64'
741
password1: '3ec86b2e5a431be2d72c'
42+
GLOG_logtostderr: '1'
843
docker:
944
- image: docker.pkg.github.com/grpc-ecosystem/grpc-gateway/build-env:1.14
1045
auth:
1146
username: gateway-ci-user
1247
password: ${password0}${password1}
48+
49+
jobs:
50+
build:
51+
executor: build-env
1352
working_directory: /src/grpc-gateway
1453
steps:
1554
- checkout
1655
- run: go build ./...
1756
test:
18-
environment:
19-
## Split key to avoid github from revoking it
20-
password0: '99544cdcb19ad4e3fd64'
21-
password1: '3ec86b2e5a431be2d72c'
22-
GLOG_logtostderr: '1'
23-
docker:
24-
- image: docker.pkg.github.com/grpc-ecosystem/grpc-gateway/build-env:1.14
25-
auth:
26-
username: gateway-ci-user
27-
password: ${password0}${password1}
57+
executor: build-env
2858
working_directory: /src/grpc-gateway
2959
steps:
3060
- checkout
3161
- run: go test -race -coverprofile=coverage.txt ./...
3262
- run: bash <(curl -s https://codecov.io/bash)
3363
node_test:
34-
environment:
35-
## Split key to avoid github from revoking it
36-
password0: '99544cdcb19ad4e3fd64'
37-
password1: '3ec86b2e5a431be2d72c'
38-
docker:
39-
- image: docker.pkg.github.com/grpc-ecosystem/grpc-gateway/build-env:1.14
40-
auth:
41-
username: gateway-ci-user
42-
password: ${password0}${password1}
64+
executor: build-env
4365
working_directory: /src/grpc-gateway
4466
steps:
4567
- checkout
@@ -51,33 +73,14 @@ jobs:
5173
npm install &&
5274
./node_modules/.bin/gulp
5375
generate:
54-
environment:
55-
## Split key to avoid github from revoking it
56-
password0: '99544cdcb19ad4e3fd64'
57-
password1: '3ec86b2e5a431be2d72c'
58-
docker:
59-
- image: docker.pkg.github.com/grpc-ecosystem/grpc-gateway/build-env:1.14
60-
auth:
61-
username: gateway-ci-user
62-
password: ${password0}${password1}
76+
executor: build-env
6377
working_directory: /src/grpc-gateway
6478
steps:
6579
- checkout
66-
- run: make realclean
67-
- run: make examples
68-
- run: make testproto
69-
- run: go mod tidy
80+
- generate
7081
- run: git diff --exit-code
7182
lint:
72-
environment:
73-
## Split key to avoid github from revoking it
74-
password0: '99544cdcb19ad4e3fd64'
75-
password1: '3ec86b2e5a431be2d72c'
76-
docker:
77-
- image: docker.pkg.github.com/grpc-ecosystem/grpc-gateway/build-env:1.14
78-
auth:
79-
username: gateway-ci-user
80-
password: ${password0}${password1}
83+
executor: build-env
8184
working_directory: /src/grpc-gateway
8285
steps:
8386
- checkout
@@ -101,18 +104,7 @@ jobs:
101104
keys:
102105
- v2-bazel-cache-{{ checksum "repositories.bzl" }}
103106
- v2-bazel-cache-
104-
- run:
105-
name: Create Bazel config file (.bazelrc)
106-
command: |
107-
cat > .bazelrc << EOF
108-
startup --output_base /root/.cache/_grpc_gateway_bazel
109-
build --test_output errors
110-
build --features race
111-
# Workaround https://github.com/bazelbuild/bazel/issues/3645
112-
# See https://docs.bazel.build/versions/0.23.0/command-line-reference.html
113-
build --local_ram_resources=3072
114-
build --local_cpu_resources=1
115-
EOF
107+
- configure_bazel
116108
- run:
117109
name: Check that Bazel BUILD files are up-to-date
118110
command: 'bazel run //:gazelle -- --mode=diff ||
@@ -130,15 +122,7 @@ jobs:
130122
paths:
131123
- /root/.cache/_grpc_gateway_bazel
132124
gorelease:
133-
environment:
134-
## Split key to avoid github from revoking it
135-
password0: '99544cdcb19ad4e3fd64'
136-
password1: '3ec86b2e5a431be2d72c'
137-
docker:
138-
- image: docker.pkg.github.com/grpc-ecosystem/grpc-gateway/build-env:1.14
139-
auth:
140-
username: gateway-ci-user
141-
password: ${password0}${password1}
125+
executor: build-env
142126
working_directory: /src/grpc-gateway
143127
steps:
144128
- checkout
@@ -150,20 +134,35 @@ jobs:
150134
go get golang.org/x/exp/cmd/gorelease@latest
151135
- run: gorelease
152136
release:
153-
environment:
154-
## Split key to avoid github from revoking it
155-
password0: '99544cdcb19ad4e3fd64'
156-
password1: '3ec86b2e5a431be2d72c'
157-
docker:
158-
- image: docker.pkg.github.com/grpc-ecosystem/grpc-gateway/build-env:1.14
159-
auth:
160-
username: gateway-ci-user
161-
password: ${password0}${password1}
137+
executor: build-env
162138
working_directory: /src/grpc-gateway
163139
steps:
164140
- checkout
165141
- run: go mod vendor
166142
- run: curl -sL https://git.io/goreleaser | bash
143+
update-repositoriesbzl:
144+
docker:
145+
- image: l.gcr.io/google/bazel:latest
146+
working_directory: /src/grpc-gateway
147+
steps:
148+
- checkout
149+
- restore_cache:
150+
keys:
151+
- v2-bazel-cache-{{ checksum "repositories.bzl" }}
152+
- v2-bazel-cache-
153+
- configure_bazel
154+
- run:
155+
name: Update repositories.bzl
156+
command: |
157+
bazel run //:gazelle -- update-repos -from_file=go.mod -to_macro=repositories.bzl%go_repositories
158+
- renovate_git_amend_push
159+
regenerate:
160+
executor: build-env
161+
working_directory: /src/grpc-gateway
162+
steps:
163+
- checkout
164+
- generate
165+
- renovate_git_amend_push
167166
workflows:
168167
version: 2
169168
all:
@@ -182,3 +181,20 @@ workflows:
182181
ignore: /.*/
183182
tags:
184183
only: /v[0-9]+(\.[0-9]+)*(-.*)*/
184+
- update-repositoriesbzl:
185+
filters:
186+
branches:
187+
only: /renovate\/.+/
188+
tags:
189+
ignore: /.*/
190+
- regenerate:
191+
requires:
192+
# Run after update-repositoriesbzl to avoid
193+
# git conflicts
194+
- update-repositoriesbzl
195+
filters:
196+
branches:
197+
only: /renovate\/master-.+/
198+
tags:
199+
ignore: /.*/
200+

0 commit comments

Comments
 (0)