38 lines
838 B
YAML
38 lines
838 B
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches-ignore: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
lint-test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version: '1.22'
|
|
|
|
- name: Tidy
|
|
run: go mod tidy
|
|
|
|
- name: Lint
|
|
uses: golangci/golangci-lint-action@v6
|
|
with:
|
|
version: latest
|
|
|
|
- name: Test
|
|
run: go test ./... -coverprofile=coverage.out -covermode=atomic
|
|
|
|
- name: Coverage Check
|
|
run: |
|
|
COVERAGE=$(go tool cover -func=coverage.out | grep total | awk '{print $3}' | tr -d '%')
|
|
echo "Coverage: ${COVERAGE}%"
|
|
if (( $(echo "$COVERAGE < 85" | bc -l) )); then
|
|
echo "::error::Coverage ${COVERAGE}% is below 85%"
|
|
exit 1
|
|
fi
|