Skip to content

Commit

Permalink
chore: improve test cover (#20)
Browse files Browse the repository at this point in the history
* chore: improve test cover

* chore: disable atomicalign of govet
  • Loading branch information
qloog authored Jan 21, 2025
1 parent d84928b commit e8bba06
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ jobs:
with:
ref: ${{ github.ref }}

# - name: Run Unit tests
# run: |
# make test
# make cover
- name: Run Unit tests
run: |
make test
make cover
- name: Upload Coverage to CodeCov
uses: codecov/codecov-action@v3
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@ logs
eagle-layout
cmd/consumer/consumer
cmd/server/server
coverage.txt
coverage.out
internal/dal/db/dao/gen_test.db
bin
5 changes: 3 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# options for analysis running
run:
go: '1.21'
go: '1.22'
# default concurrency is a available CPU number
concurrency: 4

Expand Down Expand Up @@ -142,7 +142,8 @@ linters-settings:

# enable or disable analyzers by name
enable:
- atomicalign
# Check for non-64-bits-aligned arguments to sync/atomic functions.
# - atomicalign
enable-all: false
disable:
- shadow
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@ vet:
.PHONY: cover
# make cover
cover:
@go test -short -coverprofile=coverage.txt -covermode=atomic ${PKG_LIST}
@go test -short -coverprofile=coverage.out -covermode=atomic ${PKG_LIST}

.PHONY: view-cover
# make view-cover preview coverage
view-cover:
go tool cover -html=coverage.txt -o coverage.html
# make view-cover preview coverage report
view-cover: cover
go tool cover -html=coverage.out

.PHONY: image
# make image 生成docker镜像, eg: make image GIT_TAG=v1.0.0
Expand Down

0 comments on commit e8bba06

Please sign in to comment.