Skip to content

Commit 062a0b4

Browse files
committed
Clean up
1 parent f0aa63d commit 062a0b4

File tree

6 files changed

+46
-239
lines changed

6 files changed

+46
-239
lines changed

.github/workflows/ci.yml

Lines changed: 21 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -2,50 +2,17 @@ name: CI Pipeline
22

33
on:
44
push:
5-
branches: [ main, develop ]
5+
branches: [ main ]
66
pull_request:
7-
branches: [ main, develop ]
7+
branches: [ main ]
88

99
env:
1010
GO_VERSION: '1.23.x'
1111

1212
jobs:
13-
# Lint and Format Check
14-
lint:
15-
name: Lint and Format
16-
runs-on: ubuntu-latest
17-
steps:
18-
- name: Checkout code
19-
uses: actions/checkout@v4
20-
21-
- name: Set up Go
22-
uses: actions/setup-go@v5
23-
with:
24-
go-version: ${{ env.GO_VERSION }}
25-
- name: Run golangci-lint
26-
uses: golangci/golangci-lint-action@v8
27-
with:
28-
version: v2.3.1
29-
30-
# Schema and Example Validation
31-
validate:
32-
name: Validate Schemas and Examples
33-
runs-on: ubuntu-latest
34-
steps:
35-
- name: Checkout code
36-
uses: actions/checkout@v4
37-
38-
- name: Set up Go
39-
uses: actions/setup-go@v5
40-
with:
41-
go-version: ${{ env.GO_VERSION }}
42-
43-
- name: Validate schemas and examples
44-
run: make validate
45-
46-
# Build check
47-
build:
48-
name: Build Check
13+
# Build, Lint, and Validate
14+
build-lint-validate:
15+
name: Build, Lint, and Validate
4916
runs-on: ubuntu-latest
5017
steps:
5118
- name: Checkout code
@@ -69,6 +36,16 @@ jobs:
6936
- name: Download dependencies
7037
run: go mod download
7138

39+
- name: Install golangci-lint
40+
run: |
41+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v2.3.1
42+
43+
- name: Run lint
44+
run: make lint
45+
46+
- name: Validate schemas and examples
47+
run: make validate
48+
7249
- name: Build application
7350
run: make build
7451

@@ -77,11 +54,11 @@ jobs:
7754
go install golang.org/x/vuln/cmd/govulncheck@latest
7855
govulncheck ./...
7956
80-
# Unit Tests
81-
unit-tests:
82-
name: Unit Tests
57+
# All Tests
58+
tests:
59+
name: Tests
8360
runs-on: ubuntu-latest
84-
needs: [lint, validate, build]
61+
needs: build-lint-validate
8562
steps:
8663
- name: Checkout code
8764
uses: actions/checkout@v4
@@ -104,8 +81,8 @@ jobs:
10481
- name: Download dependencies
10582
run: go mod download
10683

107-
- name: Run unit tests
108-
run: make test
84+
- name: Run all tests
85+
run: make test-all
10986

11087
- name: Upload coverage to Codecov
11188
uses: codecov/codecov-action@v4
@@ -114,52 +91,3 @@ jobs:
11491
flags: unittests
11592
name: codecov-unit
11693
fail_ci_if_error: false
117-
118-
# Integration Tests
119-
integration-tests:
120-
name: Integration Tests
121-
runs-on: ubuntu-latest
122-
needs: [lint, validate, build]
123-
steps:
124-
- name: Checkout code
125-
uses: actions/checkout@v4
126-
127-
- name: Set up Go
128-
uses: actions/setup-go@v5
129-
with:
130-
go-version: ${{ env.GO_VERSION }}
131-
132-
- name: Cache Go modules
133-
uses: actions/cache@v4
134-
with:
135-
path: |
136-
~/.cache/go-build
137-
~/go/pkg/mod
138-
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
139-
restore-keys: |
140-
${{ runner.os }}-go-
141-
142-
- name: Download dependencies
143-
run: go mod download
144-
145-
- name: Run integration tests
146-
run: make integration-test
147-
148-
# Overall status check
149-
test-summary:
150-
name: Test Summary
151-
runs-on: ubuntu-latest
152-
needs: [unit-tests, integration-tests]
153-
if: always()
154-
steps:
155-
- name: Check test results
156-
run: |
157-
if [[ "${{ needs.unit-tests.result }}" == "success" && "${{ needs.integration-tests.result }}" == "success" ]]; then
158-
echo "✅ All tests passed!"
159-
exit 0
160-
else
161-
echo "❌ Some tests failed:"
162-
echo " Unit tests: ${{ needs.unit-tests.result }}"
163-
echo " Integration tests: ${{ needs.integration-tests.result }}"
164-
exit 1
165-
fi

.github/workflows/integration-tests.yml

Lines changed: 0 additions & 52 deletions
This file was deleted.

.github/workflows/unit-tests.yml

Lines changed: 0 additions & 63 deletions
This file was deleted.

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ cmd/registry/registry
88
validate-examples
99
validate-schemas
1010
.idea/
11+
coverage.out
12+
coverage.html

Makefile

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: help build test lint lint-fix validate validate-schemas validate-examples integration-test check dev-local dev-compose clean docker publisher coverage
1+
.PHONY: help build test test-unit test-integration test-endpoints test-publish test-all lint lint-fix validate validate-schemas validate-examples check pre-commit ci dev-local dev-compose clean publisher
22

33
# Default target
44
help: ## Show this help message
@@ -12,14 +12,17 @@ build: ## Build the registry application
1212
publisher: ## Build the publisher tool
1313
cd tools/publisher && ./build.sh
1414

15-
docker: ## Build Docker image
16-
docker build -t registry .
17-
1815
# Test targets
19-
test: ## Run unit tests
16+
test-unit: ## Run unit tests with coverage
2017
go test -v -race -coverprofile=coverage.out -covermode=atomic ./internal/...
18+
go tool cover -html=coverage.out -o coverage.html
19+
@echo "Coverage report generated: coverage.html"
20+
21+
test: ## Run unit tests (use 'make test-all' to run all tests)
22+
@echo "⚠️ Running unit tests only. Use 'make test-all' to run both unit and integration tests."
23+
@$(MAKE) test-unit
2124

22-
integration-test: ## Run integration tests
25+
test-integration: ## Run integration tests
2326
./tests/integration/run.sh
2427

2528
test-endpoints: ## Test API endpoints (requires running server)
@@ -28,6 +31,8 @@ test-endpoints: ## Test API endpoints (requires running server)
2831
test-publish: ## Test publish endpoint (requires BEARER_TOKEN env var)
2932
./scripts/test_publish.sh
3033

34+
test-all: test-unit test-integration ## Run all tests (unit and integration)
35+
3136
# Validation targets
3237
validate-schemas: ## Validate JSON schemas
3338
./tools/validate-schemas.sh
@@ -37,34 +42,29 @@ validate-examples: ## Validate examples against schemas
3742

3843
validate: validate-schemas validate-examples ## Run all validation checks
3944

40-
# Code quality targets
45+
# Lint targets
4146
lint: ## Run linter (includes formatting)
4247
golangci-lint run --timeout=5m
4348

4449
lint-fix: ## Run linter with auto-fix (includes formatting)
4550
golangci-lint run --fix --timeout=5m
4651

4752
# Combined targets
48-
check: lint validate test ## Run all checks (lint, validate, test)
49-
50-
pre-commit: check integration-test ## Run all pre-commit checks
51-
@echo "All pre-commit checks passed!"
53+
check: lint validate test-all ## Run all checks (lint, validate, unit tests)
54+
@echo "All checks passed!"
5255

5356
# Development targets
54-
dev-compose: ## Start development environment with Docker Compose
55-
docker compose up
57+
dev-compose: ## Start development environment with Docker Compose (builds image automatically)
58+
docker compose up --build
5659

5760
dev-local: ## Run registry locally (requires MongoDB)
5861
go run cmd/registry/main.go
5962

6063
# Cleanup
6164
clean: ## Clean build artifacts and coverage files
6265
rm -f registry
63-
rm -f coverage.out
66+
rm -f coverage.out coverage.html
6467
cd tools/publisher && rm -f publisher
6568

66-
# Coverage
67-
coverage: ## Generate test coverage report
68-
go test -v -race -coverprofile=coverage.out -covermode=atomic ./internal/...
6969

7070
.DEFAULT_GOAL := help

0 commit comments

Comments
 (0)