Skip to content

Commit

Permalink
Refactor: del old codes, append more test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
ringsaturn committed Aug 10, 2023
1 parent c83a3c5 commit 16d3a96
Show file tree
Hide file tree
Showing 13 changed files with 444 additions and 281 deletions.
55 changes: 37 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,16 @@ on:
branches: [main]

jobs:
build:
runs-on: ubuntu-latest
golangci:
name: golangci-lint
strategy:
matrix:
go: ["1.21"]
permissions:
contents: read
pull-requests: read
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v3

Expand All @@ -20,25 +25,39 @@ jobs:
with:
go-version: ${{ matrix.go }}

- uses: actions/cache@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
version: latest
args: --timeout=5m

- name: Install test related deps
run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin latest
build:
runs-on: ubuntu-latest
strategy:
matrix:
go: ["1.21"]
steps:
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go }}

- name: Lint
run: golangci-lint run ./...
- run: make build
- run: make test
- run: make bench

- name: Build
- name: Build Coverage Report
run: |
go build
make cover
mkdir coverage-report
mv coverage.html ./coverage-report/
ls -alh coverage-report
- name: Test
run: |
go test ./...
- name: Upload Coverage Report
uses: actions/upload-artifact@v3
with:
name: "Coverage Report"
path: "./coverage-report"
retention-days: 3
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.PHONY:build
build:
go build

.PHONY:test
test:
go test -json -race ./... -v -coverprofile=coverage.out | tparse -all

.PHONY:cover
cover:
go tool cover -html=coverage.out -o=coverage.html
38 changes: 23 additions & 15 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ go 1.21

require (
github.com/cloudwego/hertz v0.6.7
github.com/mfridman/tparse v0.13.1
github.com/paulmach/orb v0.10.0
github.com/pkg/errors v0.9.1
github.com/redis/go-redis/v9 v9.0.5
github.com/ringsaturn/tzf v0.13.0
github.com/ringsaturn/tzf-rel v0.0.2023-b
github.com/stretchr/testify v1.8.4
github.com/tidwall/redcon v1.6.2
golang.org/x/sync v0.3.0
google.golang.org/protobuf v1.31.0
Expand All @@ -17,20 +18,29 @@ require (
require (
github.com/andeya/ameda v1.5.3 // indirect
github.com/andeya/goutil v1.0.1 // indirect
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
github.com/bytedance/go-tagexpr/v2 v2.9.8 // indirect
github.com/bytedance/gopkg v0.0.0-20230531144706-a12972768317 // indirect
github.com/bytedance/sonic v1.9.2 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
github.com/bytedance/gopkg v0.0.0-20230728082804-614d0af6619b // indirect
github.com/bytedance/sonic v1.10.0-rc3 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/charmbracelet/lipgloss v0.7.1 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirect
github.com/chenzhuoyu/iasm v0.9.0 // indirect
github.com/cloudwego/netpoll v0.4.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/klauspost/cpuid/v2 v2.2.5 // indirect
github.com/kr/pretty v0.3.0 // indirect
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/mattn/go-runewidth v0.0.14 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/nyaruka/phonenumbers v1.1.7 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rogpeppe/go-internal v1.8.0 // indirect
github.com/muesli/reflow v0.3.0 // indirect
github.com/muesli/termenv v0.15.1 // indirect
github.com/nyaruka/phonenumbers v1.1.8 // indirect
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/rivo/uniseg v0.4.4 // indirect
github.com/stretchr/testify v1.8.4 // indirect
github.com/tidwall/btree v1.6.0 // indirect
github.com/tidwall/geoindex v1.7.0 // indirect
github.com/tidwall/geojson v1.4.3 // indirect
Expand All @@ -39,11 +49,9 @@ require (
github.com/tidwall/rtree v1.10.0 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/twpayne/go-polyline v1.1.1 // indirect
go.mongodb.org/mongo-driver v1.12.0 // indirect
go.mongodb.org/mongo-driver v1.12.1 // indirect
golang.org/x/arch v0.4.0 // indirect
golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1 // indirect
golang.org/x/sys v0.10.0 // indirect
golang.org/x/text v0.11.0 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
golang.org/x/exp v0.0.0-20230810033253-352e893a4cad // indirect
golang.org/x/sys v0.11.0 // indirect
golang.org/x/text v0.12.0 // indirect
)
Loading

0 comments on commit 16d3a96

Please sign in to comment.