Skip to content

Commit ac20937

Browse files
committed
updated
1 parent fb0b8b3 commit ac20937

File tree

16 files changed

+776
-364
lines changed

16 files changed

+776
-364
lines changed

.editorconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
8+
[*.go]
9+
indent_size = 4
10+
indent_style = tab
11+
trim_trailing_whitespace = true

.gitattributes

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
**/mock/** -diff
2+
*.go text eol=lf
3+
*.md text eol=lf
4+
*.swagger.json -diff
5+
*.yml text eol=lf
6+
go.sum -diff

.github/actions/go/action.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: init
2+
3+
inputs:
4+
GO_VERSION:
5+
description: "Go Version"
6+
required: true
7+
8+
runs:
9+
using: composite
10+
steps:
11+
- uses: actions/checkout@v4
12+
- uses: actions/setup-go@v5
13+
with:
14+
go-version: ${{ inputs.GO_VERSION }}
15+
16+
- name: Download Go Modules
17+
run: go mod download
18+
shell: sh

.github/workflows/go.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: go
2+
3+
on:
4+
push:
5+
6+
permissions:
7+
contents: read
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: ./.github/actions/go
15+
with:
16+
GO_VERSION: ${{ vars.GO_VERSION }}
17+
18+
- name: Run Test
19+
run: go test -count=1 -covermode=atomic -coverprofile=cover.out.tmp -race ./...
20+
21+
- name: Run Code Coverage
22+
run: |
23+
cat cover.out.tmp | grep -v ".minimock.go" > cover.out
24+
coverage=$(go tool cover -func cover.out | grep total | awk '{print $3}' | sed 's/%//')
25+
if (( $(echo "$coverage < ${{ vars.CODE_COVERAGE_PERCENTAGE }}" | bc -l) )); then
26+
echo "Code coverage is below threshold: got $coverage%, want ${{ vars.CODE_COVERAGE_PERCENTAGE }}%"
27+
exit 1
28+
fi
29+
30+
- name: Run Flaky Test
31+
run: go test -count=100 ./...
32+
33+
golangci-lint:
34+
runs-on: ubuntu-latest
35+
steps:
36+
- uses: actions/checkout@v4
37+
- uses: ./.github/actions/go
38+
with:
39+
GO_VERSION: ${{ vars.GO_VERSION }}
40+
41+
- uses: golangci/golangci-lint-action@v7
42+
with:
43+
version: v2.1.2
44+
45+
govulncheck:
46+
runs-on: ubuntu-latest
47+
steps:
48+
- uses: actions/checkout@v4
49+
- uses: ./.github/actions/go
50+
with:
51+
GO_VERSION: ${{ vars.GO_VERSION }}
52+
53+
- uses: golang/govulncheck-action@v1
54+
with:
55+
go-version-input: ${{ vars.GO_VERSION }}
56+
go-package: ./...

.gitignore

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
*
22

33
!*.go
4+
!/.editorconfig
5+
!/.gitattributes
6+
!/.github/**
47
!/.gitignore
58
!/.golangci.yml
6-
!/go.mod
7-
!/go.sum
89
!/LICENSE
910
!/Makefile
1011
!/README.md
12+
!/go.mod
13+
!/go.sum
1114

1215
!*/

0 commit comments

Comments
 (0)