-
Notifications
You must be signed in to change notification settings - Fork 40
chore: add golang workflow #4630
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
Changes from all commits
193dcd5
872cd89
7ef0506
14f3acd
428fd02
e8d9b16
95fbe0e
a3ce166
e35a711
3ee4579
9bb6f03
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| # Copyright 2026 Google LLC | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # https://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| name: Golang | ||
| on: [push, pull_request, merge_group] | ||
| permissions: | ||
| contents: read | ||
| issues: write | ||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-24.04 | ||
| # Presubmit jobs must complete within 5 minutes. See CONTRIBUTING.md. | ||
| timeout-minutes: 5 | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| - uses: actions/setup-go@v6 | ||
| with: | ||
| go-version-file: "go.mod" | ||
| - uses: ./.github/actions/install-protoc | ||
| - name: Install Go dependencies | ||
| run: | | ||
| go install google.golang.org/protobuf/cmd/protoc-gen-go@v${GO_PROTOC_PLUGIN_VERSION} | ||
| go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v${GO_PROTOC_GRPC_PLUGIN_VERSION} | ||
| go install github.com/googleapis/gapic-generator-go/cmd/protoc-gen-go_gapic@v${GO_GAPIC_VERSION} | ||
| go install golang.org/x/tools/cmd/goimports@latest | ||
| env: | ||
| GO_PROTOC_PLUGIN_VERSION: 1.35.2 | ||
| GO_PROTOC_GRPC_PLUGIN_VERSION: 1.3.0 | ||
| GO_GAPIC_VERSION: 0.57.0 | ||
| - name: Run tests | ||
| run: | | ||
| go test -race -coverprofile=coverage.out -covermode=atomic ./internal/librarian/golang | ||
| - name: Upload coverage report | ||
| uses: codecov/codecov-action@v5 | ||
| with: | ||
| token: ${{ secrets.CODECOV_TOKEN }} | ||
| create-issue-on-failure: | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It might make sense to create a .github/workflows/postsubmit.yaml file, so that we can share the same template across languages
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Filed #4631 as a follow up. |
||
| runs-on: ubuntu-24.04 | ||
| needs: [test] | ||
| if: ${{ always() && contains(needs.*.result, 'failure') && github.event_name == 'push' && github.ref == 'refs/heads/main' }} | ||
| steps: | ||
| - name: Create an issue for push event to main | ||
| run: | | ||
| ISSUE_TITLE="all: tests failed at HEAD" | ||
| BODY="Tests failed at HEAD of the \`main\` branch. Please review Workflow Run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} for detail." | ||
| ISSUE_LINK=$(gh issue create --title "$ISSUE_TITLE" --body "$BODY" --label ":rotating_light: critical" --assignee ${{ github.actor }} -R $GH_REPO) | ||
| ISSUE_NUM=${ISSUE_LINK##*/} | ||
| gh issue comment $ISSUE_NUM --body "@googleapis/cloud-sdk-librarian-team A critical issue has been created, please respond immediately." | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| GH_REPO: ${{ github.repository }} | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to install dependencies using
go mod tidysince these dependencies are listed ingo.modbut it didn't work.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use go tool install https://tip.golang.org/doc/go1.24#tools
Also I'm not sure I understand why you need this. The tests run in .github/workflows/librarian.yaml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested that not all unit tests are run in that workflow because some unit tests require toolings installed, e.g., gapic-generator-go.
The golang tests in this workflow runs for 12s while in
librarian.yamlit only needs 2s.