Using the Makefile
Intro
This document explains how to use the Makefile
in the root directory of the ansible-power-aix repository. It will cover the various targets defined in the Makefile
and their purposes.
Utility Targets
The utility targets section defines general-purpose commands that can be used for various tasks.
######################################################################################
# utility targets
######################################################################################
The help
Makefile
. Running make
help
.PHONY: help
help:
@echo "usage: make <target>"
@echo ""
@echo "target:"
@echo "install-requirements ANSIBLE_VERSION=<version> install all requirements"
@echo "install-ansible ANSIBLE_VERSION=<version> install ansible: 2.9, 3, or 4"
@echo "install-ansible-devel-branch install ansible development branch"
@echo "install-sanity-test-requirements install python modules needed to \
run sanity testing"
@echo "install-unit-test-requirements install python modules needed \
run unit testing"
@echo "lint lint ansible module and roles"
@echo "module-lint MODULE=<module path> lint ansible module"
@echo "role-lint ROLE=<role path> lint ansible role"
@echo "porting MODULE=<module path> check if module is python3 ported"
@echo "sanity-test MODULE=<module path> run sanity test on the collections"
@echo "unit-test TEST=<test path> run unit test suite for the collection"
@echo "clean clean junk files"
The clean
.PHONY: clean
clean:
@rm -rf tests/unit/plugins/modules/__pycache__
@rm -rf tests/unit/plugins/modules/common/__pycache__
@rm -rf collections/ansible_collections
@rm -rf plugins/modules/__pycache__
The uninstall-pylint
.PHONY: uninstall-pylint
uninstall-pylint:
python -m pip uninstall --yes pylint
Installation Targets
The installation targets section defines commands for installing various dependencies required for the project.
# installation targets
######################################################################################
The install-requirements
.PHONY: install-requirements
install-requirements: install-ansible install-sanity-test-requirements \
install-unit-test-requirements
python -m pip install --upgrade pip
The install-ansible
ANSIBLE_VERSION
.PHONY: install-ansible
install-ansible:
python -m pip install --upgrade pip
ifdef ANSIBLE_VERSION
python -m pip install ansible==$(ANSIBLE_VERSION).*
else
python -m pip install ansible
endif
The install-ansible-devel-branch
.PHONY: install-ansible-devel-branch
install-ansible-devel-branch:
python -m pip install --upgrade pip
python -m pip install https://github.com/ansible/ansible/archive/devel.tar.gz \
--disable-pip-version-check
The install-sanity-test-requirements
tests/sanity/sanity.requirements
file.
.PHONY: install-sanity-test-requirements
install-sanity-test-requirements:
python -m pip install -r tests/sanity/sanity.requirements
The install-unit-test-requirements
tests/unit/unit.requirements
file.
.PHONY: install-unit-test-requirements
install-unit-test-requirements:
python -m pip install -r tests/unit/unit.requirements
The install-pylint-py3k
.PHONY: install-pylint-py3k
install-pylint-py3k: uninstall-pylint
python -m pip install --upgrade pip
python -m pip install pylint==2.10.*
Testing Targets
The testing targets section defines commands for running various tests on the project.
# testing targets
######################################################################################
The lint
.PHONY: lint
lint: module-lint role-lint
The module-lint
ansible-test
flake8
pycodestyle
.PHONY: module-lint
module-lint:
ansible-test sanity -v --color yes --truncate 0 --python $(PYTHON_VERSION) \
--exclude $(DEPRECATED) --test pylint $(MODULE)
flake8 --ignore=E402,W503 --max-line-length=160 --exclude $(DEPRECATED) $(MODULE)
python -m pycodestyle --ignore=E402,W503 --max-line-length=160 --exclude $(DEPRECATED) \
$(MODULE)
The role-lint
ansible-lint
.PHONY: role-lint
role-lint:
ansible-lint --force-color -f pep8 $(ROLE)
The porting
pylint --py3k
.PHONY: porting
porting:
python -m pylint --py3k --output-format=colorized $(MODULE) $(VIOSHC_SCRIPT)
The compile
.PHONY: compile
compile:
ansible-test sanity --test compile --python $(PYTHON_VERSION) $(MODULE)
The sanity-test
ansible-test
.PHONY: sanity-test
sanity-test:
ansible-test sanity -v --color yes --truncate 0 --python $(PYTHON_VERSION) \
--exclude $(DEPRECATED) $(MODULE)
The unit-test
ansible-test
.PHONY: unit-test
unit-test:
@if [ -d "tests/output/coverage" ]; then \
ansible-test coverage erase; \
fi
ansible-test units -v --color yes --python $(PYTHON_VERSION) \
--coverage $(TEST)
ansible-test coverage report --omit $(TEST_OMIT) --include "$(MODULE)" --show-missing
This is an auto-generated document by Swimm 🌊 and has not yet been verified by a human