Skip to content

Commit

Permalink
add dev tools configs
Browse files Browse the repository at this point in the history
  • Loading branch information
micpst committed Mar 31, 2024
1 parent 62fd3d5 commit 944a76f
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 9 deletions.
11 changes: 11 additions & 0 deletions .air.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[build]
args_bin = [
"-p",
"3000",
]
bin = "./bin/server"
cmd = "make build"
exclude_dir = [
"bin",
"tmp",
]
2 changes: 2 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
run:
timeout: 3m
12 changes: 11 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-merge-conflict
- id: check-toml
- id: check-yaml
- id: end-of-file-fixer
- id: mixed-line-ending
- id: trailing-whitespace

- repo: local
hooks:
- id: format
Expand All @@ -20,7 +30,7 @@ repos:
always_run: true

- id: build
name: build the project
name: build project
entry: make build
language: system
always_run: true
20 changes: 12 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
# Build config:
BINARY_DIR=bin
BINARY_NAME=server
BINARY_PATH=$(BINARY_DIR)/$(BINARY_NAME)
RELEASE_NAME=minisearch

# Test config:
COVERAGE_PROFILE=cover.out

# Docker config:
DOCKER_IMAGE=minisearch
DOCKER_IMAGE_DEV=$(DOCKER_IMAGE)-dev
DOCKER_IMAGE_WATCH=$(DOCKER_IMAGE)-watch
Expand Down Expand Up @@ -33,11 +38,9 @@ watch:
@docker run -it --rm \
-w /go/src/$(PACKAGE_NAME) \
-v $(shell pwd):/go/src/$(PACKAGE_NAME) \
-p $(WATCH_PORT):$(WATCH_PORT) \
-p $(WATCH_PORT):3000 \
--name $(DOCKER_IMAGE_WATCH) \
cosmtrek/air \
--build.cmd "go build -buildvcs=false -race -o $(BINARY_PATH) ./cmd/server" \
--build.bin "./$(BINARY_PATH) -p $(WATCH_PORT)"
cosmtrek/air:v1.51.0

# Test:
test:
Expand All @@ -51,13 +54,14 @@ coverage:
bench:
@go test -bench=. -run=^a -benchtime=5x ./...

# Lint
lint:
@golangci-lint run --timeout=3m

# Format:
format:
@go fmt ./...

# Lint:
lint:
@golangci-lint run

# Release:
release:
@go build -buildvcs=false -o $(BINARY_NAME) ./cmd/server
Expand Down

0 comments on commit 944a76f

Please sign in to comment.