-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
103 lines (83 loc) · 3.9 KB
/
Copy pathMakefile
File metadata and controls
103 lines (83 loc) · 3.9 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
# BAUER GROUP XPD-RPIImage - Makefile wrapper
SHELL := /usr/bin/env bash
.SHELLFLAGS := -eu -o pipefail -c
.DEFAULT_GOAL := help
VARIANT ?= canbus-plattform
CONFIG := config/variants/$(VARIANT).json
# Default to ./.env when it exists: README's quick start says to create it,
# and without this the file is silently ignored and the image is built with
# the config defaults instead of the credentials the user just set.
ENV_FILE ?= $(wildcard .env)
PY := python3
PIP := $(PY) -m pip
.PHONY: help
help: ## show this help
@awk 'BEGIN{FS=":.*##"; printf "targets:\n"} /^[a-zA-Z_-]+:.*##/ {printf " %-18s %s\n", $$1, $$2}' $(MAKEFILE_LIST)
.PHONY: deps
deps: ## install Python dev deps
$(PIP) install -r scripts/requirements.txt
.PHONY: validate
validate: ## schema-check every variant (no rendering)
@# Every other entry point (tools/run.* and the CI validate job) checks all
@# variants; checking only $(VARIANT) here made `make validate` pass while
@# a sibling variant was broken. Use `make validate-one VARIANT=x` for one.
@for f in config/variants/*.json; do \
$(PY) scripts/generate.py "$$f" $(if $(ENV_FILE),--env-file $(ENV_FILE),) --dry-run > /dev/null; \
echo "ok: $$f valid"; \
done
.PHONY: validate-one
validate-one: ## schema-check a single variant (VARIANT=..., default canbus-plattform)
$(PY) scripts/generate.py $(CONFIG) $(if $(ENV_FILE),--env-file $(ENV_FILE),) --dry-run > /dev/null
@echo "ok: $(CONFIG) valid"
.PHONY: render
render: ## resolve env vars + render generated module files
$(PY) scripts/generate.py $(CONFIG) $(if $(ENV_FILE),--env-file $(ENV_FILE),)
.PHONY: test
test: test-config-guards test-selfupdate test-parity test-idempotence test-guards test-update ## run all tests (needs docker)
.PHONY: test-config-guards
test-config-guards: ## assert _semantic_validate() refuses broken variants (no docker)
bash tests/test-config-guards.sh
.PHONY: test-selfupdate
test-selfupdate: ## exercise `bgrpiimage-setup update --self`
bash tests/test-selfupdate.sh
.PHONY: test-parity
test-parity: render ## assert apply.sh still produces what the chroot scripts did
bash tests/test-apply-parity.sh
.PHONY: test-idempotence
test-idempotence: render ## assert applying a release twice is a no-op
bash tests/test-apply-idempotence.sh
.PHONY: test-guards
test-guards: ## assert the apply-lib guards actually refuse
bash tests/test-apply-guards.sh
.PHONY: test-update
test-update: bundle ## end-to-end bgrpiimage-update against dirty fixtures
bash tests/test-update.sh
.PHONY: push-secrets
push-secrets: ## upload signing keys to GitHub Actions secrets (needs gh)
$(PY) scripts/push-secrets.py
.PHONY: bundle
bundle: render ## pack the update bundle for $(VARIANT)
$(PY) scripts/bundle.py $(CONFIG) $(if $(ENV_FILE),--env-file $(ENV_FILE),) --out dist
.PHONY: bootstrap
bootstrap: ## clone/update CustomPiOS into ./CustomPiOS
bash scripts/bootstrap.sh
.PHONY: build
build: render bootstrap ## build the image for $(VARIANT) (needs docker + privileged)
bash scripts/build.sh $(if $(ENV_FILE),--env-file $(ENV_FILE),) $(VARIANT)
.PHONY: clean
clean: ## remove generated module files and build workspace
@# generate.py renders into filesystem/root/opt/bgrpiimage/<module>, not
@# into a _generated/ directory - the old pattern matched nothing.
@rm -rf src/modules/*/filesystem/root/opt/bgrpiimage
@# build_dist creates workspace-<variant> for every non-default variant;
@# plain src/workspace only exists for the "default" variant.
@rm -rf src/workspace src/workspace-* dist
@# generated at build time by scripts/build.sh / update-custompios-paths
@rm -f src/config.local src/custompios_path src/build.log
@# generated variant configs (gitignored build output, see .gitignore)
@rm -f src/variants/*/config
@echo "cleaned (base image cache kept - use distclean to drop it)"
.PHONY: distclean
distclean: clean ## also remove CustomPiOS checkout and the base image cache
@rm -rf CustomPiOS src/image-cache
@echo "distcleaned"