From a55f3acacf2848204cf01cd098878224ce2f26a8 Mon Sep 17 00:00:00 2001 From: Jason Kulatunga Date: Sun, 20 Sep 2020 16:24:30 -0600 Subject: [PATCH] generate a coverage.txt file, and upload to codecov.io. --- .github/workflows/build.yaml | 7 ++++++- .gitignore | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index aa9515d..57e636e 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -23,7 +23,7 @@ jobs: go mod vendor - go test -v -tags "static" $(go list ./... | grep -v /vendor/) + go test -race -coverprofile=coverage.txt -covermode=atomic -v -tags "static" $(go list ./... | grep -v /vendor/) go build -ldflags "-X main.goos=linux -X main.goarch=amd64" -o scrutiny-web-linux-amd64 -tags "static" webapp/backend/cmd/scrutiny/scrutiny.go go build -ldflags "-X main.goos=linux -X main.goarch=amd64" -o scrutiny-collector-metrics-linux-amd64 -tags "static" collector/cmd/collector-metrics/collector-metrics.go @@ -37,6 +37,11 @@ jobs: path: | ${{ env.PROJECT_PATH }}/scrutiny-web-linux-amd64 ${{ env.PROJECT_PATH }}/scrutiny-collector-metrics-linux-amd64 + - uses: codecov/codecov-action@v1 + with: + file: coverage.txt + flags: unittests + fail_ci_if_error: true build-docker: name: Build Docker runs-on: ubuntu-latest diff --git a/.gitignore b/.gitignore index 379a871..8235ebe 100644 --- a/.gitignore +++ b/.gitignore @@ -62,3 +62,5 @@ vendor /scrutiny-web-linux-amd64 scrutiny-*.db scrutiny_test.db + +coverage.txt