From c1013bf25fd454d1409700d713c27f4cc42db488 Mon Sep 17 00:00:00 2001 From: "haibo2.liu" Date: Tue, 21 Jun 2022 19:42:19 +0800 Subject: [PATCH] update github workflow --- .github/workflows/UnitTest.yml | 22 ++++++++++++++++++++++ README.md | 4 +++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/.github/workflows/UnitTest.yml b/.github/workflows/UnitTest.yml index 6af55a3..032e7d9 100644 --- a/.github/workflows/UnitTest.yml +++ b/.github/workflows/UnitTest.yml @@ -8,6 +8,28 @@ on: jobs: + coverage: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: 1.17.x + + - name: Test + run: | + go test -v ./... -covermode=count -coverprofile="coverage.out" + go tool cover -func="coverage.out" + + - name: Report coverage + uses: codacy/codacy-coverage-reporter-action@v1 + with: + api-token: ${{ secrets.CODACY_API_TOKEN }} + coverage-reports: coverage.out + force-coverage-parser: go + test: strategy: matrix: diff --git a/README.md b/README.md index a6d5ef5..127bf75 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,9 @@ [![Go Reference](https://pkg.go.dev/badge/github.com/Nomango/datefmt.svg)](https://pkg.go.dev/github.com/Nomango/datefmt) [![Github status](https://github.com/Nomango/datefmt/actions/workflows/UnitTest.yml/badge.svg?branch=main)](https://github.com/Nomango/datefmt/actions) [![GitHub release](https://img.shields.io/github/release/nomango/datefmt)](https://github.com/Nomango/datefmt/releases/latest) -[![GitHub license](https://img.shields.io/github/license/nomango/datefmt)](https://github.com/Nomango/datefmt/blob/main/LICENSE) +[![Codacy Badge](https://app.codacy.com/project/badge/Grade/9dd32aab87364903a57f32543f3bf738)](https://www.codacy.com/gh/Nomango/datefmt/dashboard?utm_source=github.com&utm_medium=referral&utm_content=Nomango/datefmt&utm_campaign=Badge_Grade) +[![Codacy Badge](https://app.codacy.com/project/badge/Coverage/9dd32aab87364903a57f32543f3bf738)](https://www.codacy.com/gh/Nomango/datefmt/dashboard?utm_source=github.com&utm_medium=referral&utm_content=Nomango/datefmt&utm_campaign=Badge_Coverage) +[![License](https://img.shields.io/github/license/nomango/datefmt)](https://github.com/Nomango/datefmt/blob/main/LICENSE) A date format tool based on general layout for Golang.