Simplify CI

This commit is contained in:
Fangliding
2026-10-28 00:36:54 +08:00
parent f45f546654
commit a1be7c52f3
2 changed files with 59 additions and 52 deletions
+3 -37
View File
@@ -35,43 +35,7 @@ jobs:
if: steps.check-assets.outputs.missing == 'true'
run: sleep 90
check-proto:
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
steps:
- name: Checkout codebase
uses: actions/checkout@v7
- name: Set up Go
uses: actions/setup-go@v7
with:
go-version-file: go.mod
- name: Cache protoc
id: cache-protoc
uses: actions/cache@v6
with:
path: ${{ runner.temp }}/protoc
key: protoc-linux-x86_64-33.5
- name: Download protoc
if: steps.cache-protoc.outputs.cache-hit != 'true'
working-directory: ${{ runner.temp }}
run: |
curl -fsSL --retry 3 -o protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v33.5/protoc-33.5-linux-x86_64.zip
unzip -q protoc.zip -d protoc
- name: Install pinned protobuf tools
run: |
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.36.11
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.6.0
- name: Check generated protobuf files
run: |
export PATH="$RUNNER_TEMP/protoc/bin:$PATH"
# Remove old outputs so orphaned pb files are also detected.
git ls-files -z -- '*.pb.go' | xargs -0 -r rm --
go run ./infra/vprotogen
# Include newly generated files in the diff without committing.
git add --intent-to-add --force -- '*.pb.go'
git diff --exit-code HEAD -- '*.pb.go'
check-format:
check-format-and-proto:
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
permissions:
@@ -87,6 +51,8 @@ jobs:
cache: false
- name: Check Format
run: go run ./infra/vformat/main.go -mode check -pwd ./
- name: Check Protobuf
run: go run ./infra/vprotogen/main.go -mode check -pwd ./
test:
needs: check-assets