diff --git a/.github/workflows/scenario-testing.yaml b/.github/workflows/scenario-testing.yaml index 023608ea..c1f2b1ce 100644 --- a/.github/workflows/scenario-testing.yaml +++ b/.github/workflows/scenario-testing.yaml @@ -39,9 +39,16 @@ jobs: - name: Build all targets. run: | make build-all - make test-all + make test-all WITH_COVERAGE=true + - name: Upload test coverage + uses: actions/upload-artifact@v2 + if: github.event_name == 'pull_request' + with: + name: coverage + path: coverage.html - name: Sign into Azure uses: azure/login@v1 + if: github.event_name != 'pull_request' with: client-id: ${{ secrets.AZURE_CLIENT_ID }} tenant-id: ${{ secrets.AZURE_TENANT_ID }} diff --git a/.gitignore b/.gitignore index c76f479a..d8c21bc6 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,7 @@ bin/ # Ignore ie logs ie.log + +# Ignore test coverage +coverage.html +coverage.out diff --git a/Makefile b/Makefile index a65ba58c..82e12250 100644 --- a/Makefile +++ b/Makefile @@ -21,10 +21,19 @@ install-ie: # ------------------------------ Test targets ---------------------------------- +WITH_COVERAGE := false + test-all: - @echo "Running all tests..." @go clean -testcache +ifeq ($(WITH_COVERAGE), true) + @echo "Running all tests with coverage..." + @go test -v -coverprofile=coverage.out ./... + @go tool cover -html=coverage.out -o coverage.html +else + @echo "Running all tests..." @go test -v ./... +endif + SUBSCRIPTION ?= 00000000-0000-0000-0000-000000000000 SCENARIO ?= ./README.md