merge main #11634
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Copyright 2024 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: Librarian | |
| on: [push, pull_request, merge_group] | |
| permissions: | |
| contents: read | |
| issues: write | |
| jobs: | |
| go-generate: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: actions/setup-go@v6 | |
| with: | |
| go-version-file: "go.mod" | |
| - uses: ./.github/actions/install-protoc | |
| - name: Install Go tools | |
| run: go install tool | |
| - name: Check go generate | |
| run: | | |
| go generate ./... | |
| if [ -n "$(git status --porcelain)" ]; then | |
| echo "go generate produced diffs:" | |
| git diff | |
| exit 1 | |
| fi | |
| legacylibrarian: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: actions/setup-go@v6 | |
| with: | |
| go-version-file: "go.mod" | |
| - name: Run tests | |
| run: | | |
| go test -race -coverprofile=coverage.out -covermode=atomic ./internal/legacylibrarian/... | |
| - name: Upload coverage report | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| test: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: actions/setup-go@v6 | |
| with: | |
| go-version-file: "go.mod" | |
| - name: Run tests | |
| run: | | |
| go test -race -coverprofile=coverage.out -covermode=atomic \ | |
| $(go list ./... | grep -v -E 'internal/librarian/(python|rust|dart)|internal/sidekick|internal/legacylibrarian') | |
| - name: Upload coverage report | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| create-issue-on-failure: | |
| runs-on: ubuntu-24.04 | |
| needs: [go-generate, legacylibrarian, 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 }} |