-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathMakefile
More file actions
107 lines (91 loc) · 5.41 KB
/
Makefile
File metadata and controls
107 lines (91 loc) · 5.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
MARKDOWNLINT ?= markdownlint
UVRUN ?= uv run
RUFF ?= $(UVRUN) ruff
YAMLLINT ?= $(UVRUN) yamllint
PYTEST ?= $(UVRUN) pytest
.PHONY: format fix lint lint-format lint-python lint-markdown lint-yaml lint-imports test test-coverage component pipeline tests readme sync-packages
format:
$(RUFF) format components pipelines scripts
$(RUFF) check --fix components pipelines scripts
fix: format
@echo "Auto-fixing Python formatting and lint issues..."
@echo "Note: Markdown and YAML issues may need manual fixes"
lint: lint-format lint-python lint-markdown lint-yaml lint-imports
lint-format:
$(RUFF) format --check components pipelines scripts
lint-python:
$(RUFF) check components pipelines scripts
lint-markdown:
$(MARKDOWNLINT) -c .markdownlint.json .
lint-yaml:
$(YAMLLINT) -c .yamllint.yml .
lint-imports:
$(UVRUN) .github/scripts/check_imports/check_imports.py --config .github/scripts/check_imports/import_exceptions.yaml components pipelines
test:
cd .github/scripts && $(PYTEST) */tests/ -v $(ARGS)
test-coverage:
cd .github/scripts && $(PYTEST) */tests/ --cov=. --cov-report=term-missing -v $(ARGS)
component:
@if [ -z "$(CATEGORY)" ]; then echo "Error: CATEGORY is required. Usage: make component CATEGORY=data_processing NAME=my_component [SUBCATEGORY=x] [NO_TESTS=true] [CREATE_SHARED=true]"; exit 1; fi
@if [ -z "$(NAME)" ]; then echo "Error: NAME is required. Usage: make component CATEGORY=data_processing NAME=my_component [SUBCATEGORY=x] [NO_TESTS=true] [CREATE_SHARED=true]"; exit 1; fi
@set -e; \
SUBCATEGORY_ARG=""; \
if [ -n "$(SUBCATEGORY)" ]; then SUBCATEGORY_ARG="--subcategory=$(SUBCATEGORY)"; fi; \
NO_TESTS_ARG=""; \
if [ "$(NO_TESTS)" = "true" ]; then NO_TESTS_ARG="--no-tests"; fi; \
CREATE_SHARED_ARG=""; \
if [ "$(CREATE_SHARED)" = "true" ]; then CREATE_SHARED_ARG="--create-shared"; fi; \
$(UVRUN) scripts/generate_skeleton/generate_skeleton.py --type=component --category="$(CATEGORY)" --name="$(NAME)" $$SUBCATEGORY_ARG $$NO_TESTS_ARG $$CREATE_SHARED_ARG; \
echo ""; \
echo "Generating READMEs..."; \
if [ -n "$(SUBCATEGORY)" ]; then \
$(UVRUN) -m scripts.generate_readme --component "components/$(CATEGORY)/$(SUBCATEGORY)/$(NAME)" --fix; \
else \
$(UVRUN) -m scripts.generate_readme --component "components/$(CATEGORY)/$(NAME)" --fix; \
fi
@$(MAKE) --no-print-directory sync-packages
pipeline:
@if [ -z "$(CATEGORY)" ]; then echo "Error: CATEGORY is required. Usage: make pipeline CATEGORY=training NAME=my_pipeline [SUBCATEGORY=x] [NO_TESTS=true] [CREATE_SHARED=true]"; exit 1; fi
@if [ -z "$(NAME)" ]; then echo "Error: NAME is required. Usage: make pipeline CATEGORY=training NAME=my_pipeline [SUBCATEGORY=x] [NO_TESTS=true] [CREATE_SHARED=true]"; exit 1; fi
@set -e; \
SUBCATEGORY_ARG=""; \
if [ -n "$(SUBCATEGORY)" ]; then SUBCATEGORY_ARG="--subcategory=$(SUBCATEGORY)"; fi; \
NO_TESTS_ARG=""; \
if [ "$(NO_TESTS)" = "true" ]; then NO_TESTS_ARG="--no-tests"; fi; \
CREATE_SHARED_ARG=""; \
if [ "$(CREATE_SHARED)" = "true" ]; then CREATE_SHARED_ARG="--create-shared"; fi; \
$(UVRUN) scripts/generate_skeleton/generate_skeleton.py --type=pipeline --category="$(CATEGORY)" --name="$(NAME)" $$SUBCATEGORY_ARG $$NO_TESTS_ARG $$CREATE_SHARED_ARG; \
echo ""; \
echo "Generating READMEs..."; \
if [ -n "$(SUBCATEGORY)" ]; then \
$(UVRUN) -m scripts.generate_readme --pipeline "pipelines/$(CATEGORY)/$(SUBCATEGORY)/$(NAME)" --fix; \
else \
$(UVRUN) -m scripts.generate_readme --pipeline "pipelines/$(CATEGORY)/$(NAME)" --fix; \
fi
@$(MAKE) --no-print-directory sync-packages
tests:
@if [ -z "$(TYPE)" ]; then echo "Error: TYPE is required. Usage: make tests TYPE=component|pipeline CATEGORY=data_processing NAME=my_component [SUBCATEGORY=x]"; exit 1; fi
@if [ -z "$(CATEGORY)" ]; then echo "Error: CATEGORY is required. Usage: make tests TYPE=component|pipeline CATEGORY=data_processing NAME=my_component [SUBCATEGORY=x]"; exit 1; fi
@if [ -z "$(NAME)" ]; then echo "Error: NAME is required. Usage: make tests TYPE=component|pipeline CATEGORY=data_processing NAME=my_component [SUBCATEGORY=x]"; exit 1; fi
@if [ "$(TYPE)" = "component" ] || [ "$(TYPE)" = "pipeline" ]; then \
SUBCATEGORY_ARG=""; \
if [ -n "$(SUBCATEGORY)" ]; then SUBCATEGORY_ARG="--subcategory=$(SUBCATEGORY)"; fi; \
$(UVRUN) scripts/generate_skeleton/generate_skeleton.py --type="$(TYPE)" --category="$(CATEGORY)" --name="$(NAME)" $$SUBCATEGORY_ARG --tests-only; \
else \
echo "Error: TYPE must be either 'component' or 'pipeline'"; exit 1; \
fi
readme:
@if [ -z "$(TYPE)" ]; then echo "Error: TYPE is required. Usage: make readme TYPE=component|pipeline CATEGORY=data_processing NAME=my_component [SUBCATEGORY=x]"; exit 1; fi
@if [ -z "$(CATEGORY)" ]; then echo "Error: CATEGORY is required. Usage: make readme TYPE=component|pipeline CATEGORY=data_processing NAME=my_component [SUBCATEGORY=x]"; exit 1; fi
@if [ -z "$(NAME)" ]; then echo "Error: NAME is required. Usage: make readme TYPE=component|pipeline CATEGORY=data_processing NAME=my_component [SUBCATEGORY=x]"; exit 1; fi
@if [ "$(TYPE)" = "component" ] || [ "$(TYPE)" = "pipeline" ]; then \
if [ -n "$(SUBCATEGORY)" ]; then \
$(UVRUN) -m scripts.generate_readme "--$(TYPE)" "$(TYPE)s/$(CATEGORY)/$(SUBCATEGORY)/$(NAME)" --fix; \
else \
$(UVRUN) -m scripts.generate_readme "--$(TYPE)" "$(TYPE)s/$(CATEGORY)/$(NAME)" --fix; \
fi; \
else \
echo "Error: TYPE must be either 'component' or 'pipeline'"; exit 1; \
fi
sync-packages:
@$(UVRUN) python -m scripts.sync_packages.sync_packages