Skip to content

Commit 128ed2d

Browse files
committed
fix: add make commands in github workflows
1 parent be1ddf5 commit 128ed2d

File tree

2 files changed

+41
-10
lines changed

2 files changed

+41
-10
lines changed

.github/workflows/test.yml

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,7 @@ jobs:
1818
- name: Set up Go
1919
uses: actions/setup-go@v5
2020
- name: Check formatting
21-
run: |
22-
unformatted=$(gofmt -l .)
23-
if [ -n "$unformatted" ]; then
24-
echo "The following files are not properly formatted:"
25-
echo "$unformatted"
26-
exit 1
27-
fi
28-
echo "All Go files are properly formatted"
21+
run: make fmt
2922

3023
test:
3124
runs-on: ubuntu-latest
@@ -40,7 +33,7 @@ jobs:
4033
with:
4134
go-version: ${{ matrix.go }}
4235
- name: Test
43-
run: go test -v ./...
36+
run: make test
4437

4538
race-test:
4639
runs-on: ubuntu-latest
@@ -52,4 +45,4 @@ jobs:
5245
with:
5346
go-version: '1.24'
5447
- name: Test with -race
55-
run: go test -v -race ./...
48+
run: make race

Makefile

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Makefile for MCP Go SDK
2+
# Simplified version to run CI checks locally
3+
4+
.DEFAULT_GOAL := help
5+
6+
help: ## Show available targets
7+
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "%-15s %s\n", $$1, $$2}' $(MAKEFILE_LIST)
8+
9+
fmt: ## Check code formatting
10+
@unformatted=$$(gofmt -l .); \
11+
if [ -n "$$unformatted" ]; then \
12+
echo "The following files are not properly formatted:"; \
13+
echo "$$unformatted"; \
14+
exit 1; \
15+
fi; \
16+
echo "All Go files are properly formatted"
17+
18+
test: ## Run tests
19+
go test -v ./...
20+
21+
race: ## Run tests with race detector
22+
go test -v -race ./...
23+
24+
lint: ## Run golangci-lint
25+
@if command -v golangci-lint >/dev/null 2>&1; then \
26+
golangci-lint run; \
27+
else \
28+
echo "golangci-lint not found. Install with:"; \
29+
echo "go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest"; \
30+
fi
31+
32+
ci: fmt test race ## Run all CI checks locally
33+
@echo "All CI checks passed!"
34+
35+
install-lint: ## Install golangci-lint
36+
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
37+
38+
.PHONY: help fmt test race lint ci install-lint

0 commit comments

Comments
 (0)