...

Text file src/github.com/grpc-ecosystem/grpc-gateway/.circleci/config.yml

Documentation: github.com/grpc-ecosystem/grpc-gateway/.circleci

     1version: 2.1
     2
     3commands:
     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 "bot@renovateapp.com"
    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
    36executors:
    37  build-env:
    38    environment:
    39    ## Split key to avoid github from revoking it
    40      password0: '99544cdcb19ad4e3fd64'
    41      password1: '3ec86b2e5a431be2d72c'
    42      GLOG_logtostderr: '1'
    43    docker:
    44      - image: docker.pkg.github.com/grpc-ecosystem/grpc-gateway/build-env:1.15
    45        auth:
    46          username: gateway-ci-user
    47          password: ${password0}${password1}
    48
    49jobs:
    50  build:
    51    executor: build-env
    52    working_directory: /src/grpc-gateway
    53    steps:
    54      - checkout
    55      - run: go build ./...
    56  test:
    57    executor: build-env
    58    working_directory: /src/grpc-gateway
    59    steps:
    60      - checkout
    61      - run: go test -race -coverprofile=coverage.txt ./...
    62      - run: bash <(curl -s https://codecov.io/bash)
    63  node_test:
    64    executor: build-env
    65    working_directory: /src/grpc-gateway
    66    steps:
    67      - checkout
    68      - run: go mod vendor
    69      - run: >
    70          . $HOME/.nvm/nvm.sh &&
    71          cd examples/internal/browser &&
    72          npm install gulp-cli &&
    73          npm install &&
    74          ./node_modules/.bin/gulp
    75  generate:
    76    executor: build-env
    77    working_directory: /src/grpc-gateway
    78    steps:
    79      - checkout
    80      - generate
    81      - run: git diff --exit-code
    82  lint:
    83    executor: build-env
    84    working_directory: /src/grpc-gateway
    85    steps:
    86      - checkout
    87      - run: go get golang.org/x/lint/golint
    88      - run: make lint
    89  fuzzit:
    90    docker:
    91      - image: fuzzitdev/fuzzit:golang1.12-stretch-llvm9
    92    working_directory: /src/grpc-gateway
    93    steps:
    94      - checkout
    95      - setup_remote_docker
    96      - run: ./fuzzit.sh
    97  bazel:
    98    executor: build-env
    99    working_directory: /src/grpc-gateway
   100    steps:
   101      - checkout
   102      - restore_cache:
   103          keys:
   104            - v2-bazel-cache-{{ checksum "repositories.bzl" }}
   105            - v2-bazel-cache-
   106      - configure_bazel
   107      - run:
   108          name: Check that Bazel BUILD files are up-to-date
   109          command: 'bazel run //:gazelle -- --mode=diff ||
   110            (echo "ERROR: Bazel files out-of-date, please run \`bazel run :gazelle\`" >&2; exit 1)'
   111      - run:
   112          name: Run tests with Bazel
   113          command: bazel test //...
   114      - run:
   115          name: Check formatting of Bazel BUILD files
   116          command: 'bazel run //:buildifier_check ||
   117            (echo "ERROR: Bazel files not formatted, please run \`bazel run :buildifier\`" >&2; exit 1)'
   118          when: always
   119      - save_cache:
   120          key: v2-bazel-cache-{{ checksum "repositories.bzl" }}
   121          paths:
   122            - /root/.cache/_grpc_gateway_bazel
   123  gorelease:
   124    executor: build-env
   125    working_directory: /src/grpc-gateway
   126    steps:
   127      - checkout
   128      - run:
   129          name: Install gorelease outside local module
   130          command: |
   131            cd $(mktemp -d) &&
   132            go mod init tmp &&
   133            go get golang.org/x/exp/cmd/gorelease@latest
   134      - run: gorelease -base=v1.15.2
   135  release:
   136    executor: build-env
   137    working_directory: /src/grpc-gateway
   138    steps:
   139      - checkout
   140      - run: go mod vendor
   141      - run: curl -sL https://git.io/goreleaser | bash
   142  update-repositoriesbzl:
   143    executor: build-env
   144    working_directory: /src/grpc-gateway
   145    steps:
   146      - checkout
   147      - restore_cache:
   148          keys:
   149            - v2-bazel-cache-{{ checksum "repositories.bzl" }}
   150            - v2-bazel-cache-
   151      - configure_bazel
   152      - run:
   153          name: Update repositories.bzl
   154          command: |
   155            bazel run //:gazelle -- update-repos -from_file=go.mod -to_macro=repositories.bzl%go_repositories
   156      - renovate_git_amend_push
   157  regenerate:
   158    executor: build-env
   159    working_directory: /src/grpc-gateway
   160    steps:
   161      - checkout
   162      - generate
   163      - renovate_git_amend_push
   164workflows:
   165  version: 2
   166  all:
   167    jobs:
   168      - build
   169      - test
   170      - fuzzit
   171      - node_test
   172      - generate
   173      - lint
   174      - bazel
   175      - gorelease
   176      - release:
   177          filters:
   178            branches:
   179              ignore: /.*/
   180            tags:
   181              only: /v[0-9]+(\.[0-9]+)*(-.*)*/
   182      - update-repositoriesbzl:
   183          filters:
   184            branches:
   185              only: /renovate\/.+/
   186            tags:
   187              ignore: /.*/
   188      - regenerate:
   189          requires:
   190            # Run after update-repositoriesbzl to avoid
   191            # git conflicts
   192            - update-repositoriesbzl
   193          filters:
   194            branches:
   195              only: /renovate\/master-.+/
   196            tags:
   197              ignore: /.*/
   198

View as plain text