Skip to content

Commit c7eecb1

Browse files
committed
CI && linters cfg
1 parent 2966054 commit c7eecb1

File tree

2 files changed

+147
-0
lines changed

2 files changed

+147
-0
lines changed

.github/workflows/ci.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Go CI
2+
3+
on:
4+
pull_request:
5+
branches: [develop, master]
6+
push:
7+
branches: [develop, master]
8+
9+
jobs:
10+
build-linux:
11+
name: Build stringFormatter on linux
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/[email protected]
15+
- name: Set up Go
16+
uses: actions/[email protected]
17+
with:
18+
go-version: '1.21'
19+
- name: Build
20+
run: go version && go build -v ./...
21+
22+
build-windows:
23+
name: Build stringFormatter on windows
24+
runs-on: windows-latest
25+
steps:
26+
- uses: actions/[email protected]
27+
- name: Set up Go
28+
uses: actions/[email protected]
29+
with:
30+
go-version: '1.21'
31+
- name: Build
32+
run: go version && go build -v ./...
33+
34+
all-tests-linux:
35+
name: Run all tests on linux
36+
runs-on: ubuntu-latest
37+
steps:
38+
- uses: actions/[email protected]
39+
- name: Set up Go
40+
uses: actions/[email protected]
41+
with:
42+
go-version: '1.21'
43+
- name: Test all
44+
run: go version && go mod tidy && go test -v ./...
45+
46+
#all-tests-windows:
47+
# name: Run all tests on windows
48+
# runs-on: windows-latest
49+
# steps:
50+
# - uses: actions/[email protected]
51+
# - name: Set up Go
52+
# uses: actions/[email protected]
53+
# - name: Test all
54+
# run: go test -v ./...
55+
# on windows don't work linux containers by default
56+
57+
lint:
58+
name: Run golangci linters
59+
runs-on: ubuntu-latest
60+
steps:
61+
- uses: actions/[email protected]
62+
- name: Set up Go
63+
uses: actions/[email protected]
64+
with:
65+
go-version: '1.21'
66+
- name: Run golangci-lint
67+
uses: golangci/[email protected]
68+
with:
69+
version: v1.63.4
70+
args: --timeout 3m --config .golangci.yaml

.golangci.yaml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
run:
2+
# timeout for analysis, e.g. 30s, 5m, default is 1m
3+
timeout: 30m
4+
5+
modules-download-mode: readonly
6+
7+
go: '1.21'
8+
9+
output:
10+
# colored-line-number|line-number|json|tab|checkstyle|code-climate|junit-xml|github-actions
11+
# default is "colored-line-number"
12+
formats: code-climate
13+
14+
linters:
15+
enable-all: false
16+
disable:
17+
- exhaustruct
18+
- gofumpt
19+
- testpackage
20+
- depguard
21+
- tagliatelle
22+
- ireturn
23+
- varnamelen
24+
- wrapcheck
25+
26+
linters-settings:
27+
stylecheck:
28+
# Select the Go version to target. The default is '1.13'.
29+
# https://staticcheck.io/docs/options#checks
30+
checks: [ "all", "-ST1000" ]
31+
funlen:
32+
lines: 100
33+
gci:
34+
sections:
35+
- standard
36+
- default
37+
- prefix(github.com/wissance/stringFormatter)
38+
gocyclo:
39+
min-complexity: 5
40+
varnamelen:
41+
ignore-names:
42+
- id
43+
ignore-decls:
44+
- ok bool
45+
wrapcheck:
46+
ignorePackageGlobs:
47+
- google.golang.org/grpc/status
48+
- github.com/pkg/errors
49+
- golang.org/x/sync/errgroup
50+
gosec:
51+
excludes:
52+
- G204
53+
54+
issues:
55+
exclude-rules:
56+
- path: _test\.go
57+
linters:
58+
- containedctx
59+
- gocyclo
60+
- cyclop
61+
- funlen
62+
- goerr113
63+
- varnamelen
64+
- staticcheck
65+
- maintidx
66+
- lll
67+
- paralleltest
68+
- dupl
69+
- typecheck
70+
- wsl
71+
- govet
72+
- path: main\.go
73+
linters:
74+
- gochecknoglobals
75+
- lll
76+
- funlen
77+
version: 2

0 commit comments

Comments
 (0)