Skip to content

Commit 55b586b

Browse files
committed
chore(makefile): reorganize coverage file structure and update clean command
This commit modifies the Makefile to create a dedicated coverage directory for coverage reports, enhancing organization. It also updates the clean command to remove the coverage directory along with build artifacts. Additionally, the .gitignore file is updated to include the new coverage directory, ensuring that coverage reports are excluded from version control.
1 parent 4775c44 commit 55b586b

File tree

6 files changed

+31
-27
lines changed

6 files changed

+31
-27
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ jobs:
4848
exit 1
4949
fi
5050
;;
51+
refactor/*)
52+
if [ "$TARGET_BRANCH" != "develop" ]; then
53+
echo "❌ Refactor branches can only target 'develop', not '$TARGET_BRANCH'"
54+
exit 1
55+
fi
56+
;;
5157
hotfix/*)
5258
if [ "$TARGET_BRANCH" != "master" ]; then
5359
echo "❌ Hotfix branches can only target 'master', not '$TARGET_BRANCH'"
@@ -72,6 +78,7 @@ jobs:
7278
echo " - enhancement/name (→ develop)"
7379
echo " - feature/name (→ develop)"
7480
echo " - fix/name (→ develop)"
81+
echo " - refactor/name (→ develop)"
7582
echo " - hotfix/name (→ master)"
7683
echo " - release/yyyy-mm-dd (develop → master)"
7784
exit 1

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,6 @@ tmp/
6969
temp/
7070

7171
# Database
72-
**/db/
72+
**/db/
73+
74+
coverage/

Makefile

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ BINARY_PATH := $(BINARY_DIR)/$(APP_NAME)
88
MAIN_PATH := ./cmd/quiver
99
DOCKER_IMAGE := quiver:latest
1010
GO_VERSION := 1.24.2
11-
COVERAGE_FILE := coverage.out
12-
COVERAGE_HTML := coverage.html
11+
COVERAGE_DIR := coverage
12+
COVERAGE_FILE := $(COVERAGE_DIR)/coverage.out
13+
COVERAGE_HTML := $(COVERAGE_DIR)/coverage.html
1314
ICON_DIR := cmd/quiver/assets/icons
1415
ICON_SOURCE := cmd/quiver/assets/icons/app.ico
1516

@@ -94,6 +95,13 @@ build: clean deps fmt vet
9495
@CGO_ENABLED=0 go build $(BUILD_FLAGS) $(LDFLAGS) -o $(BINARY_PATH) $(MAIN_PATH)
9596
@echo "$(GREEN)Build completed: $(BINARY_PATH)$(NC)"
9697

98+
# Clean build artifacts and coverage files
99+
clean:
100+
@echo "$(BLUE)Cleaning build artifacts...$(NC)"
101+
@rm -rf $(BINARY_DIR)
102+
@rm -rf $(COVERAGE_DIR)
103+
@echo "$(GREEN)Clean completed!$(NC)"
104+
97105
# Run the application locally
98106
run:
99107
@echo "$(BLUE)Starting $(APP_NAME)...$(NC)"
@@ -108,6 +116,7 @@ test:
108116
# Run tests with coverage
109117
test-coverage:
110118
@echo "$(BLUE)Running tests with coverage...$(NC)"
119+
@mkdir -p $(COVERAGE_DIR)
111120
@go test -race -ldflags="-s -w" -coverprofile=$(COVERAGE_FILE) -covermode=atomic ./... 2>&1 | grep -v "malformed LC_DYSYMTAB"
112121
@go tool cover -html=$(COVERAGE_FILE) -o $(COVERAGE_HTML)
113122
@go tool cover -func=$(COVERAGE_FILE)
@@ -116,11 +125,13 @@ test-coverage:
116125
# Run tests in Docker container
117126
test-docker:
118127
@echo "$(BLUE)Running tests in Docker...$(NC)"
128+
@mkdir -p $(COVERAGE_DIR)
119129
@docker run --rm -v $(PWD):/app -w /app golang:$(GO_VERSION)-alpine sh -c "\
120130
apk add --no-cache git make gcc musl-dev && \
121131
go mod download && \
122-
CGO_ENABLED=1 go test -race -ldflags=\"-s -w\" -coverprofile=coverage.out -covermode=atomic ./... && \
123-
go tool cover -func=coverage.out"
132+
mkdir -p $(COVERAGE_DIR) && \
133+
CGO_ENABLED=1 go test -race -ldflags=\"-s -w\" -coverprofile=$(COVERAGE_FILE) -covermode=atomic ./... && \
134+
go tool cover -func=$(COVERAGE_FILE)"
124135
@echo "$(GREEN)Docker tests completed!$(NC)"
125136

126137
# Run linting checks
@@ -163,7 +174,7 @@ validate-branch:
163174
@echo "$(BLUE)Validating current branch for PR...$(NC)"
164175
@CURRENT_BRANCH=$$(git branch --show-current); \
165176
case "$$CURRENT_BRANCH" in \
166-
enhancement/*|feature/*|fix/*) \
177+
enhancement/*|feature/*|fix/*|refactor/*) \
167178
echo "$(GREEN)✓ Branch '$$CURRENT_BRANCH' can create PR to develop$(NC)"; \
168179
;; \
169180
hotfix/*) \
@@ -181,6 +192,7 @@ validate-branch:
181192
echo " - enhancement/name"; \
182193
echo " - feature/name"; \
183194
echo " - fix/name"; \
195+
echo " - refactor/name"; \
184196
echo " - hotfix/name"; \
185197
echo " - release/yyyy-mm-dd"; \
186198
exit 1; \
@@ -191,6 +203,7 @@ validate-branch:
191203
pr-checks: validate-branch clean deps fmt vet lint security test-coverage build
192204
@echo "$(BLUE)Running comprehensive PR checks...$(NC)"
193205
@echo "$(BLUE)Checking test coverage...$(NC)"
206+
@mkdir -p $(COVERAGE_DIR)
194207
@go test -race -ldflags="-s -w" -coverprofile=$(COVERAGE_FILE) -covermode=atomic ./... 2>&1 | grep -v "malformed LC_DYSYMTAB"
195208
@COVERAGE=$$(go tool cover -func=$(COVERAGE_FILE) | grep total | awk '{print $$3}' | sed 's/%//'); \
196209
echo "Overall coverage: $$COVERAGE%"; \
Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,9 @@ runtime:
4848
methods:
4949
- name: "install"
5050
actions:
51-
- "curl -fsSL https://quiver.ar/quiver/install.sh | bash"
52-
- "./quiver"
51+
- cmd: "curl -fsSL https://quiver.ar/quiver/install.sh | bash"
52+
on_failure: error
53+
- cmd: "./quiver"
5354
- name: "update"
5455
actions:
5556
- "curl -fsSL https://quiver.ar/quiver/update.sh | bash"
@@ -59,22 +60,3 @@ runtime:
5960
- name: "run"
6061
actions:
6162
- "./quiver"
62-
- platforms:
63-
- "windows/amd64"
64-
- "windows/arm64"
65-
methods:
66-
- name: "install"
67-
actions:
68-
- "GET https://quiver.ar/quiver/install.exe"
69-
- "./install.exe"
70-
- name: "update"
71-
actions:
72-
- "GET https://quiver.ar/quiver/update.exe"
73-
- "./update.exe"
74-
- name: "uninstall"
75-
actions:
76-
- "GET https://quiver.ar/quiver/uninstall.exe"
77-
- "./uninstall.exe"
78-
- name: "run"
79-
actions:
80-
- "exec ./quiver.exe"

0 commit comments

Comments
 (0)