From 2be6a5e53dce785ead95e4f423f80de6547ed850 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Haris=20Osmanagi=C4=87?= Date: Mon, 19 Aug 2024 15:58:29 +0200 Subject: [PATCH] Makefile: mark targets as .PHONY (#1785) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Makefile: mark targets as .PHONY * change link --------- Co-authored-by: Raúl Barroso --- Makefile | 16 ++++++++++++++-- docs/code_guidelines.md | 2 +- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 4c73954fd..db44e7264 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,3 @@ -.PHONY: test test-integration build run proto-update proto-lint clean download install-tools generate check-go-version markdown-lint - # Version will extract the current version of Conduit based on # the latest git tag and commit. If the repository contains any # changes the version will have the suffix "-dirty", it will @@ -9,12 +7,14 @@ VERSION=`git describe --tags --dirty` GO_VERSION_CHECK=`./scripts/check-go-version.sh` # The build target should stay at the top since we want it to be the default target. +.PHONY: build build: check-go-version pkg/web/ui/dist go build -ldflags "-X 'github.com/conduitio/conduit/pkg/conduit.version=${VERSION}'" -o conduit -tags ui ./cmd/conduit/main.go @echo "\nBuild complete. Enjoy using Conduit!" @echo "Get started by running:" @echo " ./conduit" +.PHONY: test test: go test $(GOTEST_FLAGS) -race ./... @@ -24,6 +24,7 @@ escape-analysis: grep -vwE "(.*_test\.go|.*\/mock/.*\.go)" escape_analysis_full.txt > escape_analysis.txt rm escape_analysis_full.txt +.PHONY: test-integration test-integration: # run required docker containers, execute integration tests, stop containers after tests docker compose -f test/docker-compose-postgres.yml -f test/docker-compose-schemaregistry.yml up --quiet-pull -d --wait @@ -39,35 +40,44 @@ fmt: lint: golangci-lint run -v +.PHONY: build-server build-server: check-go-version go build -ldflags "-X 'github.com/conduitio/conduit/pkg/conduit.version=${VERSION}'" -o conduit ./cmd/conduit/main.go @echo "build version: ${VERSION}" +.PHONY: run run: go run ./cmd/conduit/main.go +.PHONY: proto-generate proto-generate: rm -rf proto/gen && cd proto && buf generate +.PHONY: proto-update proto-update: cd proto && buf dep update +.PHONY: proto-lint proto-lint: cd proto && buf lint +.PHONY: clean clean: @rm -f conduit @rm -rf pkg/web/ui/dist +.PHONY: download download: @echo Download go.mod dependencies @go mod download +.PHONY: install-tools install-tools: download @echo Installing tools from tools.go @go list -e -f '{{ join .Imports "\n" }}' tools.go | xargs -I % go list -f "%@{{.Module.Version}}" % | xargs -tI % go install % @go mod tidy +.PHONY: generate generate: go generate -x ./... @@ -77,11 +87,13 @@ pkg/web/ui/dist: ui-%: @cd ui && make $* +.PHONY: check-go-version check-go-version: @if [ "${GO_VERSION_CHECK}" != "" ]; then\ echo "${GO_VERSION_CHECK}";\ exit 1;\ fi +.PHONY: markdown-lint markdown-lint: markdownlint-cli2 "**/*.md" "#ui/node_modules" "#LICENSE.md" "#pkg/web/openapi/**" "#.github/*.md" diff --git a/docs/code_guidelines.md b/docs/code_guidelines.md index ced651cff..30d8d3d96 100644 --- a/docs/code_guidelines.md +++ b/docs/code_guidelines.md @@ -2,7 +2,7 @@ Unless specified otherwise, we should follow the guidelines outlined in [Effective Go](https://golang.org/doc/effective_go) and -[Go Code Review Comments](https://github.com/golang/go/wiki/CodeReviewComments). +[Go Code Review Comments](https://go.dev/wiki/CodeReviewComments). Conduit is using [golangci-lint](https://golangci-lint.run/) to ensure the code conforms to our code guidelines. Part of the guidelines are outlined below.