-
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
1 parent
8c52af8
commit 71a205a
Showing
1 changed file
with
34 additions
and
0 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 |
---|---|---|
|
@@ -18,6 +18,10 @@ jobs: | |
with: | ||
go-version-file: go.mod | ||
cache-dependency-path: "**/go.sum" | ||
- name: Setup Swagger | ||
run: > | ||
go install -v github.com/swaggo/swag/cmd/[email protected] | ||
swag init -g cmd/main.go | ||
- uses: golangci/golangci-lint-action@v6 | ||
with: | ||
version: v1.60 | ||
|
@@ -32,6 +36,10 @@ jobs: | |
with: | ||
go-version-file: go.mod | ||
cache-dependency-path: "**/go.sum" | ||
- name: Setup Swagger | ||
run: > | ||
go install -v github.com/swaggo/swag/cmd/[email protected] | ||
swag init -g cmd/main.go | ||
- name: Run tests | ||
run: make test | ||
|
||
|
@@ -58,5 +66,31 @@ jobs: | |
with: | ||
go-version-file: go.mod | ||
cache-dependency-path: "**/go.sum" | ||
|
||
- id: govulncheck | ||
uses: golang/govulncheck-action@v1 | ||
|
||
test-coverage: | ||
name: Test Coverage | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: go.mod | ||
cache-dependency-path: "**/go.sum" | ||
- name: Generate coverage report | ||
run: go test -coverprofile=coverage.out ./... | ||
- name: Check coverage | ||
id: coverage | ||
run: | | ||
coverage=$(go tool cover -func=coverage.out | grep total | awk ‘{print substr($3, 1, length($3)-1)}’) | ||
echo “total_coverage=$coverage” >> $GITHUB_OUPUT | ||
echo “Coverage: $coverage%” | ||
- name: Fail if coverage is below threshold | ||
run: | | ||
if (( $(echo “$total_coverage < 50” | bc -l) )); then | ||
echo “Coverage ($total_coverage%) is below the threshold (50%)” | ||
exit 1 | ||
fi |