From 142e6f77279ffce7751f1abc82903e22292e4015 Mon Sep 17 00:00:00 2001 From: gkits <56302678+gKits@users.noreply.github.com> Date: Wed, 23 Oct 2024 20:38:07 +0200 Subject: [PATCH] ci: add action for unittesting and creating cover badge --- .github/workflows/actions.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/actions.yml diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml new file mode 100644 index 0000000..c6aa3fa --- /dev/null +++ b/.github/workflows/actions.yml @@ -0,0 +1,23 @@ +name: Unittest + +on: [push] + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v3 + + - name: Run unittests + run: go test ./... -coverprofile=./cover.out -covermode=atomic -coverpkg=./... + + - name: Generate cover badge + uses: vladopajic/go-test-coverage@v2 + with: + profile: cover.out + locale-prefix: github.com/gkits/sqlnull + threshold-total: 95 + git-token: ${{ github.ref_name == 'main' && secrets.GITHUB_TOKEN || '' }} + git-branch: badges