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

build(fix): [#69] Merge unit and integration test code coverage #70

Merged
merged 1 commit into from
Sep 23, 2024
Merged
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
29 changes: 12 additions & 17 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,18 +95,6 @@ runs:
#
# Unit tests.
#
- name: code coverage
shell: bash
run: |
go test -v -coverpkg=./... -coverprofile=profile.cov ./...
code_coverage_actual=$(go tool cover -func profile.cov |\
grep total: |\
awk '{print $3}' |\
sed 's/%//')
if (( $(echo "${{ inputs.code_coverage_expected }} > ${code_coverage_actual}" | bc -l) )); then
echo "The actual code coverage: '${code_coverage_actual}' is too low. Expected: '${{ inputs.code_coverage_expected }}'."
exit 1
fi
- name: unit tests
shell: bash
run: |
Expand All @@ -117,18 +105,25 @@ runs:
-v \
$(go list ./... | grep -v '${{ inputs.golang-unit-tests-exclusions }}')
#
# Both unit and integration tests including code coverage.
# Unit & integration tests including code coverage.
#
- name: unit & integrations tests and code coverage
shell: bash
run: |
go test \
--tags=integration \
-cover \
-covermode=atomic \
-coverprofile=coverage.txt \
-coverpkg=./... \
-coverprofile=profile.cov \
-p ${{ inputs.golang-number-of-tests-in-parallel }} \
-race \
-short \
--tags=integration \
sbp-bvanb marked this conversation as resolved.
Show resolved Hide resolved
-v \
$(go list ./... | grep -v '${{ inputs.golang-unit-tests-exclusions }}')
code_coverage_actual=$(go tool cover -func profile.cov |\
grep total: |\
awk '{print $3}' |\
sed 's/%//')
if (( $(echo "${{ inputs.code_coverage_expected }} > ${code_coverage_actual}" | bc -l) )); then
echo "The actual code coverage: '${code_coverage_actual}' is too low. Expected: '${{ inputs.code_coverage_expected }}'."
exit 1
fi
Loading