Files
Devour/.github/workflows/quality.yml
dependabot[bot]andGitHub 3455346ba9 ci(deps): bump actions/setup-go from 5 to 6
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 5 to 6.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](https://github.com/actions/setup-go/compare/v5...v6)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
2026-02-22 09:47:13 +00:00

87 lines
2.2 KiB
YAML

name: Code Quality
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
jobs:
quality-check:
name: Quality Analysis
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: '1.24'
- name: Run go vet
run: go vet ./...
- name: Run go fmt check
run: |
if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then
echo "The following files are not formatted:"
gofmt -s -l .
exit 1
fi
- name: Run ineffassign
run: |
go install github.com/gordonklaus/ineffassign@latest
ineffassign ./...
- name: Run misspell
run: |
go install github.com/client9/misspell/cmd/misspell@latest
misspell -error .
- name: Run staticcheck
run: |
go install honnef.co/go/tools/cmd/staticcheck@latest
staticcheck ./...
- name: Check for TODO/FIXME comments
run: |
if grep -r "TODO\|FIXME" --include="*.go" .; then
echo "Found TODO/FIXME comments. Please address them or add to issue tracker."
exit 1
fi
- name: Run go mod tidy check
run: |
go mod tidy
if [[ -n $(git status --porcelain go.mod go.sum) ]]; then
echo "go.mod or go.sum is not tidy"
git diff go.mod go.sum
exit 1
fi
- name: Calculate code coverage
run: |
go test -coverprofile=coverage.out ./...
go tool cover -func=coverage.out | grep total | awk '{print $3}' | sed 's/%//' > coverage.txt
echo "Coverage: $(cat coverage.txt)%"
- name: Check coverage threshold
run: |
COVERAGE=$(cat coverage.txt)
THRESHOLD=80
if (( $(echo "$COVERAGE < $THRESHOLD" | bc -l) )); then
echo "Coverage $COVERAGE% is below threshold $THRESHOLD%"
exit 1
fi
echo "Coverage $COVERAGE% meets threshold $THRESHOLD%"
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}