Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions .github/workflows/publish-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,17 @@ jobs:
test:
name: Run tests and collect coverage
runs-on: ubuntu-latest
services:
docker:
image: docker:dind
options: >-
--privileged
--health-cmd="docker ps"
Copy link

Copilot AI Dec 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The health check command docker ps will not work correctly with the Docker-in-Docker setup as configured. Inside the docker:dind container, the docker CLI client may not be available or properly configured to connect to the daemon. The default health check for docker:dind is typically dockerd-healthcheck or you can use wget -O- http://localhost:2375/_ping if exposing the Docker API. Consider using the image's built-in health check or a more appropriate command.

Suggested change
--health-cmd="docker ps"
--health-cmd="dockerd-healthcheck"

Copilot uses AI. Check for mistakes.
--health-interval=10s
--health-timeout=5s
--health-retries=5
volumes:
- /var/run/docker.sock:/var/run/docker.sock
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -24,10 +35,22 @@ jobs:
- name: Install dependencies
run: go mod download

- name: Run tests
run: go test -coverprofile=coverage.txt ./...
- name: Run unit tests with coverage
run: go test -coverprofile=coverage-unit.txt -covermode=atomic ./...
Copy link

Copilot AI Dec 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The unit tests will also execute integration tests because the -tags=integration build tag only controls which files are compiled, not which tests run. Running go test ./... without excluding the integration tag will compile and run ALL tests including integration tests (since files without build tags are always compiled). This means:

  1. Integration tests will run twice (once in line 39, once in line 44)
  2. The "unit" coverage report will actually include integration test coverage

To fix this, you should either:

  • Skip integration tests in the unit test step using: go test -short -coverprofile=coverage-unit.txt -covermode=atomic ./... (and ensure all integration tests check testing.Short())
  • Or exclude integration test files explicitly from the unit test run
Suggested change
run: go test -coverprofile=coverage-unit.txt -covermode=atomic ./...
run: go test -short -coverprofile=coverage-unit.txt -covermode=atomic ./...

Copilot uses AI. Check for mistakes.

- name: Run integration tests with coverage
env:
DOCKER_HOST: unix:///var/run/docker.sock
run: go test -tags=integration -coverprofile=coverage-integration.txt -covermode=atomic ./...

- name: Merge coverage reports
run: |
Copy link

Copilot AI Dec 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The merge coverage reports step could fail silently if one of the coverage files doesn't exist. Consider adding error checking to ensure both coverage files were generated before attempting to merge them:

- name: Merge coverage reports
  run: |
    if [ ! -f coverage-unit.txt ] || [ ! -f coverage-integration.txt ]; then
      echo "Error: One or more coverage files are missing"
      exit 1
    fi
    go install github.com/wadey/gocovmerge@latest
    gocovmerge coverage-unit.txt coverage-integration.txt > coverage.txt
Suggested change
run: |
run: |
if [ ! -f coverage-unit.txt ] || [ ! -f coverage-integration.txt ]; then
echo "Error: One or more coverage files are missing"
exit 1
fi

Copilot uses AI. Check for mistakes.
go install github.com/wadey/gocovmerge@latest
gocovmerge coverage-unit.txt coverage-integration.txt > coverage.txt

- name: Upload results to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.txt
fail_ci_if_error: true
Loading