Skip to content

chore: update repository references from godaddy to agentnameservice … #77

chore: update repository references from godaddy to agentnameservice …

chore: update repository references from godaddy to agentnameservice … #77

Workflow file for this run

# CI workflow for ans-sdk-go
# Runs build, tests with coverage enforcement, and linting on pushes/PRs to main.
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
permissions:
contents: read
jobs:
# Build all packages and run tests with race detection and coverage.
# Enforces a minimum 90% coverage threshold.
build-and-test:
name: Build & Test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 #v6.0.3
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c #v6.4.0
with:
go-version: "1.26.x"
- name: Build
run: go build ./...
- name: Run tests with coverage
run: go test -race -coverprofile=coverage.out -covermode=atomic ./...
- name: Check coverage threshold
run: |
# Parse the total coverage percentage from the coverage report
COVERAGE=$(go tool cover -func=coverage.out | grep '^total:' | awk '{print $NF}' | tr -d '%')
echo "Total coverage: ${COVERAGE}%"
# Fail if coverage is below 90%
THRESHOLD=90
if [ "$(echo "${COVERAGE} < ${THRESHOLD}" | bc -l)" -eq 1 ]; then
echo "::error::Coverage ${COVERAGE}% is below the required ${THRESHOLD}% threshold"
exit 1
fi
echo "Coverage ${COVERAGE}% meets the ${THRESHOLD}% threshold"
- name: Upload coverage artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a #v7.0.1
with:
name: coverage-report
path: coverage.out
retention-days: 30
# Run golangci-lint with v2 config, only checking changes relative to main.
lint:
name: Lint
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- name: Checkout code
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 #v6.0.3
with:
# Full history is required for --new-from-merge-base to work
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c #v6.4.0
with:
go-version: "1.26.x"
- name: Run golangci-lint
uses: golangci/golangci-lint-action@82606bf257cbaff209d206a39f5134f0cfbfd2ee #v9.2.1
with:
# golangci-lint v2 is required for the v2 config format
version: v2.10.1
# Optional: golangci-lint command line arguments.
args: --verbose --concurrency=4 --allow-parallel-runners
# Optional: show only new issues if it's a pull request. The default value is `false`.
only-new-issues: true