From fb9026d9205dfb4d68f562d267e062a43040a5aa Mon Sep 17 00:00:00 2001 From: Aaron Romeo Date: Mon, 1 Jan 2024 09:41:59 -0500 Subject: [PATCH] Working through linting and unit testing github actions. --- .github/workflows/linting.yml | 2 +- .github/workflows/unittesting.yml | 29 +++++++++++++++++++++++------ 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index 24dc1f9..0a1bbd4 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -21,7 +21,7 @@ jobs: with: version: v1.54 args: --config .golangci.yml - working-directory: ./system/go-pyrfid-juke-support + # working-directory: ./system/go-pyrfid-juke-support pre-commit: name: Run pre-commit hooks diff --git a/.github/workflows/unittesting.yml b/.github/workflows/unittesting.yml index 03fcd6b..1225d87 100644 --- a/.github/workflows/unittesting.yml +++ b/.github/workflows/unittesting.yml @@ -34,11 +34,28 @@ jobs: with: go-version: "~1.21" # Use the version of Go in your project - - name: Test with Go - run: go test -json > TestResults.json + - name: generate test coverage + run: go test ./... -coverprofile=./cover.out -covermode=atomic -coverpkg=./... - - name: Upload Go test results - uses: actions/upload-artifact@v3 + - name: generate test coverage report + run: go tool cover -html=./cover.out -o ./cover.html + + - name: upload coverage report + uses: actions/upload-artifact@v2 + with: + name: coverage-report + path: ./cover.html + + - name: check test coverage + uses: vladopajic/go-test-coverage@v2 with: - name: Go-results - path: TestResults.json + # Configure action using config file (option 1) + config: ./.testcoverage.yml + + # Configure action by specifying input parameters individually (option 2). + # If you are using config file you shouldn't use these parameters. + profile: cover.out + local-prefix: https://github.com/aaronromeo/pyrfid-jukebox + threshold-file: 80 + threshold-package: 80 + threshold-total: 95