Skip to content

Commit

Permalink
feat: Add unittest workflow
Browse files Browse the repository at this point in the history
Signed-off-by: yxxhero <[email protected]>
  • Loading branch information
yxxhero committed Jan 9, 2024
1 parent 80859fb commit cf70807
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
16 changes: 14 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:

tests:
build-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -17,5 +17,17 @@ jobs:
with:
go-version-file: 'go.mod'
cache: true
- name: Build
- name: build
run: make build

unit-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version-file: 'go.mod'
cache: true
- name: test
run: make test
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Version := $(shell git describe --tags --dirty --always)
PKGS := $(shell go list ./... | grep -v /vendor/)
GitCommit := $(shell git rev-parse HEAD)
LDFLAGS := "-X main.version=$(Version) -X main.commit=$(GitCommit)"

Expand All @@ -10,3 +11,9 @@ install: build

lint:
golangci-lint run -v --out-format=github-actions


test:
go test -v ${PKGS} -coverprofile cover.out -race -p=1
go tool cover -func cover.out
.PHONY: test

0 comments on commit cf70807

Please sign in to comment.