Skip to content

Commit 94cc442

Browse files
authored
ci(.github): add a golang integration check (#4888)
A new GitHub Actions workflow is added to verify Golang integration. The workflow installs necessary Go tools and the librarian CLI, checks out the google-cloud-go repository, runs `librarian generate`, and executes vet checks. It also includes a step to automatically create an issue on failure when running on the main branch. This ensures that changes to the librarian CLI do not break the generation process for the Go client libraries.
1 parent a87086e commit 94cc442

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

.github/workflows/golang.yaml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
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

Comments
 (0)