Skip to content

Commit 82c83e9

Browse files
authored
chore: build use git tag for version info (#141)
* chore: build use git tag for version info * chore: build use git tag for version info * chore: build use git tag for version info * chore: build use git tag for version info * chore: build use git tag for version info * chore: build use git tag for version info * chore: build use git tag for version info
1 parent 88e79d1 commit 82c83e9

8 files changed

Lines changed: 53 additions & 16 deletions

File tree

.github/workflows/build.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: build
2+
on: [push, pull_request]
3+
jobs:
4+
build-bscp:
5+
name: build-bscp
6+
runs-on: ubuntu-latest
7+
steps:
8+
# 拉取代码
9+
- name: checkout
10+
uses: actions/checkout@v4
11+
12+
# 设置 Go 环境
13+
- name: setup go
14+
uses: actions/setup-go@v3
15+
with:
16+
go-version-file: go.mod
17+
18+
# 编译项目
19+
- name: build go project
20+
run: |
21+
make build_bscp
22+
23+
build-ui:
24+
name: build-ui
25+
runs-on: ubuntu-latest
26+
steps:
27+
# 拉取代码
28+
- name: checkout
29+
uses: actions/checkout@v4
30+
31+
# 设置 Go 环境
32+
- name: setup go
33+
uses: actions/setup-go@v3
34+
with:
35+
go-version-file: go.mod
36+
37+
# 编译项目
38+
- name: build ui project
39+
run: |
40+
make build_frontend

.github/workflows/lint.yml

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,30 @@
11
name: lint
22
on: [push, pull_request]
33
jobs:
4-
bcs-bscp:
5-
name: bcs-bscp
4+
golang-lint:
5+
name: golang-lint
66
runs-on: ubuntu-latest
77
steps:
88
# 拉取代码
99
- name: checkout
10-
uses: actions/checkout@v3
10+
uses: actions/checkout@v4
1111

1212
# 设置 Go 环境
1313
- name: setup go
1414
uses: actions/setup-go@v3
1515
with:
1616
go-version-file: go.mod
17-
17+
1818
# 检查 Go 模块依赖是否整理
1919
- name: go mod tidy check
2020
uses: katexochen/go-tidy-check@v2
2121
with:
2222
modules: .
23-
23+
2424
# 运行代码风格检查 (golangci-lint)
2525
- name: golangci-lint
26-
uses: golangci/golangci-lint-action@v3
26+
uses: golangci/golangci-lint-action@v6
2727
with:
2828
version: v1.62.0
29-
args: --timeout=30m
29+
args: --timeout=5m
3030
working-directory: .
31-
32-
# 编译项目
33-
- name: build go project
34-
run: |
35-
make build_bscp && make build_frontend
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: pr-lint
1+
name: pr-style-check
22
on: [pull_request]
33
jobs:
44
PR-format-check:

.golangci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ linters-settings:
7070
- shadow
7171
disable:
7272
- printf
73+
goconst:
74+
min-occurrences: 5
7375
goimports:
7476
local-prefixes: github.com/TencentBlueKing/bk-bscp
7577
gci:

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
ifdef HASTAG
33
GITTAG=${HASTAG}
44
else
5-
GITTAG=$(shell git describe --always)
5+
GITTAG=$(shell git describe --tags --always)
66
endif
77

88
# version

cmd/feed-server/app/app.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ func (fs *feedServer) prepare(opt *options.Option) error {
127127
}
128128

129129
// listenAndServe listen the grpc serve and set up the shutdown gracefully job.
130-
func (fs *feedServer) listenAndServe() error {
130+
func (fs *feedServer) listenAndServe() error { // nolint
131131
// generate standard grpc server grpcMetrics.
132132
grpcMetrics := grpc_prometheus.NewServerMetrics()
133133
grpcMetrics.EnableHandlingTimeHistogram(metrics.GrpcBuckets)

internal/runtime/brpc/interceptor.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"strings"
2222
"time"
2323

24+
"github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/realip"
2425
"google.golang.org/grpc"
2526
"google.golang.org/grpc/codes"
2627
"google.golang.org/grpc/status"
@@ -29,7 +30,6 @@ import (
2930
"github.com/TencentBlueKing/bk-bscp/pkg/kit"
3031
"github.com/TencentBlueKing/bk-bscp/pkg/logs"
3132
"github.com/TencentBlueKing/bk-bscp/pkg/metrics"
32-
"github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/realip"
3333
)
3434

3535
// RecoveryHandlerFuncContext 异常日志输出

ui/dist/gitkeep

Whitespace-only changes.

0 commit comments

Comments
 (0)