feat: split doc.go generation into comments and code portions (#1579) #4937
This file contains 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
--- | |
name: Generator tests | |
on: | |
push: | |
branches: | |
- main | |
- diregapic-dev-branch | |
pull_request: | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version-file: 'go.mod' | |
- name: Check formatting | |
run: gofmt -l ./ > gofmt.txt && ! [ -s gofmt.txt ] | |
- name: Install golint | |
run: go install golang.org/x/lint/golint@latest | |
if: ${{ always() }} | |
- name: Staticcheck | |
uses: dominikh/[email protected] | |
- name: Lint | |
# Exclude all of the grpc_service_config package (it is generated). | |
run: golint -set_exit_status $(go list ./... | grep -v 'grpc_service_config') > golint.txt | |
if: ${{ always() }} | |
- name: Vet | |
# The mod download is there to prevent go vet from logging mod downloads | |
# which would mess up the empty vetting results check. | |
# Exclude all of the grpc_service_config package (it is generated). | |
run: go mod download && go vet $(go list ./... | grep -v 'grpc_service_config') > govet.txt && ! [ -s govet.txt ] | |
if: ${{ always() }} | |
- uses: actions/upload-artifact@v4 | |
if: ${{ always() }} | |
with: | |
name: linting-results | |
path: | | |
gofmt.txt | |
golint.txt | |
govet.txt | |
unit-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version-file: 'go.mod' | |
- run: go test ./... | |
integration-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version-file: 'go.mod' | |
- name: Install protoc | |
run: | | |
sudo mkdir -p /usr/src/protoc/ | |
sudo chown -R ${USER} /usr/src/ | |
curl --location https://github.com/google/protobuf/releases/download/v3.17.3/protoc-3.17.3-linux-x86_64.zip --output /usr/src/protoc/protoc-3.17.3.zip | |
cd /usr/src/protoc/ | |
unzip protoc-3.17.3.zip | |
sudo ln -s /usr/src/protoc/bin/protoc /usr/local/bin/protoc | |
- name: Install tools and dependencies | |
run: | | |
go install golang.org/x/exp/cmd/apidiff@latest | |
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest | |
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest | |
curl -sSL https://github.com/googleapis/googleapis/archive/master.zip > googleapis.zip | |
unzip googleapis.zip -x "googleapis-master/google/ads/*" | |
mv googleapis-master /tmp/googleapis | |
- name: Create Go package API baseline | |
if: "!contains(github.event.pull_request.labels.*.name, 'breaking change allowed')" | |
run: | | |
cd showcase | |
apidiff -w pkg.latest github.com/googleapis/gapic-showcase/client | |
- name: Run integration tests | |
run: | | |
export PATH=$PATH:protobuf/bin | |
export GOOGLEAPIS=/tmp/googleapis | |
make test | |
- name: Compare regenerated code to baseline | |
if: "!contains(github.event.pull_request.labels.*.name, 'breaking change allowed')" | |
run: | | |
cd showcase | |
apidiff -incompatible pkg.latest github.com/googleapis/gapic-showcase/client > diff.txt && cat diff.txt && ! [ -s diff.txt ] | |
bazel-build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: bazel-contrib/[email protected] | |
with: | |
# Avoid downloading Bazel every time. | |
bazelisk-cache: true | |
# Store build cache per workflow. | |
disk-cache: ${{ github.workflow }} | |
# Share repository cache between workflows. | |
repository-cache: true | |
- run: bazelisk test '//...' |