From 332759ef731a0d52e14f9691b05e7bbed4833a44 Mon Sep 17 00:00:00 2001 From: Denton Gentry Date: Tue, 5 Jan 2021 08:33:34 -0800 Subject: [PATCH] Add coveralls.io support. We include -bench because some parts of the codebase, like smallzstd, do not have regular unit tests but do have very good benchmark tests that covers all functions. Signed-off-by: Denton Gentry --- .github/workflows/coverage.yml | 40 ++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/workflows/coverage.yml diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 000000000..9432c153d --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,40 @@ +name: Code Coverage + +on: + push: + branches: + - main + pull_request: + branches: + - '*' + +jobs: + build: + runs-on: ubuntu-latest + + if: "!contains(github.event.head_commit.message, '[ci skip]')" + + steps: + + - name: Set up Go + uses: actions/setup-go@v1 + with: + go-version: 1.15 + id: go + + - name: Check out code into the Go module directory + uses: actions/checkout@v1 + + - name: Basic build + run: go build ./cmd/... + + - name: Run tests on linux with coverage data + run: go test -race -covermode=atomic -coverprofile=coverage.txt -bench=regex ./... + + - name: coveralls.io + uses: shogo82148/actions-goveralls@v1 + env: + COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }} + GITHUB_TOKEN: ${{ secrets.COVERALLS_BOT_PUBLIC_REPO_TOKEN }} + with: + path-to-profile: ./coverage.txt