Skip to content

Commit

Permalink
ci(github-actions)
Browse files Browse the repository at this point in the history
  • Loading branch information
pzentenoe committed Aug 10, 2024
1 parent 2d5ba15 commit 9ba515b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 303 deletions.
25 changes: 14 additions & 11 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,20 @@ jobs:
- name: Update dependencies
run: go mod tidy

- name: Install go-acc
run: go install github.com/ory/go-acc@latest
- name: Test with Coverage
run: go test ./... -coverprofile=coverage.out -covermode=atomic

- name: Generate Coverage Report in LCOV format
run: go-acc --covermode=atomic --output=coverage.lcov ./...

- name: Upload coverage to Coveralls
uses: coverallsapp/github-action@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: coverage.lcov
- name: Check Coverage
run: |
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 < 60" |bc -l) )); then
echo "Test coverage is below 60%"
exit 1
fi
env:
GO111MODULE: on

- name: Install golangci-lint
run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin latest
Expand All @@ -61,7 +64,7 @@ jobs:
args: >
-Dsonar.projectKey=go-cache
-Dsonar.sources=.
-Dsonar.go.coverage.reportPaths=coverage.lcov
-Dsonar.go.coverage.reportPaths=coverage.out
-Dsonar.exclusions=**/*_test.go,**/main.go
-Dsonar.qualitygate.wait=true
-Dsonar.qualitygate.timeout=300
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out
coverage.out
coverage.txt
coverage.lcov
coverage.xml

# Dependency directories (remove the comment below to include it)
# vendor/
Expand Down
291 changes: 0 additions & 291 deletions coverage.lcov

This file was deleted.

0 comments on commit 9ba515b

Please sign in to comment.