test(translator): verify BackendTLSValidation produced when all CA re… #374
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
| name: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| go-build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 | |
| - uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 | |
| with: | |
| go-version-file: go.mod | |
| cache-dependency-path: go.sum | |
| - name: Build | |
| run: go build ./... | |
| go-test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 | |
| - uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 | |
| with: | |
| go-version-file: go.mod | |
| cache-dependency-path: go.sum | |
| - name: Test | |
| run: go test ./... | |
| go-test-race: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 | |
| - uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 | |
| with: | |
| go-version-file: go.mod | |
| cache-dependency-path: go.sum | |
| - name: Test with race detection | |
| run: go test -race -count=1 -timeout 10m ./... | |
| go-lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 | |
| - uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 | |
| with: | |
| go-version-file: go.mod | |
| cache-dependency-path: go.sum | |
| - name: Install golangci-lint | |
| run: go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest | |
| - name: Run golangci-lint (style — informational) | |
| run: golangci-lint run --issues-exit-code=0 | |
| - name: Run golangci-lint (correctness — blocking) | |
| run: golangci-lint run --enable-only=govet,copyloopvar,bodyclose,durationcheck,errorlint,ineffassign,sqlclosecheck | |
| proto-check: | |
| runs-on: ubuntu-latest | |
| # Informational only: proto repo has its own CI for proto validation. | |
| # This job verifies gateway gen/ is in sync with the latest proto main. | |
| continue-on-error: true | |
| steps: | |
| - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 | |
| with: | |
| path: gateway | |
| - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 | |
| with: | |
| repository: nantian-gw/proto | |
| path: proto | |
| token: ${{ secrets.GH_PAT || secrets.GITHUB_TOKEN }} | |
| - uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 | |
| with: | |
| go-version-file: gateway/go.mod | |
| cache-dependency-path: gateway/go.sum | |
| - name: Install Buf CLI | |
| env: | |
| BUF_VERSION: 1.70.0 | |
| run: | | |
| mkdir -p "$RUNNER_TEMP/bin" | |
| curl -fsSL "https://github.com/bufbuild/buf/releases/download/v${BUF_VERSION}/buf-Linux-x86_64" -o "$RUNNER_TEMP/bin/buf" | |
| chmod +x "$RUNNER_TEMP/bin/buf" | |
| echo "$RUNNER_TEMP/bin" >> "$GITHUB_PATH" | |
| "$RUNNER_TEMP/bin/buf" --version | |
| - name: Buf generate | |
| env: | |
| BUF_TOKEN: ${{ secrets.BUF_TOKEN }} | |
| run: | | |
| cd gateway | |
| buf generate ../proto | |
| - name: Verify go mod tidy | |
| run: | | |
| cd gateway | |
| go mod tidy | |
| if ! git diff --exit-code; then | |
| echo "::warning::go mod tidy produced changes — run 'go mod tidy' locally." | |
| fi | |
| - name: Verify generated code is up to date | |
| run: | | |
| cd gateway | |
| if ! git diff --exit-code gen/; then | |
| echo "::warning::Generated Go code may be out of date — Buf remote plugin version drift. Verify with 'buf generate ../proto && go mod tidy' locally." | |
| fi | |
| go-bench: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| deployments: write | |
| steps: | |
| - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 | |
| - uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 | |
| with: | |
| go-version-file: go.mod | |
| cache-dependency-path: go.sum | |
| - name: Run benchmarks | |
| run: go test -bench=. -benchtime=3x -count=3 ./... | tee benchmark-output.txt | |
| - name: Store benchmark result | |
| uses: benchmark-action/github-action-benchmark@v1 | |
| with: | |
| tool: go | |
| output-file-path: benchmark-output.txt | |
| external-data-json-path: ./benchmark-data.json | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| auto-push: false | |
| alert-threshold: "130%" | |
| comment-on-alert: true | |
| fail-on-alert: true | |
| summary-always: true |