-
Notifications
You must be signed in to change notification settings - Fork 1
132 lines (124 loc) · 4.51 KB
/
Copy pathci.yml
File metadata and controls
132 lines (124 loc) · 4.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
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