blob: 4c61b4e89cf2b7fb31d08452b3fb9da81fda843d [file] [log] [blame]
Zack Williams583833b2020-04-10 08:17:44 -07001# kind-voltha testing Makefile
2#
3# SPDX-FileCopyrightText: © 2020 Open Networking Foundation
4# SPDX-License-Identifier: Apache-2.0
5
6SHELL = bash -eu -o pipefail
7
8.DEFAULT_GOAL := help
9.PHONY: test shellcheck yamllint jsonlint help
10
David Bainbridge8d21b0f2020-04-21 16:03:00 -070011test: shellcheck ## run all tests
Zack Williams583833b2020-04-10 08:17:44 -070012
David Bainbridge8d21b0f2020-04-21 16:03:00 -070013SHELL_FILES := voltha
Zack Williams583833b2020-04-10 08:17:44 -070014shellcheck: ## check shell scripts with shellcheck
15 shellcheck --version
David Bainbridge8d21b0f2020-04-21 16:03:00 -070016 shellcheck $(SHELL_FILES)
Zack Williams583833b2020-04-10 08:17:44 -070017
18YAML_FILES ?= $(shell find . -type f \( -name '*.yaml' -o -name '*.yml' -o -name '*.cfg' \) -print )
19yamllint: ## 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
25JSON_FILES ?= $(shell find . -type f -name '*.json' -print )
26jsonlint: ## lint check JSON files with yamllint
27 echo "Not supported yet, would check these files: $(JSON_FILES)"
28
29help: ## 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};'