-
Notifications
You must be signed in to change notification settings - Fork 43
Expand file tree
/
Copy pathMakefile
More file actions
87 lines (67 loc) · 1.96 KB
/
Copy pathMakefile
File metadata and controls
87 lines (67 loc) · 1.96 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
# Release tag
ifdef HPCDK_TAG
RELEASE_TAG := $(HPCDK_TAG)
else
RELEASE_TAG := main
endif
# Deployment bucket
ifdef HPCDK_S3_BUCKET
S3_BUCKET := $(HPCDK_S3_BUCKET)
else
S3_BUCKET := aws-hpc-recipes
endif
# CLI profile
ifdef HPCDK_PROFILE
PROFILE := $(HPCDK_PROFILE)
else
PROFILE := default
endif
PROJECTS ?= $(shell find recipes -name Makefile)
FILTER_OUT :=
PROJECTS := $(filter-out $(FILTER_OUT),$(PROJECTS))
%.ph_build :
+@$(MAKE) -C $(dir $*) $(MAKECMDGOALS)
%.ph_test :
+@$(MAKE) -C $(dir $*) test
%.ph_clean :
+@$(MAKE) -C $(dir $*) clean $(USE_DEVICE)
%.ph_clobber :
+@$(MAKE) -C $(dir $*) clobber $(USE_DEVICE)
all: $(addsuffix .ph_build,$(PROJECTS))
@echo "Finished building recipes"
build: $(addsuffix .ph_build,$(PROJECTS))
test : $(addsuffix .ph_test,$(PROJECTS))
tidy:
@find * | egrep "#" | xargs rm -f
@find * | egrep "\~" | xargs rm -f
clean: tidy $(addsuffix .ph_clean,$(PROJECTS))
clobber: clean $(addsuffix .ph_clobber,$(PROJECTS))
.PHONY: validate
validate:
@echo "=== Validating recipe structure ==="
python -m scripts.validate_structure
@echo ""
@echo "=== Validating recipe metadata ==="
python -m scripts.validate_metadata
@echo ""
@echo "=== Checking partition safety ==="
python -m scripts.validate_partitions
@echo ""
@echo "=== Running cfn-lint ==="
@files=$$(find recipes -path '*/assets/*.yaml' -o -path '*/assets/*.yml' | grep -v '.gitkeep' | xargs grep -l 'AWSTemplateFormatVersion\|^Resources:' 2>/dev/null); \
if [ -n "$$files" ]; then cfn-lint -t $$files || true; else echo "No CFN templates found."; fi
@echo ""
@echo "=== All validation complete ==="
.PHONY: deploy
deploy:
@aws s3 sync --delete --acl public-read \
--exclude "*" --include "*/assets/*" --exclude "*/.gitkeep" \
recipes s3://${S3_BUCKET}/${RELEASE_TAG}/recipes/;\
.PHONY: readme
readme:
python -m scripts.render_readme
git add recipes/README.md
set_version:
$(eval RELEASE_TAG := $(shell git describe))
@echo ${RELEASE_TAG}
release: set_version readme deploy