-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
120 lines (102 loc) · 3.62 KB
/
Makefile
File metadata and controls
120 lines (102 loc) · 3.62 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
108
109
110
111
112
113
114
115
116
117
118
119
120
# =============================================================================
# CI Targets
# =============================================================================
.PHONY: ci
ci:
@echo "🚀 Running comprehensive CI validation..."
$(MAKE) fmt-check
$(MAKE) check
$(MAKE) test
@echo "All binaries clippy:"
cargo clippy --all-targets --all-features -- -D warnings
@echo "Core package publish dry run:"
cargo publish --package elf-magic --dry-run --allow-dirty
@echo "✅ CI passed"
# Release validation - comprehensive checks before publishing
.PHONY: release-validation
release-validation:
@echo "🚀 Running release validation..."
@echo "Verifying tag matches Cargo.toml version..."
@if [ -n "$$TAG_VERSION" ] && [ -n "$$(grep '^version = ' Cargo.toml | sed 's/version = \"\(.*\)\"/\1/')" ]; then \
CARGO_VERSION=$$(grep '^version = ' Cargo.toml | sed 's/version = \"\(.*\)\"/\1/'); \
if [ "$$TAG_VERSION" != "$$CARGO_VERSION" ]; then \
echo "❌ Tag version $$TAG_VERSION doesn't match Cargo.toml version $$CARGO_VERSION"; \
exit 1; \
fi; \
echo "✅ Tag version matches Cargo.toml version: $$TAG_VERSION"; \
fi
$(MAKE) ci
@echo "✅ Release validation passed"
# Publish to crates.io (requires CARGO_REGISTRY_TOKEN)
.PHONY: publish
publish:
@echo "📦 Publishing core elf-magic package to crates.io..."
cargo publish --package elf-magic --token $$CARGO_REGISTRY_TOKEN
@echo "✅ Published elf-magic to crates.io"
# Dogfooding - Use our own tool for releases! 🎯
.PHONY: release-patch release-minor release-major
release-patch:
@./scripts/release patch
release-minor:
@./scripts/release minor
release-major:
@./scripts/release major
# =============================================================================
# Testing
# =============================================================================
.PHONY: test
test: build
@echo "Running unit tests (no fixtures)..."
cargo test --lib
# =============================================================================
# Code Quality
# =============================================================================
.PHONY: fmt
fmt:
@echo "🎨 Formatting code..."
cargo fmt --all
@echo "✅ Code formatted"
.PHONY: fmt-check
fmt-check:
@echo "🎨 Checking code formatting..."
cargo fmt --all -- --check
@echo "✅ Code formatting OK"
# =============================================================================
# Development
# =============================================================================
.PHONY: check
check:
@echo "🔍 Checking workspace..."
cargo check --workspace
@echo "✅ Workspace check passed"
.PHONY: build
build:
@echo "Building elfmagic library..."
cargo build
.PHONY: clean
clean:
cargo clean
# Default target
.PHONY: help
help:
@echo "ElfMagic Development Commands:"
@echo ""
@echo "Testing:"
@echo " make test Run unit tests (fast)"
@echo ""
@echo "CI & Quality:"
@echo " make ci Comprehensive CI validation (recommended)"
@echo " make fmt Format code"
@echo " make fmt-check Check code formatting"
@echo ""
@echo "Release:"
@echo " make publish Publish to crates.io"
@echo " make release-major Release major version (breaking changes)"
@echo " make release-minor Release minor version (new features)"
@echo " make release-patch Release patch version (bug fixes)"
@echo " make release-validation Complete release validation"
@echo "Development:"
@echo " make check Check code without building"
@echo " make build Build project"
@echo " make clean Clean build artifacts and fixtures"
.DEFAULT_GOAL := help