forked from Mellanox/network-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
14 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,32 @@ | ||
name: Test Coverage | ||
name: Go Test Coverage with Coveralls | ||
|
||
on: | ||
pull_request: | ||
branches: [master] | ||
on: [pull_request, push] | ||
|
||
jobs: | ||
coverage: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: '^1.21' | ||
go-version: '^1.21' # Set this to your Go version | ||
|
||
- name: Run tests and collect coverage | ||
- name: Run tests with coverage | ||
run: | | ||
make test-coverage | ||
- name: Generate coverage report | ||
- name: Generate LCOV report | ||
run: | | ||
go tool cover -func=network-operator.cover | ||
go install github.com/jandelgado/gcov2lcov@latest | ||
gcov2lcov -infile=network-operator.cover -outfile=coverage.lcov | ||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@v2 | ||
- name: Upload coverage to Coveralls | ||
uses: coverallsapp/github-action@v2.2.3 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} # Required only for private repos | ||
file: ./network-operator.cover | ||
flags: unittests | ||
name: codecov-umbrella | ||
fail_ci_if_error: true | ||
verbose: true | ||
|
||
# - name: Post coverage comment to PR | ||
# uses: machine-learning-apps/[email protected] | ||
# env: | ||
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
# with: | ||
# path: coverage.txt | ||
# regex: '^total:\\s*\\(statements\\)\\s*([0-9\\.]+)%' | ||
# message: "Code coverage on this PR is **${{ match }}%**. Please ensure this meets the project standards." | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
path-to-lcov: coverage.lcov | ||
flag-name: run-flags-1 # Optional: Custom flag name for parallel builds |