From caf8f46e140061ecec0c840446c82fe524d033f7 Mon Sep 17 00:00:00 2001 From: lyyyuna Date: Wed, 21 Jul 2021 17:34:52 +0800 Subject: [PATCH] add makefile --- .github/workflows/ut-check-win.yml | 32 ++++++++++++++++++++++++++++++ .github/workflows/ut-check.yml | 7 +++---- Makefile | 21 ++++++++++++++++++++ 3 files changed, 56 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/ut-check-win.yml create mode 100644 Makefile diff --git a/.github/workflows/ut-check-win.yml b/.github/workflows/ut-check-win.yml new file mode 100644 index 0000000..57dd40b --- /dev/null +++ b/.github/workflows/ut-check-win.yml @@ -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\... diff --git a/.github/workflows/ut-check.yml b/.github/workflows/ut-check.yml index d2a37d5..63376dc 100644 --- a/.github/workflows/ut-check.yml +++ b/.github/workflows/ut-check.yml @@ -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 \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..8091562 --- /dev/null +++ b/Makefile @@ -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 \ No newline at end of file