-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
74 lines (62 loc) · 2.17 KB
/
Copy pathMakefile
File metadata and controls
74 lines (62 loc) · 2.17 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
SHELL := /usr/bin/env bash
AGENT_VM_NAME ?= agent-platform
AGENT_VM_IP ?= 10.0.0.60
AGENT_VM_MAC ?= 52:54:00:00:00:01
AGENT_VM_USER ?= agent
AGENT_VM_SSH ?= $(AGENT_VM_NAME)
AGENT_VM_PUBKEY ?= $(HOME)/.ssh/$(AGENT_VM_NAME).pub
AGENT_VM_IMGDIR ?= /var/lib/libvirt/images/$(AGENT_VM_NAME)
DOCS_PYTHON ?= python3
DOCS_REQUIREMENTS ?= requirements-docs.txt
BASH_SCRIPTS := $(shell grep -rl '^#!/usr/bin/env bash' control-plane platform | sort)
YAML_FILES := $(shell find .github deploy docs examples platform -type f \( -name '*.yml' -o -name '*.yaml' \) 2>/dev/null | sort)
PLATFORM_TESTS := $(shell find platform/tests -maxdepth 1 -type f -name '*-test' 2>/dev/null | sort)
.PHONY: ci syntax lint yaml test provision docs docs-build docs-deps
ci: syntax lint yaml test
syntax:
@if [ -z "$(BASH_SCRIPTS)" ]; then \
echo "No bash scripts found"; \
else \
bash -n $(BASH_SCRIPTS); \
fi
lint:
@if ! command -v shellcheck >/dev/null 2>&1; then \
echo "shellcheck not installed; skipping shell lint"; \
elif [ -z "$(BASH_SCRIPTS)" ]; then \
echo "No bash scripts found"; \
else \
shellcheck -x -P control-plane $(BASH_SCRIPTS); \
fi
yaml:
@if [ -z "$(YAML_FILES)" ]; then \
echo "No YAML files found"; \
elif command -v ruby >/dev/null 2>&1; then \
ruby -rpsych -e 'ARGV.each { |f| Psych.parse_file(f); puts "YAML ok: #{f}" }' $(YAML_FILES); \
else \
echo "ruby not installed; skipping YAML parse"; \
fi
test:
@set -e; \
for test_script in $(PLATFORM_TESTS); do \
echo "bash $$test_script"; \
bash "$$test_script"; \
done
provision:
AGENT_VM_NAME="$(AGENT_VM_NAME)" \
AGENT_VM_IP="$(AGENT_VM_IP)" \
AGENT_VM_MAC="$(AGENT_VM_MAC)" \
AGENT_VM_USER="$(AGENT_VM_USER)" \
AGENT_VM_SSH="$(AGENT_VM_SSH)" \
AGENT_VM_PUBKEY="$(AGENT_VM_PUBKEY)" \
AGENT_VM_IMGDIR="$(AGENT_VM_IMGDIR)" \
platform/vm/provision-vm
AGENT_VM_SSH="$(AGENT_VM_SSH)" platform/vm/bootstrap-runtime
docs: docs-build
docs-deps:
$(DOCS_PYTHON) -m pip install -r $(DOCS_REQUIREMENTS)
docs-build:
@$(DOCS_PYTHON) -c 'import markdown' >/dev/null 2>&1 || { \
echo "Missing docs dependency. Run: $(DOCS_PYTHON) -m pip install -r $(DOCS_REQUIREMENTS)" >&2; \
exit 1; \
}
$(DOCS_PYTHON) site/build_docs.py