Skip to content

Commit 79e65fe

Browse files
authored
Improve ci action (#135)
1 parent eaa9d45 commit 79e65fe

File tree

5 files changed

+36
-1374
lines changed

5 files changed

+36
-1374
lines changed

.github/workflows/go.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,10 @@ name: Go
55

66
on:
77
push:
8-
branches: [ "dev", "branch-2.0" ]
8+
branches: [ "dev", "branch-2.0", "branch-2.1", "branch-3.0" ]
99
pull_request:
10-
branches: [ "dev", "branch-2.0" ]
1110

1211
jobs:
13-
1412
build:
1513
runs-on: ubuntu-latest
1614
steps:
@@ -21,6 +19,9 @@ jobs:
2119
with:
2220
go-version: '1.20'
2321

22+
- name: Format
23+
run: if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then exit 1; fi
24+
2425
- name: Build
2526
run: make
2627

.github/workflows/golangci-lint.yml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: golangci-lint
2+
on:
3+
push:
4+
branches:
5+
- main
6+
- dev
7+
- branch-3.0
8+
- branch-2.1
9+
- branch-2.0
10+
pull_request:
11+
12+
permissions:
13+
contents: read
14+
# Optional: allow read access to pull request. Use with `only-new-issues` option.
15+
# pull-requests: read
16+
17+
jobs:
18+
golangci:
19+
name: lint
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v4
23+
- uses: actions/setup-go@v5
24+
with:
25+
go-version: '1.20'
26+
- name: golangci-lint
27+
uses: golangci/golangci-lint-action@v6
28+
with:
29+
version: v1.60

Makefile

+2-8
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,7 @@ tarball_suffix := $(tag)-$(platform)
2020
LDFLAGS="-X 'github.com/selectdb/ccr_syncer/pkg/version.GitTagSha=$(git_tag_sha)'"
2121
GOFLAGS=
2222

23-
# Check formatter, if exist gofumpt, use it
24-
GOFUMPT := $(shell command -v gofumpt 2> /dev/null)
25-
ifdef GOFUMPT
26-
GOFORMAT := gofumpt -w
27-
else
28-
GOFORMAT := go fmt
29-
endif
23+
GOFORMAT := gofmt -l -d -w
3024

3125
# COVERAGE=ON make
3226
ifeq ($(COVERAGE),ON)
@@ -63,7 +57,7 @@ fmt:
6357
.PHONY: test
6458
## test : Run test
6559
test:
66-
$(V)go test $(shell go list ./... | grep -v github.com/selectdb/ccr_syncer/cmd | grep -v github.com/selectdb/ccr_syncer/pkg/rpc/kitex_gen/) | grep -F -v '[no test files]'
60+
$(V)go test $(shell go list ./... | grep -v github.com/selectdb/ccr_syncer/cmd | grep -v github.com/selectdb/ccr_syncer/pkg/rpc/kitex_gen/)
6761

6862
.PHONY: help
6963
## help : Print help message

0 commit comments

Comments
 (0)