Skip to content

Commit

Permalink
Feature - Implemented coverall for tracking codecoverage
Browse files Browse the repository at this point in the history
  • Loading branch information
naveensrinivasan committed Jan 21, 2021
1 parent 6842f93 commit 3670ccc
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
@@ -1,4 +1,4 @@
name: build
name: osxbuild
on: [push, pull_request]
jobs:
validate:
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/test.yml
@@ -0,0 +1,26 @@
# Inlcuding the tests with ubuntu to get actual test coverage. The OSX builds skip seccomp tests.
name: test-coverage
on: [push, pull_request]
jobs:
validate:
name: Validate
runs-on: ubuntu-latest
# Pull requests from the same repository won't trigger this checks as they were already triggered by the push
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
steps:
- name: Clone the code
uses: actions/checkout@v2
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: '^1.15'
- name: Install libseccomp-dev
run: |
sudo apt update
sudo apt install -y libseccomp-dev
- name: unit test
run: make test-unit
- name: Send the coverage output
uses: shogo82148/actions-goveralls@v1
with:
path-to-profile: build/coverage.out
3 changes: 3 additions & 0 deletions Makefile
Expand Up @@ -154,6 +154,9 @@ $(BUILD_DIR)/golangci-lint:

.PHONY: test-unit
test-unit: $(BUILD_DIR) ## Run the unit tests
# remove all coverage files if exists
- rm -rf *.out
# run the go tests and gen the file coverage-all used to do the integration with coverrals.io
$(GO) test -ldflags '$(LDVARS)' -tags '$(BUILDTAGS)' -v -test.coverprofile=$(BUILD_DIR)/coverage.out ./internal/...
$(GO) tool cover -html $(BUILD_DIR)/coverage.out -o $(BUILD_DIR)/coverage.html

Expand Down
2 changes: 2 additions & 0 deletions README.md
@@ -1,3 +1,5 @@
[![Coverage Status](https://coveralls.io/repos/github/kubernetes-sigs/security-profiles-operator/badge.svg?branch=master)](https://coveralls.io/github/kubernetes-sigs/security-profiles-operator?branch=master)

# Kubernetes Security Profiles Operator

This project is the starting point for the _Security Profiles Operator_, an
Expand Down

0 comments on commit 3670ccc

Please sign in to comment.