-
Notifications
You must be signed in to change notification settings - Fork 36
Adds a functional Makefile #96
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
Open
brianbruggeman
wants to merge
6
commits into
aerospike:master
Choose a base branch
from
brianbruggeman:create-makefile
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
a840b68
Adds a functional Makefile
brianbruggeman e973bfb
Adds dotenv setup for makefile
brianbruggeman 7de6e36
Updates ports and moves version to latest
brianbruggeman 374dbc2
Makes dotenv reading a little more robust
brianbruggeman 5b5685a
Adds env dump to release
brianbruggeman 8c1f48c
Adds test runs for features
brianbruggeman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,120 @@ | ||
| # ====================================================================== | ||
| # | ||
| # Setup | ||
| # | ||
| # ====================================================================== | ||
| .DEFAULT_GOAL := help | ||
|
|
||
| # Dotenv load | ||
| VARS_OLD := $(.VARIABLES) | ||
| DOTENV_FILE ?= ./.env | ||
| ENV_FILE ?= $(DOTENV_FILE) | ||
| ifneq (,$(wildcard $(ENV_FILE))) | ||
| include $(ENV_FILE) | ||
| export $(shell sed 's/=.*//' $(ENV_FILE)) | ||
| endif | ||
|
|
||
| # ====================================================================== | ||
| # | ||
| # Standard commands | ||
| # | ||
| # ====================================================================== | ||
| aerospike: $(DOCKER) ## Start aerospike docker instance | ||
| mkdir -p $(AEROSPIKE_DATA_PATH) | ||
| $(DOCKER) run --rm -it $(AEROSPIKE_DOCKER_RUN) --name aerospike $(AEROSPIKE_URL) | ||
|
|
||
| audit: $(CARGO) $(AUDIT) ## Check for security vulnerabilities | ||
| $(CARGO) audit | ||
|
|
||
| benchmark: $(CARGO) ## Benchmarks code | ||
| $(CARGO) bench | ||
|
|
||
| build: $(CARGO) ## Compiles crate workspace | ||
| $(CARGO) build --release --workspace | ||
|
|
||
| doc: $(CARGO) ## Build documentation | ||
| $(CARGO) doc --no-deps | ||
|
|
||
| help: ## Show this menu | ||
| @awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) | ||
|
|
||
| lint: $(CARGO) clippy ## Run style check | ||
| $(CARGO) clippy --all --all-features -- -D warnings | ||
|
|
||
| release: $(CARGO) | style lint doc build test benchmark audit ## Run everything needed for a release | ||
|
|
||
| style: | $(CARGO) rustfmt ## Run style check | ||
| $(CARGO) fmt --all -- --check | ||
|
|
||
| test: $(CARGO) ## Run tests | ||
| $(CARGO) test --release | ||
|
|
||
| # ====================================================================== | ||
| # | ||
| # Support | ||
| # | ||
| # ====================================================================== | ||
| # docker | ||
| DOCKER := $(shell which docker || echo /usr/local/bin/docker) | ||
|
|
||
| $(DOCKER): | ||
| @echo "`docker` must be installed and available from PATH" | ||
| @env | grep -i ^PATH | ||
| @exit 1 | ||
|
|
||
| # aerospike | ||
| AEROSPIKE_DATA_PATH ?= $(HOME)/.aerospike/data | ||
| AEROSPIKE_DEFAULT_TTL ?= 0 | ||
| AEROSPIKE_DOCKER_REPO ?= aerospike/aerospike-server | ||
| AEROSPIKE_MEMORY ?= 1 | ||
| AEROSPIKE_NAMESPACE ?= test | ||
| AEROSPIKE_STORAGE ?= 8 | ||
| AEROSPIKE_URL ?= $(AEROSPIKE_DOCKER_REPO):$(AEROSPIKE_VERSION) | ||
| AEROSPIKE_VERSION ?= 5.4.0.2 | ||
| AEROSPIKE_PORT ?= 3000 | ||
|
|
||
| AEROSPIKE_DOCKER_RUN := -p $(AEROSPIKE_PORT):3000 | ||
| ifneq "" "$(AEROSPIKE_DEFAULT_TTL)" | ||
| AEROSPIKE_DOCKER_RUN += -e "DEFAULT_TTL=$(AEROSPIKE_DEFAULT_TTL)" | ||
| endif | ||
| ifneq "" "$(AEROSPIKE_NAMESPACE)" | ||
| AEROSPIKE_DOCKER_RUN += -e "NAMESPACE=$(AEROSPIKE_NAMESPACE)" | ||
| endif | ||
| ifneq "" "$(AEROSPIKE_MEMORY)" | ||
| AEROSPIKE_DOCKER_RUN += -e "MEM_GB=$(AEROSPIKE_MEMORY)" | ||
| endif | ||
| ifneq "" "$(AEROSPIKE_STORAGE)" | ||
| AEROSPIKE_DOCKER_RUN += -e "STORAGE_GB=$(AEROSPIKE_STORAGE)" | ||
| endif | ||
|
|
||
| # rust | ||
| CARGO_HOME ?= $(HOME)/.cargo | ||
| CARGO := ${CARGO_HOME}/bin/cargo | ||
|
|
||
| AUDIT := $(shell (which cargo-audit 2>/dev/null || echo ${CARGO_HOME}/bin/cargo-audit)) | ||
| CLIPPY := $(shell (which cargo-clippy 2>/dev/null || echo ${CARGO_HOME}/bin/cargo-clippy)) | ||
| RUSTFMT := $(shell (which rustfmt 2>/dev/null || echo ${CARGO_HOME}/bin/rustfmt)) | ||
| RUSTUP := $(shell (which rustup 2>/dev/null || echo ${CARGO_HOME}/bin/rustup)) | ||
|
|
||
| # cargo audit | ||
| export AUDIT | ||
| $(AUDIT): | ||
| $(CARGO) install cargo-audit | ||
|
|
||
| # cargo command | ||
| export CARGO | ||
| $(CARGO): $(RUSTUP) | ||
|
|
||
| # cargo clippy - as a component, the file may be there but the toolchain installation may not | ||
| clippy: $(RUSTUP) | ||
| $(eval CLIPPY_INSTALLED := $(shell (rustup component list | grep -i \(installed\) | sort | grep -i clippy))) | ||
| ifeq "" "$(CLIPPY_INSTALLED)" | ||
| $(RUSTUP) component add clippy | ||
| endif | ||
|
|
||
| # cargo fmt - as a component, the file may be there but the toolchain installation may not | ||
| rustfmt: $(RUSTFMT) | ||
| $(eval RUSTFMT_INSTALLED := $(shell (rustup component list | grep -i \(installed\) | sort | grep -i rustfmt))) | ||
| ifeq "" "$(RUSTFMT_INSTALLED)" | ||
| $(RUSTUP) component add rustfmt | ||
| endif | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.