-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
130 lines (111 loc) · 3.29 KB
/
Makefile
File metadata and controls
130 lines (111 loc) · 3.29 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
121
122
123
124
125
126
127
128
129
130
# Git Stream Build System
#
# This Makefile provides convenient commands for building, testing, and distributing Git Stream
.PHONY: help install test test-unit test-integration test-coverage clean build-phar quality pre-release
# Default target
help:
@echo "Git Stream Build System"
@echo ""
@echo "Available targets:"
@echo " install Install dependencies"
@echo " install-dev Install with development dependencies"
@echo " install-prod Install production dependencies only"
@echo " test Run all tests"
@echo " test-unit Run unit tests only"
@echo " test-integration Run integration tests only"
@echo " test-coverage Run tests with coverage report"
@echo " quality Run all quality checks (style, analysis, tests)"
@echo " build-phar Build PHAR distribution (requires phar.readonly=0)"
@echo " clean Clean build artifacts"
@echo " pre-release Prepare for release (install, test, build)"
@echo ""
@echo "Requirements:"
@echo " - PHP 8.4+"
@echo " - Composer"
@echo " - Git"
@echo ""
# Installation targets
install:
composer install
install-dev:
composer install --dev
install-prod:
composer install --no-dev --optimize-autoloader
# Testing targets
test:
composer test
test-unit:
composer test-unit
test-integration:
composer test-integration
test-coverage:
composer test-coverage
# Quality targets
quality:
composer quality
cs-check:
composer cs-check
cs-fix:
composer cs-fix
phpstan:
composer phpstan
# Build targets
build-phar:
@echo "Building PHAR distribution..."
@if php -r "exit(Phar::canWrite() ? 0 : 1);"; then \
php scripts/build-phar.php; \
else \
echo "Error: PHAR creation is disabled."; \
echo "To enable PHAR creation:"; \
echo " 1. Edit your php.ini file"; \
echo " 2. Set: phar.readonly = Off"; \
echo " 3. Restart your web server/PHP-FPM"; \
echo ""; \
echo "Alternative: Run with override:"; \
echo " php -d phar.readonly=0 scripts/build-phar.php"; \
exit 1; \
fi
build-phar-force:
@echo "Building PHAR distribution (forcing phar.readonly=0)..."
php -d phar.readonly=0 scripts/build-phar.php
# Clean targets
clean:
rm -rf build/
rm -rf coverage/
rm -rf .phpunit.cache/
rm -rf vendor/
composer install
# Release preparation
pre-release: install-prod build-phar-force
@echo ""
@echo "✓ Pre-release preparation complete!"
@echo ""
@echo "Distribution files:"
@ls -la build/ 2>/dev/null || echo "No build files found"
@echo ""
@echo "Next steps:"
@echo " 1. Test the PHAR: php build/gstr.phar --version"
@echo " 2. Create GitHub release"
@echo " 3. Upload build/gstr.phar as release asset"
@echo " 4. Publish to Packagist (if not already done)"
# Development helpers
dev-setup: install-dev
@echo "Development environment setup complete!"
@echo ""
@echo "Available commands:"
@echo " make test - Run all tests"
@echo " make quality - Run quality checks"
@echo " make cs-fix - Fix code style"
@echo " make build-phar - Build PHAR (requires phar.readonly=0)"
@echo ""
# Validation
validate:
@echo "Validating Git Stream installation..."
@php bin/gstr --version
@echo "✓ CLI executable works"
@echo ""
@echo "Checking dependencies..."
@composer validate --strict
@echo "✓ Composer configuration valid"
@echo ""
@echo "Git Stream validation complete!"