Zack Williams | 70fdc27 | 2022-06-15 06:48:40 -0700 | [diff] [blame^] | 1 | # golang Makefile |
| 2 | # |
| 3 | # SPDX-FileCopyrightText: 2022 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: license 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 | license: ## Check license with the reuse tool |
| 21 | reuse --version |
| 22 | reuse --root . lint |
| 23 | |
| 24 | yamllint: ## lint check with yamllint |
| 25 | yamllint --version |
| 26 | yamllint \ |
| 27 | -d "{extends: default, rules: {line-length: {max: 99}}}" \ |
| 28 | -s $(YAML_FILES) |
| 29 | |
| 30 | # List of molecule files, not including base molecule.yml which isn't ansible format |
| 31 | MOLECULE_FILES ?= $(shell find molecule -type f -name '*.yml' \! -name 'molecule.yml' -print ) |
| 32 | |
| 33 | ansiblelint: ## lint check with ansible-lint |
| 34 | ansible-lint --version |
| 35 | ansible-lint -v . |
| 36 | ansible-lint -v $(MOLECULE_FILES) |
| 37 | |
| 38 | help: ## Print help for each target |
| 39 | @echo golang test targets |
| 40 | @echo |
| 41 | @grep '^[[:alnum:]_-]*:.* ##' $(MAKEFILE_LIST) \ |
| 42 | | sort | awk 'BEGIN {FS=":.* ## "}; {printf "%-25s %s\n", $$1, $$2};' |