Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: codecov issue #285

Merged
merged 4 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,22 @@ jobs:
- name: Checkout
uses: actions/checkout@v2

- name: Set up Go 1.19
uses: actions/setup-go@v4
with:
go-version: 1.19.9
cache: false

- name: Unit test
run: make test

- name: Upload Coverage Report
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.txt
name: coverage-$(date +%s)
flags: unittests

bdd-test:
needs: ['unit-test']
Expand Down Expand Up @@ -102,6 +113,14 @@ jobs:
- name: Running tests
run: ./ci/ci-test.sh

- name: Upload Coverage Report
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./tests/bdd_coverage.txt
name: coverage-bdd_coverage-$(date +%s)
flags: bddtests

ansible:
runs-on: ubuntu-latest
needs: ['lint', 'unit-test', 'bdd-test']
Expand Down
22 changes: 20 additions & 2 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,28 @@ jobs:
path: '.'
pattern: '*.sh'


unit-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up Go 1.19
uses: actions/setup-go@v4
with:
go-version: 1.19.9
cache: false

- name: Unit test
run: make test

- name: Upload Coverage Report
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.txt
name: coverage-$(date +%s)
flags: unittests

bdd-test:
needs: ['unit-test']
Expand Down Expand Up @@ -111,6 +121,14 @@ jobs:
- name: Running tests
run: ./ci/ci-test.sh

- name: Upload Coverage Report
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./tests/bdd_coverage.txt
name: coverage-bdd_coverage-$(date +%s)
flags: bddtests

csi-driver:
runs-on: ubuntu-latest
needs: ['lint', 'unit-test', 'bdd-test']
Expand Down
4 changes: 1 addition & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
# list only csi source code directories
PACKAGES = $(shell go list ./... | grep -v 'pkg/generated')

UNIT_TEST_PACKAGES = $(shell go list ./... | grep -v 'pkg/generated\|tests')

# Lint our code. Reference: https://golang.org/cmd/vet/
VETARGS?=-asmdecl -atomic -bool -buildtags -copylocks -methods \
-nilfunc -printf -rangeloops -shift -structtags -unsafeptr
Expand Down Expand Up @@ -110,7 +108,7 @@ format:
.PHONY: test
test: format
@echo "--> Running go test" ;
@go test $(UNIT_TEST_PACKAGES)
@./buildscripts/test-cov.sh


.PHONY: deps
Expand Down
6 changes: 3 additions & 3 deletions buildscripts/test-cov.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env bash

# Copyright © 2020 The OpenEBS Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -12,12 +14,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.

#!/usr/bin/env bash

set -e
echo "" > coverage.txt

for d in $(go list ./... | grep -v 'vendor\|pkg/apis\|pkg/generated\|tests'); do
for d in $(go list ./... | grep -v "pkg/generated\|tests"); do
#TODO - Include -race while creating the coverage profile.
go test -coverprofile=profile.out -covermode=atomic $d
Abhinandan-Purkait marked this conversation as resolved.
Show resolved Hide resolved
if [ -f profile.out ]; then
Expand Down
2 changes: 1 addition & 1 deletion ci/ci-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ set +e

echo "running ginkgo test case"

if ! ginkgo -v ; then
if ! ginkgo -v -coverprofile=bdd_coverage.txt -covermode=atomic; then

sudo pvscan --cache

Expand Down
Loading