Skip to content

Merge pull request #26 from zostay/trim-to-only #46

Merge pull request #26 from zostay/trim-to-only

Merge pull request #26 from zostay/trim-to-only #46

Workflow file for this run

name: Test Application
on:
push:
jobs:
run-tests:
name: Run Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.20'
cache: false
- uses: golangci/golangci-lint-action@v6
with:
version: v1.59
- run: go test -v ./...
- run: |
coveredFiles=$(go list ./... | grep -v 'github.com/zostay/today/\(cmd\|tools/gen/verses\)')
go test $coveredFiles -coverprofile=coverage.out
- run: go tool cover -func=coverage.out
- name: Coverage Quality Check
env:
REQUIRED_COVERAGE: 95
run: |
totalCoverage=$(go tool cover -func=coverage.out | grep total | grep -Eo '[0-9]+\.[0-9]+')
echo "Total Coverage: $totalCoverage %"
if (( $(echo "$totalCoverage < $REQUIRED_COVERAGE" | bc -l) )); then
echo "Coverage is less than $REQUIRED_COVERAGE %"
exit 1
fi