Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automate more updates #1410

Merged
merged 4 commits into from
May 27, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
168 changes: 69 additions & 99 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,40 @@
version: 2
jobs:
build:
version: 2.1

commands:
configure_bazel:
description: Create Bazel config file (.bazelrc)
steps:
- run: |
cat > .bazelrc \<< EOF
startup --output_base /root/.cache/_grpc_gateway_bazel
build --test_output errors
build --features race
# Workaround https://github.com/bazelbuild/bazel/issues/3645
# See https://docs.bazel.build/versions/0.23.0/command-line-reference.html
build --local_ram_resources=4096 # Circle Docker runners have 4G of memory
build --local_cpu_resources=2 # Circle Docker runners have 2 vCPU
EOF
generate:
steps:
- run: make realclean
- run: make examples
- run: make testproto
- run: go mod tidy
renovate_git_amend_push:
description: Git amend and push changes
steps:
- run: |
git add .
if output=$(git status --porcelain) && [ ! -z "$output" ]; then
git config user.name "Renovate Bot"
git config user.email "[email protected]"
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/grpc-ecosystem/grpc-gateway.git
git commit --amend --no-edit
git push --force-with-lease origin ${CIRCLE_BRANCH}
fi

executors:
build-env:
environment:
## Split key to avoid github revoking it
password0: '99544cdcb19ad4e3fd64'
Expand All @@ -10,36 +44,23 @@ jobs:
auth:
username: gateway-ci-user
password: ${password0}${password1}

jobs:
build:
executor: build-env
working_directory: /src/grpc-gateway
steps:
- checkout
- run: go build ./...
test:
environment:
## Split key to avoid github revoking it
password0: '99544cdcb19ad4e3fd64'
password1: '3ec86b2e5a431be2d72c'
GLOG_logtostderr: '1'
docker:
- image: docker.pkg.github.com/grpc-ecosystem/grpc-gateway/build-env:1.14
auth:
username: gateway-ci-user
password: ${password0}${password1}
executor: build-env
working_directory: /src/grpc-gateway
steps:
- checkout
- run: go test -race -coverprofile=coverage.txt ./...
- run: bash <(curl -s https://codecov.io/bash)
node_test:
environment:
## Split key to avoid github revoking it
password0: '99544cdcb19ad4e3fd64'
password1: '3ec86b2e5a431be2d72c'
docker:
- image: docker.pkg.github.com/grpc-ecosystem/grpc-gateway/build-env:1.14
auth:
username: gateway-ci-user
password: ${password0}${password1}
executor: build-env
working_directory: /src/grpc-gateway
steps:
- checkout
Expand All @@ -51,33 +72,14 @@ jobs:
npm install &&
./node_modules/.bin/gulp
generate:
environment:
## Split key to avoid github revoking it
password0: '99544cdcb19ad4e3fd64'
password1: '3ec86b2e5a431be2d72c'
docker:
- image: docker.pkg.github.com/grpc-ecosystem/grpc-gateway/build-env:1.14
auth:
username: gateway-ci-user
password: ${password0}${password1}
executor: build-env
working_directory: /src/grpc-gateway
steps:
- checkout
- run: make realclean
- run: make examples
- run: make testproto
- run: go mod tidy
- generate
- run: git diff --exit-code
lint:
environment:
## Split key to avoid github revoking it
password0: '99544cdcb19ad4e3fd64'
password1: '3ec86b2e5a431be2d72c'
docker:
- image: docker.pkg.github.com/grpc-ecosystem/grpc-gateway/build-env:1.14
auth:
username: gateway-ci-user
password: ${password0}${password1}
executor: build-env
working_directory: /src/grpc-gateway
steps:
- checkout
Expand All @@ -101,18 +103,7 @@ jobs:
keys:
- v2-bazel-cache-{{ checksum "repositories.bzl" }}
- v2-bazel-cache-
- run:
name: Create Bazel config file (.bazelrc)
command: |
cat > .bazelrc << EOF
startup --output_base /root/.cache/_grpc_gateway_bazel
build --test_output errors
build --features race
# Workaround https://github.com/bazelbuild/bazel/issues/3645
# See https://docs.bazel.build/versions/0.23.0/command-line-reference.html
build --local_ram_resources=4096 # Circle Docker runners have 4G of memory
build --local_cpu_resources=2 # Circle Docker runners have 2 vCPU
EOF
- configure_bazel
- run:
name: Check that Bazel BUILD files are up-to-date
command: |
Expand All @@ -136,15 +127,7 @@ jobs:
paths:
- /root/.cache/_grpc_gateway_bazel
gorelease:
environment:
## Split key to avoid github revoking it
password0: '99544cdcb19ad4e3fd64'
password1: '3ec86b2e5a431be2d72c'
docker:
- image: docker.pkg.github.com/grpc-ecosystem/grpc-gateway/build-env:1.14
auth:
username: gateway-ci-user
password: ${password0}${password1}
executor: build-env
working_directory: /src/grpc-gateway
steps:
- checkout
Expand All @@ -156,15 +139,7 @@ jobs:
go get golang.org/x/exp/cmd/gorelease@latest
- run: gorelease -base=v2.0.0-alpha.2
release:
environment:
## Split key to avoid github revoking it
password0: '99544cdcb19ad4e3fd64'
password1: '3ec86b2e5a431be2d72c'
docker:
- image: docker.pkg.github.com/grpc-ecosystem/grpc-gateway/build-env:1.14
auth:
username: gateway-ci-user
password: ${password0}${password1}
executor: build-env
working_directory: /src/grpc-gateway
steps:
- checkout
Expand All @@ -180,34 +155,19 @@ jobs:
keys:
- v2-bazel-cache-{{ checksum "repositories.bzl" }}
- v2-bazel-cache-
- run:
name: Create Bazel config file (.bazelrc)
command: |
cat > .bazelrc << EOF
startup --output_base /root/.cache/_grpc_gateway_bazel
# Workaround https://github.com/bazelbuild/bazel/issues/3645
# See https://docs.bazel.build/versions/0.23.0/command-line-reference.html
build --local_ram_resources=4096 # Circle Docker runners have 4G of memory
build --local_cpu_resources=2 # Circle Docker runners have 2 vCPU
EOF
- configure_bazel
- run:
name: Update repositories.bzl
command: |
bazel run //:gazelle -- update-repos -from_file=go.mod -to_macro=repositories.bzl%go_repositories
- run:
name: Configure git
command: |
git config user.name "Renovate Bot"
git config user.email "[email protected]"
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/grpc-ecosystem/grpc-gateway.git
- run:
name: Git amend and push changes
command: |
git add .
if output=$(git status --porcelain) && [ ! -z "$output" ]; then
git commit --amend --no-edit
git push --force-with-lease origin ${CIRCLE_BRANCH}
fi
- renovate_git_amend_push
regenerate:
executor: build-env
working_directory: /src/grpc-gateway
steps:
- checkout
- generate
- renovate_git_amend_push
workflows:
version: 2
all:
Expand All @@ -229,7 +189,17 @@ workflows:
- update-repositoriesbzl:
filters:
branches:
only: /renovate\/.+/
only: /renovate\/v2-.+/
tags:
ignore: /.*/
- regenerate:
requires:
# Run after update-repositoriesbzl to avoid
# git conflicts
- update-repositoriesbzl
filters:
branches:
only: /renovate\/v2-.+/
tags:
ignore: /.*/