Zack Williams | 583833b | 2020-04-10 08:17:44 -0700 | [diff] [blame] | 1 | # kind-voltha testing Makefile |
| 2 | # |
| 3 | # SPDX-FileCopyrightText: © 2020 Open Networking Foundation |
| 4 | # SPDX-License-Identifier: Apache-2.0 |
| 5 | |
| 6 | SHELL = bash -eu -o pipefail |
| 7 | |
| 8 | .DEFAULT_GOAL := help |
| 9 | .PHONY: test shellcheck yamllint jsonlint help |
| 10 | |
David Bainbridge | 8d21b0f | 2020-04-21 16:03:00 -0700 | [diff] [blame^] | 11 | test: shellcheck ## run all tests |
Zack Williams | 583833b | 2020-04-10 08:17:44 -0700 | [diff] [blame] | 12 | |
David Bainbridge | 8d21b0f | 2020-04-21 16:03:00 -0700 | [diff] [blame^] | 13 | SHELL_FILES := voltha |
Zack Williams | 583833b | 2020-04-10 08:17:44 -0700 | [diff] [blame] | 14 | shellcheck: ## check shell scripts with shellcheck |
| 15 | shellcheck --version |
David Bainbridge | 8d21b0f | 2020-04-21 16:03:00 -0700 | [diff] [blame^] | 16 | shellcheck $(SHELL_FILES) |
Zack Williams | 583833b | 2020-04-10 08:17:44 -0700 | [diff] [blame] | 17 | |
| 18 | YAML_FILES ?= $(shell find . -type f \( -name '*.yaml' -o -name '*.yml' -o -name '*.cfg' \) -print ) |
| 19 | yamllint: ## lint check YAML files with yamllint |
| 20 | yamllint --version |
| 21 | yamllint \ |
| 22 | -d "{extends: default, rules: {line-length: {max: 99}}}" \ |
| 23 | -s $(YAML_FILES) |
| 24 | |
| 25 | JSON_FILES ?= $(shell find . -type f -name '*.json' -print ) |
| 26 | jsonlint: ## lint check JSON files with yamllint |
| 27 | echo "Not supported yet, would check these files: $(JSON_FILES)" |
| 28 | |
| 29 | help: ## Print help for each target |
| 30 | @echo kind-voltha Makefile targets |
| 31 | @echo |
| 32 | @grep '^[[:alpha:]_-]*:.* ##' $(MAKEFILE_LIST) \ |
| 33 | | sort | awk 'BEGIN {FS=":.* ## "}; {printf "%-25s %s\n", $$1, $$2};' |