blob: a7aa3f78fa30e0e2d0f952b602e1d3917032d9e9 [file] [log] [blame]
Hyunsun Moonc49a8642020-11-11 14:58:47 -08001# bird Makefile
2#
3# SPDX-FileCopyrightText: © 2020 Open Networking Foundation <support@opennetworking.org>
4# SPDX-License-Identifier: Apache-2.0
5
6SHELL = bash -eu -o pipefail
7
8.DEFAULT_GOAL := help
9.PHONY: test lint yamllint ansiblelint license help
10
11test: ## run tests on the playbook with molecule
12 molecule --version
13 molecule test
14
15lint: yamllint ansiblelint ## run all lint checks
16
17# all YAML files
18YAML_FILES ?= $(shell find . -type f \( -name '*.yaml' -o -name '*.yml' \) -print )
19
20yamllint: ## lint check with yamllint
21 yamllint --version
22 yamllint \
23 -d "{extends: default, rules: {line-length: {max: 99}}}" \
24 -s $(YAML_FILES)
25
Zack Williams4761d6f2022-03-28 16:42:09 -070026# List of molecule files, not including base molecule.yml which isn't ansible format
27MOLECULE_FILES ?= $(shell find molecule -type f -name '*.yml' \! -name 'molecule.yml' -print )
28
Hyunsun Moonc49a8642020-11-11 14:58:47 -080029ansiblelint: ## lint check with ansible-lint
30 ansible-lint --version
31 ansible-lint -v .
Zack Williams4761d6f2022-03-28 16:42:09 -070032 ansible-lint -v $(MOLECULE_FILES)
Hyunsun Moonc49a8642020-11-11 14:58:47 -080033
34license: ## Check license with the reuse tool
35 reuse --version
36 reuse --root . lint
37
38help: ## Print help for each target
39 @echo bird test targets
40 @echo
41 @grep '^[[:alnum:]_-]*:.* ##' $(MAKEFILE_LIST) \
42 | sort | awk 'BEGIN {FS=":.* ## "}; {printf "%-25s %s\n", $$1, $$2};'