Skip to content

Commit

Permalink
ci: add code coverage as part of CI (Azure#360)
Browse files Browse the repository at this point in the history
  • Loading branch information
aramase authored Jan 13, 2021
1 parent 99ffa92 commit b87c867
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -347,3 +347,6 @@ manifest_staging/charts/csi-secrets-store-provider-azure/charts/
# website
website/public
website/resources

# cover profile
coverage.txt
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ BUILD_VERSION_VAR := $(REPO_PATH)/pkg/version.BuildVersion
VCS_VAR := $(REPO_PATH)/pkg/version.Vcs
LDFLAGS ?= "-X $(BUILD_DATE_VAR)=$(BUILD_DATE) -X $(BUILD_VERSION_VAR)=$(IMAGE_VERSION) -X $(VCS_VAR)=$(BUILD_COMMIT)"

GO_FILES=$(shell go list ./...)
GO_FILES=$(shell go list ./... | grep -v /test/e2e)
ALL_DOCS := $(shell find . -name '*.md' -type f | sort)
TOOLS_MOD_DIR := ./tools
TOOLS_DIR := $(abspath ./.tools)
Expand Down Expand Up @@ -66,7 +66,7 @@ lint: $(TOOLS_DIR)/golangci-lint $(TOOLS_DIR)/misspell

.PHONY: unit-test
unit-test:
go test $(GO_FILES) -v
CGO_ENABLED=1 go test -race -coverprofile=coverage.txt -covermode=atomic $(GO_FILES) -v

.PHONY: build
build:
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Azure Key Vault Provider for Secrets Store CSI Driver

[![Build Status](https://dev.azure.com/azure/secrets-store-csi-driver-provider-azure/_apis/build/status/secrets-store-csi-driver-provider-azure-ci?branchName=master)](https://dev.azure.com/azure/secrets-store-csi-driver-provider-azure/_build/latest?definitionId=67&branchName=master)
[![codecov](https://codecov.io/gh/Azure/secrets-store-csi-driver-provider-azure/branch/master/graph/badge.svg)](https://codecov.io/gh/Azure/secrets-store-csi-driver-provider-azure)
![GitHub release (latest by date)](https://img.shields.io/github/v/release/Azure/secrets-store-csi-driver-provider-azure)
[![Go Report Card](https://goreportcard.com/badge/Azure/secrets-store-csi-driver-provider-azure)](https://goreportcard.com/report/Azure/secrets-store-csi-driver-provider-azure)
![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/Azure/secrets-store-csi-driver-provider-azure)
Expand Down
4 changes: 4 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ jobs:
displayName: Build
- script: make unit-test
displayName: Run unit tests
- script: bash <(curl -s https://codecov.io/bash)
displayName: Upload coverage to codecov
env:
CODECOV_TOKEN: $(CODECOV_TOKEN)
- script: make helm-lint
displayName: Run helm lint
- template: .pipelines/templates/scan-images.yaml
Expand Down
32 changes: 32 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
codecov:
notify:
require_ci_to_pass: no

coverage:
precision: 2
round: down
range: "50...100"
status:
project:
default:
threshold: 0.5
patch:
default:
threshold: 0.5
changes: no

parsers:
gcov:
branch_detection:
conditional: yes
loop: yes
method: no
macro: no

comment:
layout: "header, diff"
behavior: default
require_changes: no

ignore:
- "test/**/*.go"

0 comments on commit b87c867

Please sign in to comment.