add makefile

This commit is contained in:
lyyyuna 2021-07-21 17:34:52 +08:00
parent 2c2a70f7f1
commit caf8f46e14
3 changed files with 56 additions and 4 deletions

32
.github/workflows/ut-check-win.yml vendored Normal file
View File

@ -0,0 +1,32 @@
name: unit test
on:
# Trigger the workflow on push or pull request,
# but only for the master branch
push:
paths-ignore:
- '**.md'
- '**.png'
pull_request:
paths-ignore:
- '**.md'
- '**.png'
jobs:
run:
name: go test on windows
strategy:
matrix:
go-version: [1.16.x]
runs-on: windows-latest
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
# This step checks out a copy of your repository.
- name: Checkout code
uses: actions/checkout@v2
- name: Go test
env:
GOVERSION: ${{ matrix.go-version }}
run: |
go test -p 1 .\pkg\...

View File

@ -1,4 +1,4 @@
name: ut-check
name: unit test
on:
# Trigger the workflow on push or pull request,
# but only for the master branch
@ -12,7 +12,7 @@ on:
- '**.png'
jobs:
run:
name: go test
name: go test on linux
strategy:
matrix:
go-version: [1.16.x]
@ -29,6 +29,5 @@ jobs:
env:
GOVERSION: ${{ matrix.go-version }}
run: |
export DEFAULT_EXCEPT_PKGS=e2e
go test -p 1 -coverprofile=coverage.txt $(go list ./... | grep -v -E $DEFAULT_EXCEPT_PKGS)
make test
bash <(curl -s https://codecov.io/bash) -F unittest-$GOVERSION

21
Makefile Normal file
View File

@ -0,0 +1,21 @@
DEFAULT_EXCEPT_PKGS := e2e
build:
go build .
install:
go install ./...
test:
go test -p 1 -coverprofile=coverage.txt ./pkg/...
fmt:
go fmt ./...
govet-check:
go vet ./...
clean:
find ./ -type f -name 'coverage.txt' -delete
find ./ -type f -name 'goc' -delete
find ./ -type f -name 'gocc' -delete