Hung-Wei Chiu | c309b55 | 2021-09-09 18:18:52 +0000 | [diff] [blame^] | 1 | # ds389 Makefile |
| 2 | # |
| 3 | # SPDX-FileCopyrightText: © 2021 Open Networking Foundation <support@opennetworking.org> |
| 4 | # SPDX-License-Identifier: Apache-2.0 |
| 5 | |
| 6 | SHELL = bash -eu -o pipefail |
| 7 | |
| 8 | .DEFAULT_GOAL := help |
| 9 | .PHONY: test lint yamllint ansiblelint license help |
| 10 | |
| 11 | test: ## run tests on the playbook with molecule |
| 12 | molecule --version |
| 13 | molecule test |
| 14 | |
| 15 | lint: yamllint ansiblelint ## run all lint checks |
| 16 | |
| 17 | # all YAML files |
| 18 | YAML_FILES ?= $(shell find . -type f \( -name '*.yaml' -o -name '*.yml' \) -print ) |
| 19 | |
| 20 | yamllint: ## lint check with yamllint |
| 21 | yamllint --version |
| 22 | yamllint \ |
| 23 | -d "{extends: default, rules: {line-length: {max: 99}}}" \ |
| 24 | -s $(YAML_FILES) |
| 25 | |
| 26 | ansiblelint: ## lint check with ansible-lint |
| 27 | ansible-lint --version |
| 28 | ansible-lint -v . |
| 29 | ansible-lint -v molecule/*/* |
| 30 | |
| 31 | license: ## Check license with the reuse tool |
| 32 | reuse --version |
| 33 | reuse --root . lint |
| 34 | |
| 35 | help: ## Print help for each target |
| 36 | @echo ds389 test targets |
| 37 | @echo |
| 38 | @grep '^[[:alnum:]_-]*:.* ##' $(MAKEFILE_LIST) \ |
| 39 | | sort | awk 'BEGIN {FS=":.* ## "}; {printf "%-25s %s\n", $$1, $$2};' |