Skip to content

Commit

Permalink
Better makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
rednafi committed Mar 4, 2024
1 parent 2d2402e commit 6835724
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 26 deletions.
12 changes: 0 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,8 @@ jobs:
go-version: "1.22"
cache: true

- name: Install dependencies
run: make init

- name: Lint
run: make lint-check

- name: check-is-dirty
run: |
if [[ -n $(git status --porcelain) ]]; then
echo "Detected uncommitted changes."
git status
git diff
exit 1
fi
- name: Run tests
run: make test
22 changes: 8 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,38 +1,32 @@
.PHONY: all build clean test lint ci
.PHONY: all build clean test lint lint-check ci


# Binary name for the output binary
BINARY_NAME=fork-sweeper

# Default command to run when no arguments are provided to make
all: build

# Builds the binary
build:
@echo "Building..."
go build -C cmd/fork-sweeper -o ../../${BINARY_NAME}

# Cleans our project: deletes binaries
clean:
@echo "Cleaning..."
go clean
rm -f ${BINARY_NAME}

# Runs tests
test:
@echo "Running tests..."
go test ./... -cover

# Lints the project
lint:
@echo "Linting..."
go fmt ./...
go vet ./...
go mod tidy

# Command for Continuous Integration
ci: lint test
@echo "CI steps..."
# Add commands specific to your CI setup
# e.g., integration testing, deployment commands, etc.

# Additional commands can be added below for database migrations, Docker operations, etc.
lint-check:
@echo "Checking lint..."
@if [ -n "$$(gofmt -l .)" ]; then \
echo "Some files are not formatted. Please run 'gofmt -w .' on your code."; \
exit 1; \
fi

0 comments on commit 6835724

Please sign in to comment.