diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ae4c186..bbfde6a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 diff --git a/Makefile b/Makefile index df1cbcf..0b9b2d0 100644 --- a/Makefile +++ b/Makefile @@ -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