Skip to content

Commit e4434ed

Browse files
Create Makefile
1 parent f06f43e commit e4434ed

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

Makefile

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# SPDX-FileCopyrightText: (C) 2025 Intel Corporation
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
.DEFAULT_GOAL := help
5+
.PHONY: all lint clean help
6+
7+
# Shell config variable
8+
SHELL := bash -eu -o pipefail
9+
10+
# directories
11+
CI_DIR := ci
12+
CACHE_DIR := .cache
13+
14+
#### Python venv Target ####
15+
VENV_DIR := venv_ci
16+
17+
$(VENV_DIR): requirements.txt
18+
python3 -m venv $@ ;\
19+
set +u; . ./$@/bin/activate; set -u ;\
20+
python -m pip install --upgrade pip ;\
21+
python -m pip install -r requirements.txt
22+
23+
lint: yamllint shellcheck markdownlint actionlint ## lint all files in repo
24+
25+
license: $(VENV_DIR) ## Check licensing with reuse
26+
set +u; . ./$</bin/activate; set -u ;\
27+
reuse --version ;\
28+
reuse --root . lint
29+
30+
YAML_FILES := $(shell find . -type f \( -name '*.yaml' -o -name '*.yml' \) -print )
31+
yamllint: $(VENV_DIR) ## Lint YAML files with yamllint
32+
set +u; . ./$</bin/activate; set -u ;\
33+
yamllint --version ;\
34+
yamllint -d '{extends: default, rules: {line-length: {max: 120}}, ignore: [$(VENV_DIR),$(CI_DIR),$(CACHE_DIR)]}' -s $(YAML_FILES)
35+
36+
# https://github.com/koalaman/shellcheck
37+
SH_FILES := $(shell find . -type f -name '*.sh' ! -path './trivy/*')
38+
shellcheck: ## lint shell scripts with shellcheck
39+
shellcheck --version
40+
shellcheck -x -S style $(SH_FILES)
41+
42+
# https://github.com/DavidAnson/markdownlint-cli2
43+
markdownlint: ## lint markdown files with markdownlint-cli2
44+
markdownlint-cli2 '**/*.md'
45+
46+
actionlint: ## lint github actions
47+
go install github.com/rhysd/actionlint/cmd/actionlint@latest
48+
actionlint -shellcheck=
49+
50+
clean: ## cleanup all temporary files
51+
rm -rf $(VENV_DIR)
52+
53+
#### Help Target ####
54+
help: ## print help for each target
55+
@echo orch-ci make targets
56+
@echo "Target Makefile:Line Description"
57+
@echo "-------------------- ---------------- -----------------------------------------"
58+
@grep -H -n '^[[:alnum:]%_-]*:.* ##' $(MAKEFILE_LIST) \
59+
| sort -t ":" -k 3 \
60+
| awk 'BEGIN {FS=":"}; {sub(".* ## ", "", $$4)}; {printf "%-20s %-16s %s\n", $$3, $$1 ":" $$2, $$4};'

0 commit comments

Comments
 (0)