Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Makefile: mark targets as .PHONY #1785

Merged
merged 3 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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 ./...

Expand All @@ -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
Expand All @@ -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 ./...

Expand All @@ -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"
2 changes: 1 addition & 1 deletion docs/code_guidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down