5d735b2987
SamiOS CI / lint-and-test (push) Successful in 10s
- packages.x86_64.desktop: 30+ packages for desktop variant (Plasma, Firefox, VLC, LibreOffice, PipeWire). No duplicates with base list. - build-desktop.sh: creates temp profile, merges package lists, enables SDDM via preset + display-manager.service symlink. WORK_DIR is mktemp-created (not caller-selected) to prevent symlink races. VERSION copied into temp profile so profiledef.sh resolves correctly. Cleans up both temp dirs via trap. - CI workflow: Python AST validation (sys.argv), VERSION SSOT gate, single make check (no double-lint). - test_packages.sh: 15 assertions for desktop overlay (existence, package count, no dups, Plasma/Firefox exact match, build script structure: mktemp WORK_DIR, VERSION copy, SDDM, cleanup trap). Codex D-grade findings fixed: symlink race (use mktemp), VERSION path (../../VERSION not ../VERSION).
95 lines
3.8 KiB
Makefile
95 lines
3.8 KiB
Makefile
.PHONY: test lint check build clean help version version-set version-sync
|
|
|
|
# ── Paths ──────────────────────────────────────────────────────────────
|
|
REPO_ROOT := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
|
|
PROFILE_DIR := $(REPO_ROOT)/packaging/archiso
|
|
SCRIPTS_DIR := $(REPO_ROOT)/packaging/scripts
|
|
TESTS_DIR := $(REPO_ROOT)/tests
|
|
VERSION_FILE := $(REPO_ROOT)/VERSION
|
|
|
|
# Shell scripts to lint with shellcheck
|
|
SHELL_SCRIPTS := \
|
|
$(PROFILE_DIR)/profiledef.sh \
|
|
$(PROFILE_DIR)/build.sh \
|
|
$(PROFILE_DIR)/build-desktop.sh \
|
|
$(PROFILE_DIR)/airootfs/usr/local/bin/samios \
|
|
$(PROFILE_DIR)/airootfs/usr/local/bin/choose-mirror \
|
|
$(PROFILE_DIR)/airootfs/root/.automated_script.sh \
|
|
$(SCRIPTS_DIR)/samios-desktop-setup.sh \
|
|
$(SCRIPTS_DIR)/samios-installer.sh \
|
|
$(TESTS_DIR)/test_helper.sh \
|
|
$(TESTS_DIR)/test_profiledef.sh \
|
|
$(TESTS_DIR)/test_packages.sh \
|
|
$(TESTS_DIR)/test_pacman_conf.sh \
|
|
$(TESTS_DIR)/test_samios_cli.sh \
|
|
$(TESTS_DIR)/test_font_policy.sh \
|
|
$(TESTS_DIR)/test_version.sh \
|
|
$(TESTS_DIR)/test_installer.sh \
|
|
$(TESTS_DIR)/test_voice_bridge.sh \
|
|
$(TESTS_DIR)/run_tests.sh
|
|
|
|
SHELLCHECK ?= shellcheck
|
|
SHELLCHECK_OPTS := --severity=warning
|
|
# SC2034 (unused var) is expected in profile definitions and CLI stubs
|
|
SHELLCHECK_EXCLUDE := --exclude=SC2034
|
|
|
|
# ── Targets ────────────────────────────────────────────────────────────
|
|
|
|
help: ## Show this help
|
|
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
|
|
awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-12s\033[0m %s\n", $$1, $$2}'
|
|
|
|
test: ## Run the test suite
|
|
@echo "Running SamiOS test suite..."
|
|
@bash $(TESTS_DIR)/run_tests.sh --verbose
|
|
|
|
lint: ## Run shellcheck on all shell scripts
|
|
@echo "Running shellcheck..."
|
|
@for script in $(SHELL_SCRIPTS); do \
|
|
if [ -f "$$script" ]; then \
|
|
echo " shellcheck $$script"; \
|
|
$(SHELLCHECK) $(SHELLCHECK_OPTS) $(SHELLCHECK_EXCLUDE) "$$script" || exit 1; \
|
|
fi \
|
|
done
|
|
@echo "shellcheck passed ✓"
|
|
|
|
check: lint test ## Run lint + test (CI entry point)
|
|
|
|
build: ## Build the SamiOS ISO (requires archiso + root)
|
|
@echo "Building SamiOS ISO..."
|
|
@cd $(PROFILE_DIR) && sudo ./build.sh
|
|
|
|
clean: ## Remove build artifacts
|
|
@echo "Cleaning build artifacts..."
|
|
@rm -rf /tmp/samios-build
|
|
@rm -rf $(PROFILE_DIR)/out
|
|
@echo "Clean complete"
|
|
|
|
# ── Version management ─────────────────────────────────────────────────
|
|
# VERSION is the single source of truth. Bumping it is a one-line edit
|
|
# to $(VERSION_FILE); version-sync mirrors it into the airootfs overlay.
|
|
|
|
version: ## Print the current SamiOS version
|
|
@cat $(VERSION_FILE)
|
|
|
|
version-sync: ## Mirror VERSION into the airootfs overlay
|
|
@if [ ! -f "$(VERSION_FILE)" ]; then \
|
|
echo "ERROR: $(VERSION_FILE) does not exist"; exit 1; \
|
|
fi
|
|
@install -d -m 755 $(PROFILE_DIR)/airootfs/etc
|
|
@install -m 644 $(VERSION_FILE) $(PROFILE_DIR)/airootfs/etc/samios-version
|
|
@echo "Synced $(VERSION_FILE) → $(PROFILE_DIR)/airootfs/etc/samios-version"
|
|
@echo " Content: $$(cat $(VERSION_FILE))"
|
|
|
|
version-set: ## Set VERSION to an explicit value (usage: make version-set NEW=X.Y.Z)
|
|
@if [ -z "$(NEW)" ]; then \
|
|
echo "Usage: make version-set NEW=X.Y.Z"; exit 1; \
|
|
fi
|
|
@if ! echo "$(NEW)" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9]+(\.[a-zA-Z0-9]+)*)?$$'; then \
|
|
echo "ERROR: NEW must be semver-ish (X.Y.Z or X.Y.Z-suffix; suffix is dot-separated alphanumerics)"; exit 1; \
|
|
fi
|
|
@echo "$(NEW)" > $(VERSION_FILE)
|
|
@$(MAKE) --no-print-directory version-sync
|
|
@echo ""
|
|
@echo "Set to $(NEW). Run 'make check' to verify, then commit."
|