36 lines
876 B
YAML
36 lines
876 B
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main, master]
|
|
pull_request:
|
|
branches: [main, master]
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version: '1.24'
|
|
cache: true
|
|
|
|
- name: Vet
|
|
run: go vet ./...
|
|
|
|
- name: Test
|
|
run: go test -v -race -coverprofile=coverage.out ./...
|
|
|
|
- name: Coverage report
|
|
run: go tool cover -func=coverage.out
|
|
|
|
- name: Check internal package coverage
|
|
run: |
|
|
COVERAGE=$(go tool cover -func=coverage.out | grep "^github.com/hits/ExploreDNS/internal" | awk '{print $3}' | sed 's/%//' | awk '{sum+=$1; count++} END {if(count>0) print sum/count; else print 0}')
|
|
echo "Average internal package coverage: ${COVERAGE}%"
|
|
|
|
- name: Build
|
|
run: go build -v ./...
|