|
| 1 | +# Copyright 2026 Google LLC |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# https://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | +name: Golang |
| 15 | +on: [push, pull_request, merge_group] |
| 16 | +permissions: |
| 17 | + contents: read |
| 18 | + issues: write |
| 19 | +jobs: |
| 20 | + integration: |
| 21 | + runs-on: ubuntu-24.04 |
| 22 | + if: github.event_name == 'push' && github.ref == 'refs/heads/main' |
| 23 | + steps: |
| 24 | + - uses: actions/checkout@v6 |
| 25 | + - uses: actions/setup-go@v6 |
| 26 | + with: |
| 27 | + go-version-file: "go.mod" |
| 28 | + - name: Install go tools |
| 29 | + run: | |
| 30 | + go install tool |
| 31 | + # TODO(https://github.com/googleapis/librarian/issues/4894), Use golangci-lint |
| 32 | + # for static checkers and linters. |
| 33 | + # we need to install golint and staticcheck because |
| 34 | + # the vet check uses this tool. |
| 35 | + go install golang.org/x/lint/golint@latest |
| 36 | + go install honnef.co/go/tools/cmd/staticcheck@latest |
| 37 | + - uses: ./.github/actions/install-protoc |
| 38 | + - name: Install librarian |
| 39 | + run: go install ./cmd/librarian |
| 40 | + - name: Checkout google-cloud-go |
| 41 | + uses: actions/checkout@v6 |
| 42 | + with: |
| 43 | + repository: googleapis/google-cloud-go |
| 44 | + path: google-cloud-go |
| 45 | + - name: Run librarian generate |
| 46 | + working-directory: google-cloud-go |
| 47 | + run: librarian generate --all |
| 48 | + # TODO(https://github.com/googleapis/librarian/issues/4895): Standardize static analysi |
| 49 | + # tool across librarian and google-cloud-go. |
| 50 | + # The vet.sh script is a comprehensive CI/CD utility in google-cloud-go that enforces code |
| 51 | + # quality by running static analysis tools. We use this check to validate code generated |
| 52 | + # by librarian. |
| 53 | + - name: Run vet check |
| 54 | + working-directory: google-cloud-go |
| 55 | + run: ./.github/workflows/vet.sh |
| 56 | + create-issue-on-failure: |
| 57 | + needs: [integration] |
| 58 | + if: ${{ always() && contains(needs.*.result, 'failure') && github.event_name == 'push' && github.ref == 'refs/heads/main' }} |
| 59 | + uses: ./.github/workflows/create-issue-on-failure.yaml |
| 60 | + with: |
| 61 | + language: Go |
| 62 | + repository: google-cloud-go |
0 commit comments