Skip to content

Commit

Permalink
Fix sonarqube scanner
Browse files Browse the repository at this point in the history
  • Loading branch information
pzentenoe committed May 30, 2024
1 parent 579a8a5 commit 83b6621
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Go
name: CI

on:
push:
Expand All @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set up Go 1.22
uses: actions/setup-go@v3
Expand All @@ -29,20 +29,19 @@ jobs:
restore-keys: |
${{ runner.os }}-go-
# Agregado: Paso para actualizar dependencias con go mod tidy
- name: Update dependencies
run: go mod tidy

- name: Test with Coverage
run: go test ./... -coverprofile=coverage.txt -covermode=atomic
run: go test ./... -coverprofile=coverage.out -covermode=atomic

- name: Check Coverage
run: |
go tool cover -func=coverage.txt -o coverage-summary.txt
COVERAGE=$(go tool cover -func=coverage.txt | grep total: | awk '{print substr($3, 1, length($3)-1)}')
go tool cover -func=coverage.out -o coverage-summary.txt
COVERAGE=$(go tool cover -func=coverage.out | grep total: | awk '{print substr($3, 1, length($3)-1)}')
echo "Total test coverage: $COVERAGE%"
if (( $(echo "$COVERAGE < 70" |bc -l) )); then
echo "Test coverage is below 70%"
if (( $(echo "$COVERAGE < 60" |bc -l) )); then
echo "Test coverage is below 60%"
exit 1
fi
env:
Expand Down

0 comments on commit 83b6621

Please sign in to comment.