Skip to content
Open
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
22 changes: 19 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,33 @@ jobs:
- name: Download dependencies
run: go mod download

- name: Run tests
- name: Run tests with coverage
shell: bash
run: go test -v -race -coverprofile=coverage.out ./...
run: go test -coverprofile=coverage.out -covermode=atomic ./...

- name: Upload coverage
- name: Generate coverage report
if: matrix.os == 'ubuntu-latest' && matrix.go-version == '1.22'
run: |
go tool cover -func=coverage.out
go tool cover -html=coverage.out -o coverage.html

- name: Upload coverage to Codecov
if: matrix.os == 'ubuntu-latest' && matrix.go-version == '1.22'
uses: codecov/codecov-action@v4
with:
files: coverage.out
fail_ci_if_error: false

- name: Upload coverage artifacts
if: matrix.os == 'ubuntu-latest' && matrix.go-version == '1.22'
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: |
coverage.out
coverage.html
retention-days: 14

lint:
name: Lint
runs-on: ubuntu-latest
Expand Down
15 changes: 11 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,19 @@ test:
@echo "$(BLUE)Running tests...$(NC)"
$(GO) test -v -race ./...

# Run tests with coverage
.PHONY: test-coverage
# Test coverage
.PHONY: test-coverage test-coverage-view

test-coverage:
@echo "$(BLUE)Running tests with coverage...$(NC)"
$(GO) test -v -race -coverprofile=coverage.out ./...
$(GO) test -coverprofile=coverage.out -covermode=atomic ./...
$(GO) tool cover -html=coverage.out -o coverage.html
@echo "$(GREEN)✓ Coverage report: coverage.html$(NC)"
@echo "$(GREEN)✓ Coverage report generated$(NC)"
$(GO) tool cover -func=coverage.out

test-coverage-view: test-coverage
@echo "$(BLUE)Opening coverage report...$(NC)"
open coverage.html

# Run integration tests (opt-in, requires credentials)
.PHONY: test-integration
Expand Down Expand Up @@ -221,6 +227,7 @@ help:
@echo "$(BLUE)Test:$(NC)"
@echo " test Run tests"
@echo " test-coverage Run tests with coverage report"
@echo " test-coverage-view Run tests with coverage and open report in browser"
@echo " test-integration Run integration tests (requires credentials)"
@echo ""
@echo "$(BLUE)Quality:$(NC)"
Expand Down
Loading