go.mod requires go 1.25.6 but the workflow was requesting go-version: '1.24'. With GOTOOLCHAIN=auto (the default), the runner auto-downloaded Go 1.25.6 which lacked the covdata sub-tool, causing the test job to fail with 'go: no such tool covdata' for all cmd/* packages. Changes: - Bump go-version from '1.24' to '1.25' to match the go.mod directive - Add a 'Pin toolchain' step that sets GOTOOLCHAIN=local, preventing any further auto-upgrade surprises regardless of future go.mod bumps Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: multica-agent <github@multica.ai>
73 lines
1.9 KiB
YAML
73 lines
1.9 KiB
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.25'
|
|
cache: true
|
|
|
|
- name: Pin toolchain
|
|
run: echo "GOTOOLCHAIN=local" >> $GITHUB_ENV
|
|
|
|
- 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 ./...
|
|
|
|
docker:
|
|
runs-on: ubuntu-latest
|
|
needs: test
|
|
if: github.event_name == 'push'
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Log in to registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: gitea.hansenits.com.au
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
- name: Build and push CLI image
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
file: Dockerfile.cli
|
|
push: true
|
|
tags: |
|
|
gitea.hansenits.com.au/hits/exploredns-cli:latest
|
|
gitea.hansenits.com.au/hits/exploredns-cli:${{ github.sha }}
|
|
|
|
- name: Build and push web image
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
file: Dockerfile.web
|
|
push: true
|
|
tags: |
|
|
gitea.hansenits.com.au/hits/exploredns-web:latest
|
|
gitea.hansenits.com.au/hits/exploredns-web:${{ github.sha }}
|