Skip to content

Commit

Permalink
Merge pull request #439 from jpodivin/make-help
Browse files Browse the repository at this point in the history
Adding help for Makefile
  • Loading branch information
jistr authored May 7, 2024
2 parents 7191633 + 792c108 commit 16f45af
Showing 1 changed file with 25 additions and 8 deletions.
33 changes: 25 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,32 @@ TEST_SECRETS ?= tests/secrets.yaml
TEST_CONFIG ?= tests/ansible.cfg
TEST_ARGS ?=

### TESTS ###
##@ General

# The help target prints out all targets with their descriptions organized
# beneath their categories. The categories are represented by '##@' and the
# target descriptions by '##'. The awk commands is responsible for reading the
# entire set of makefiles included in this invocation, looking for lines of the
# file as xyz: ## something, and then pretty-format the target and help. Then,
# if there's a line with ##@ something, that gets pretty-printed as a category.
# More info on the usage of ANSI control characters for terminal formatting:
# https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters
# More info on the awk command:
# http://linuxcommand.org/lc3_adv_awk.php

.PHONY: help
help: ## Display this help.
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)

##@ TESTS

test-minimal: TEST_OUTFILE := tests/logs/test_minimal_out_$(shell date +%FT%T%Z).log
test-minimal:
test-minimal: ## Launch minimal test suite
mkdir -p tests/logs
ANSIBLE_CONFIG=$(TEST_CONFIG) ansible-playbook -v -i $(TEST_INVENTORY) -e @$(TEST_VARS) -e @$(TEST_SECRETS) $(TEST_ARGS) tests/playbooks/test_minimal.yaml 2>&1 | tee $(TEST_OUTFILE)

test-with-ceph: TEST_OUTFILE := tests/logs/test_with_ceph_out_$(shell date +%FT%T%Z).log
test-with-ceph:
test-with-ceph: ## Launch test suite with ceph
mkdir -p tests/logs
ANSIBLE_CONFIG=$(TEST_CONFIG) ansible-playbook -v -i $(TEST_INVENTORY) -e @$(TEST_VARS) -e @$(TEST_SECRETS) $(TEST_ARGS) tests/playbooks/test_with_ceph.yaml 2>&1 | tee $(TEST_OUTFILE)

Expand All @@ -32,23 +49,23 @@ test-rollback-with-ceph:
ANSIBLE_CONFIG=$(TEST_CONFIG) ansible-playbook -v -i $(TEST_INVENTORY) -e @$(TEST_VARS) -e @$(TEST_SECRETS) $(TEST_ARGS) tests/playbooks/test_rollback_with_ceph.yaml 2>&1 | tee $(TEST_OUTFILE)

test-with-ironic: TEST_OUTFILE := tests/logs/test_with_ironic_out_$(shell date +%FT%T%Z).log
test-with-ironic:
test-with-ironic: ## Launch test suite with Ironic
mkdir -p tests/logs
ANSIBLE_CONFIG=$(TEST_CONFIG) ansible-playbook -v -i $(TEST_INVENTORY) -e @$(TEST_VARS) -e @$(TEST_SECRETS) tests/playbooks/test_with_ironic.yaml 2>&1 | tee $(TEST_OUTFILE)

### DOCS ###
##@ DOCS

docs-dependencies: .bundle

.bundle:
.bundle: ## Attempt to install bundle
if ! type bundle; then \
echo "Bundler not found. On Linux run 'sudo dnf install /usr/bin/bundle' to install it."; \
exit 1; \
fi

bundle config set --local path 'local/bundle'; bundle install

docs: docs-dependencies docs-user-all-variants docs-dev
docs: docs-dependencies docs-user-all-variants docs-dev ## Build documentation

docs-user-all-variants:
cd docs_user; BUILD=upstream $(MAKE) html
Expand All @@ -72,5 +89,5 @@ docs-dev-open:
docs-dev-watch:
cd docs_dev; $(MAKE) watch-html

docs-clean:
docs-clean: ## Cleanup documentation
rm -r docs_build

0 comments on commit 16f45af

Please sign in to comment.