github.com/grpc-ecosystem/grpc-gateway/v2@v2.19.1/.github/workflows/ci.yml (about)

     1  on:
     2    - pull_request
     3  permissions:
     4    contents: read
     5  name: CI
     6  jobs:
     7    build:
     8      strategy:
     9        matrix:
    10          go-version: [1.19.x, 1.20.x, 1.21.x]
    11          os: [ubuntu-latest, macos-latest, windows-latest]
    12      runs-on: ${{ matrix.os }}
    13      steps:
    14        - uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5
    15          with:
    16            go-version: ${{ matrix.go-version }}
    17        - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
    18        - run: go build ./...
    19    test:
    20      runs-on: ubuntu-latest
    21      steps:
    22        - uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5
    23          with:
    24            check-latest: true
    25        - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
    26        - run: go test ./...
    27    node_test:
    28      runs-on: ubuntu-latest
    29      steps:
    30        - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
    31        - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4
    32          with:
    33            node-version: 10
    34        - uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5
    35          with:
    36            check-latest: true
    37        - run: >
    38            cd examples/internal/browser &&
    39            npm install gulp-cli &&
    40            npm install &&
    41            ./node_modules/.bin/gulp
    42    generate:
    43      container:
    44        image: docker.pkg.github.com/grpc-ecosystem/grpc-gateway/build-env:1.19
    45        options: "--user root"
    46        credentials:
    47          username: ${{ github.actor }}
    48          password: ${{ secrets.GITHUB_TOKEN }}
    49      runs-on: ubuntu-latest
    50      steps:
    51        - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
    52        - run: make install
    53        - run: make clean
    54        - run: make generate
    55        - run: go mod tidy
    56        - run: git diff --exit-code
    57    bazel:
    58      container:
    59        image: docker.pkg.github.com/grpc-ecosystem/grpc-gateway/build-env:1.19
    60        options: "--user root"
    61        credentials:
    62          username: ${{ github.actor }}
    63          password: ${{ secrets.GITHUB_TOKEN }}
    64      runs-on: ubuntu-latest
    65      steps:
    66        - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
    67        - uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4
    68          with:
    69            path: /home/vscode/.cache/_grpc_gateway_bazel
    70            key: v1-bazel-cache-${{ hashFiles('repositories.bzl') }}
    71            restore-keys: v1-bazel-cache-
    72        - name: Configure bazel
    73          run:
    74            | # put .bazelrc in $HOME so that it's read before project's .bazelrc
    75            cat > /home/vscode/.bazelrc << EOF
    76            startup --output_base=/home/vscode/.cache/_grpc_gateway_bazel
    77            build --@io_bazel_rules_go//go/config:race
    78            # Workaround https://github.com/bazelbuild/bazel/issues/3645
    79            # See https://docs.bazel.build/versions/0.23.0/command-line-reference.html
    80            build --local_ram_resources=7168 # Github runners have 7G of memory
    81            build --local_cpu_resources=2    # Github runners have 2 vCPU
    82            EOF
    83        - name: Check that Bazel BUILD files are up-to-date
    84          run: bazel run //:gazelle && git diff --exit-code
    85        - name: Check that repositories.bzl is up-to-date
    86          run: |
    87            bazel run //:gazelle -- update-repos -from_file=go.mod -to_macro=repositories.bzl%go_repositories &&
    88            git diff --exit-code
    89        - name: Check formatting of Bazel BUILD files
    90          run: bazel run //:buildifier && git diff --exit-code
    91        - name: Run tests with Bazel
    92          run: bazel test //...
    93    gorelease:
    94      runs-on: ubuntu-latest
    95      steps:
    96        - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
    97        - uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5
    98          with:
    99            go-version: 1.19
   100            check-latest: true
   101        - run: go run golang.org/x/exp/cmd/gorelease@latest -base=v2.19.0
   102    proto_lint:
   103      runs-on: ubuntu-latest
   104      steps:
   105        - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
   106        - uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5
   107          with:
   108            check-latest: true
   109        - run: make install
   110        - run: PATH=$PATH:~/go/bin buf build
   111        - run: PATH=$PATH:~/go/bin buf lint
   112        - run: PATH=$PATH:~/go/bin buf format -w && git diff --exit-code
   113        - run: PATH=$PATH:~/go/bin buf breaking --path protoc-gen-openapiv2/ --against 'https://github.com/grpc-ecosystem/grpc-gateway.git#branch=main'
   114    golangci:
   115      permissions:
   116        pull-requests: read # for golangci/golangci-lint-action to fetch pull requests
   117      runs-on: ubuntu-latest
   118      steps:
   119        - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
   120        - uses: golangci/golangci-lint-action@3a919529898de77ec3da873e3063ca4b10e7f5cc # v3
   121          with:
   122            version: v1.54.2
   123    fuzz:
   124      runs-on: ubuntu-latest
   125      steps:
   126        - name: Build Fuzzers
   127          id: build
   128          uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
   129          with:
   130            oss-fuzz-project-name: "grpc-gateway"
   131            dry-run: false
   132            language: go
   133        - name: Run Fuzzers
   134          uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
   135          with:
   136            oss-fuzz-project-name: "grpc-gateway"
   137            fuzz-seconds: 600
   138            dry-run: false
   139            language: go
   140        - name: Upload Crash
   141          uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4
   142          if: failure() && steps.build.outcome == 'success'
   143          with:
   144            name: artifacts
   145            path: ./out/artifacts