chore: add coverage for integration tests (#1307)

Added coverage output for integration test, and added codecov uploads
for both integration and unit tests.

This commit changes the output file to coverage.txt as well, in order to
be consistent with knative test infrastructure.

Signed-off-by: Lance Ball <lball@redhat.com>

Signed-off-by: Lance Ball <lball@redhat.com>
This commit is contained in:
Lance Ball 2022-10-10 09:18:35 -04:00 committed by GitHub
parent 06ade524de
commit 1a54a8d78a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 5 deletions

View File

@ -4,7 +4,7 @@ on: [pull_request]
jobs: jobs:
test: test:
name: Integration Test name: Integration Test
strategy: strategy:
matrix: matrix:
go: [1.18.x] go: [1.18.x]
@ -23,3 +23,7 @@ jobs:
run: ./hack/registry.sh run: ./hack/registry.sh
- name: Integration Test - name: Integration Test
run: make test-integration run: make test-integration
- uses: codecov/codecov-action@v3
with:
files: ./coverage.txt
flags: integration-tests

View File

@ -4,7 +4,7 @@ on: [pull_request]
jobs: jobs:
test: test:
name: Unit Test name: Unit Test
strategy: strategy:
matrix: matrix:
go: [1.18.x] go: [1.18.x]
@ -35,3 +35,7 @@ jobs:
run: make test run: make test
- name: Template Unit Tests - name: Template Unit Tests
run: make test-templates run: make test-templates
- uses: codecov/codecov-action@v3
with:
files: ./coverage.txt
flags: unit-tests-${{ matrix.os }}

1
.gitignore vendored
View File

@ -7,6 +7,7 @@
/templates/typescript/cloudevents/build /templates/typescript/cloudevents/build
/templates/typescript/http/build /templates/typescript/http/build
/coverage.out /coverage.out
/coverage.txt
/bin /bin
/target /target

View File

@ -55,7 +55,7 @@ $(BIN): $(CODE)
env CGO_ENABLED=0 go build -ldflags $(LDFLAGS) ./cmd/$(BIN) env CGO_ENABLED=0 go build -ldflags $(LDFLAGS) ./cmd/$(BIN)
test: $(CODE) ## Run core unit tests test: $(CODE) ## Run core unit tests
go test -race -cover -coverprofile=coverage.out ./... go test -race -cover -coverprofile=coverage.txt ./...
check: bin/golangci-lint ## Check code quality (lint) check: bin/golangci-lint ## Check code quality (lint)
./bin/golangci-lint run --timeout 300s ./bin/golangci-lint run --timeout 300s
@ -94,7 +94,7 @@ zz_filesystem_generated.go: clean_templates
clean: clean_templates ## Remove generated artifacts such as binaries and schemas clean: clean_templates ## Remove generated artifacts such as binaries and schemas
rm -f $(BIN) $(BIN_WINDOWS) $(BIN_LINUX) $(BIN_DARWIN_AMD64) $(BIN_DARWIN_ARM64) rm -f $(BIN) $(BIN_WINDOWS) $(BIN_LINUX) $(BIN_DARWIN_AMD64) $(BIN_DARWIN_ARM64)
rm -f schema/func_yaml-schema.json rm -f schema/func_yaml-schema.json
rm -f coverage.out rm -f coverage.txt
docs: docs:
# Generating command reference doc # Generating command reference doc
@ -140,7 +140,7 @@ test-typescript: ## Test Typescript templates
################### ###################
test-integration: ## Run integration tests using an available cluster. test-integration: ## Run integration tests using an available cluster.
go test -tags integration ./... -v go test -tags integration --coverprofile=coverage.txt ./... -v
test-e2e: ## Run end-to-end tests using an available cluster. test-e2e: ## Run end-to-end tests using an available cluster.
./test/e2e_lifecycle_tests.sh node ./test/e2e_lifecycle_tests.sh node