Skip to content

Commit 5d503c7

Browse files
committed
Merge branch '319-follow-up-readme' into 'master'
chore: describe components and Makefile targets (#319) Closes #319 See merge request postgres-ai/database-lab!413
2 parents 044bd63 + 3b63dfb commit 5d503c7

File tree

2 files changed

+36
-27
lines changed

2 files changed

+36
-27
lines changed

CONTRIBUTING.md

+12-7
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ Enhancement suggestions are tracked on [GitLab](https://gitlab.com/postgres-ai/d
6868
- Provide a step-by-step description of the proposed enhancement in as many details as possible.
6969
- Provide specific examples to demonstrate the steps. Include copy/pasteable snippets which you use in those examples
7070
- Use Markdown to format code snippets and improve the overall look of your issues (Markdown docs: [GitLab](https://docs.gitlab.com/ee/user/markdown.html), [GitHub](https://github.github.com/gfm/)).
71-
- Describe the current behavior and explain which behavior you expected to see instead and why.
71+
- Describe the current behavior and explain which behavior you expected to see instead and why (on GitLab, you can use the issue template, which is selected by default).
7272
- If your proposal is related to UI, include screenshots and animated GIFs which help you demonstrate the steps or point out the part of DLE to which the suggestion is related. Please, do NOT use screenshots for console output, logs, configs.
7373
- Explain why this proposal would be helpful to most DLE users.
7474
- Specify which version of DLE you're using. If it makes sense, specify Postgres versions too.
@@ -126,10 +126,13 @@ We're building documentation following the principles described at https://docum
126126
127127
Learn more: https://documentation.divio.com/.
128128

129-
<!--
130129
### Repo overview
131-
TBD
132-
-->
130+
The [postgres-ai/database-lab](https://gitlab.com/postgres-ai/database-lab) repo contains 3 components:
131+
- [Database Lab Engine](https://gitlab.com/postgres-ai/database-lab/-/tree/master/cmd/database-lab)
132+
- [Database Lab CI Checker](https://gitlab.com/postgres-ai/database-lab/-/tree/master/cmd/runci)
133+
- [Database Lab CLI](https://gitlab.com/postgres-ai/database-lab/-/tree/master/cmd/cli)
134+
135+
All three components have a single version, denoted by either the git tag or a combination of the branch name and git commit SHA.
133136

134137
### Development setup
135138
- Install Docker. Example for Linux:
@@ -173,10 +176,12 @@ TBD
173176

174177
<!-- TODO: Linux specific requirements? MacOS specific? -->
175178

176-
<!--
179+
177180
### Building from source
178-
TBD – separately for Linux and MacOS
181+
Use `Makefile` to build Database Lab components from source.
179182

183+
Run `make help` to see all available targets.
180184

185+
<!--
181186
mention dev images: See our [GitLab Container Registry](https://gitlab.com/postgres-ai/database-lab/container_registry) to find the images built for development branches.
182-
-->
187+
-->

Makefile

+24-20
Original file line numberDiff line numberDiff line change
@@ -18,54 +18,58 @@ LDFLAGS = -ldflags "-s -w \
1818
-X gitlab.com/postgres-ai/database-lab/v3/version.buildTime=${BUILD_TIME}"
1919

2020
# Go tooling command aliases
21-
GOBUILD = GO111MODULE=on GOARCH=${GOARCH} go build ${LDFLAGS}
22-
GOTEST = GO111MODULE=on go test -race
23-
GORUN = GO111MODULE=on go run ${LDFLAGS}
21+
GOBUILD = GO111MODULE=on CGO_ENABLED=0 GOARCH=${GOARCH} go build ${LDFLAGS}
22+
GOTEST = GO111MODULE=on go test -race
2423

2524
CLIENT_PLATFORMS=darwin linux freebsd windows
2625
ARCHITECTURES=amd64
2726

28-
# Build the project
29-
all: clean build
27+
help: ## Display the help message
28+
@echo "Please use \`make <target>\` where <target> is one of:"
29+
@grep '^[a-zA-Z]' $(MAKEFILE_LIST) | \
30+
awk -F ':.*?## ' 'NF==2 {printf " %-22s%s\n", $$1, $$2}'
3031

31-
# Install the linter to $GOPATH/bin which is expected to be in $PATH
32-
install-lint:
32+
all: clean build ## Build all binary components of the project
33+
34+
install-lint: ## Install the linter to $GOPATH/bin which is expected to be in $PATH
3335
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.42.1
3436

35-
run-lint:
37+
run-lint: ## Run linters
3638
golangci-lint run
3739

38-
lint: install-lint run-lint
40+
lint: install-lint run-lint ## Install and run linters
3941

40-
build:
42+
build: ## Build binary files of all Database Lab components (Engine, CI Checker, CLI)
4143
${GOBUILD} -o bin/${SERVER_BINARY} ./cmd/database-lab/main.go
4244
${GOBUILD} -o bin/${RUN_CI_BINARY} ./cmd/runci/main.go
4345
${GOBUILD} -o bin/${CLI_BINARY} ./cmd/cli/main.go
4446

45-
build-ci-checker:
47+
build-ci-checker: ## Build the Database Lab CI Checker binary
4648
${GOBUILD} -o bin/${RUN_CI_BINARY} ./cmd/runci/main.go
4749

48-
build-client:
50+
build-client: ## Build Database Lab CLI binaries for all supported operating systems and platforms
4951
$(foreach GOOS, $(CLIENT_PLATFORMS),\
5052
$(foreach GOARCH, $(ARCHITECTURES), \
5153
$(shell \
5254
export GOOS=$(GOOS); \
5355
export GOARCH=$(GOARCH); \
5456
${GOBUILD} -o bin/cli/$(CLI_BINARY)-$(GOOS)-$(GOARCH) ./cmd/cli/main.go)))
5557

56-
test:
58+
build-image: ## Build Docker image with the locally compiled DLE binary
59+
docker build -t dblab_server:local -f Dockerfile.dblab-server .
60+
61+
build-dle: build build-image ## Build Database Lab Engine binary and Docker image
62+
63+
test: ## Run unit tests
5764
${GOTEST} ./...
5865

59-
test-ci-integration:
66+
test-ci-integration: ## Run integration tests
6067
GO111MODULE=on go test -race -tags=integration ./...
6168

62-
fmt:
69+
fmt: ## Format code
6370
go fmt $$(go list ./... | grep -v /vendor/)
6471

65-
clean:
72+
clean: ## Remove compiled binaries from the local bin/ directory
6673
rm -f bin/*
6774

68-
run:
69-
${GORUN} ./cmd/database-lab/*
70-
71-
.PHONY: all build test run-lint install-lint lint fmt clean run
75+
.PHONY: help all build test run-lint install-lint lint fmt clean build-image build-dle build-ci-checker build-client build-ci-checker

0 commit comments

Comments
 (0)