-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
179 lines (162 loc) · 6.08 KB
/
Makefile
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
PHP_V = 8.3
OS_V = bookworm
.PHONY: all
all: build test-version test-module test-info test-tmp-files
.PHONY: test
test: test-version test-module test-info test-tmp-files
.PHONY: pull
pull:
@set -eu; \
echo "::group::-=-=- $@ \"PHP: $(PHP_V), OS: $(OS_V)\" =-=-="; \
docker pull php:$(PHP_V)-$(OS_V); \
echo "::endgroup::"
.PHONY: build
build: pull
@set -eu; \
for file in $(shell find $(CURDIR)/$(PHP_V)/$(OS_V)/ -type f -name Dockerfile | sort); do \
ext_n=$$(basename $$(dirname $$file)); \
echo "::group::-=-=- $@ \"Ext: $$ext_n, PHP: $(PHP_V), OS: $(OS_V)\" =-=-="; \
docker build -t my/php:$(PHP_V)-$(OS_V)-$$ext_n $(PHP_V)/$(OS_V)/$$ext_n; \
echo "::endgroup::"; \
done
.PHONY: clean
clean:
@set -eu; \
for file in $(shell find $(CURDIR)/$(PHP_V)/$(OS_V) -type f -name Dockerfile | sort); do \
ext_n=$$(basename $$(dirname $$file)); \
echo "::group::-=-=- $@ \"Ext: $$ext_n, PHP: $(PHP_V), OS: $(OS_V)\" =-=-="; \
docker rmi -f my/php:$(PHP_V)-$(OS_V)-$$ext_n; \
echo "::endgroup::"; \
done
.PHONY: test-version
test-version:
@set -eu; \
for file in $(shell find $(CURDIR)/$(PHP_V)/$(OS_V) -type f -name Dockerfile | sort); do \
ext_n=$$(basename $$(dirname $$file)); \
echo "::group::-=-=- $@ \"Ext: $$ext_n, PHP: $(PHP_V), OS: $(OS_V)\" =-=-="; \
docker run --rm my/php:$(PHP_V)-$(OS_V)-$$ext_n \
php --version \
; \
echo "::endgroup::"; \
done
.PHONY: test-module
test-module:
@set -eu; \
for file in $(shell find $(CURDIR)/$(PHP_V)/$(OS_V) -type f -name Dockerfile | sort); do \
ext_n=$$(basename $$(dirname $$file)); \
echo "::group::-=-=- $@ \"Ext: $$ext_n, PHP: $(PHP_V), OS: $(OS_V)\" =-=-="; \
search=$$(echo $$ext_n | sed -e 's|pecl_||'); \
docker run --rm my/php:$(PHP_V)-$(OS_V)-$$ext_n \
php -m \
| grep -i "$$search" \
; \
echo "::endgroup::"; \
done
.PHONY: test-info
test-info:
@set -eu; \
for file in $(shell find $(CURDIR)/$(PHP_V)/$(OS_V) -type f -name Dockerfile | sort); do \
ext_n=$$(basename $$(dirname $$file)); \
echo "::group::-=-=- $@ \"Ext: $$ext_n, PHP: $(PHP_V), OS: $(OS_V)\" =-=-="; \
search=$$(echo $$ext_n | sed -e 's|pecl_||'); \
docker run --rm my/php:$(PHP_V)-$(OS_V)-$$ext_n \
php -i \
| grep "$$search" \
; \
echo "::endgroup::"; \
done
.PHONY: test-tmp-files
test-tmp-files:
@set -eu; \
for file in $(shell find $(CURDIR)/$(PHP_V)/$(OS_V) -type f -name Dockerfile | sort); do \
ext_n=$$(basename $$(dirname $$file)); \
echo "::group::-=-=- $@ \"Ext: $$ext_n, PHP: $(PHP_V), OS: $(OS_V)\" =-=-="; \
docker run --rm my/php:$(PHP_V)-$(OS_V)-$$ext_n \
sh -c 'set -eu; \
[ -d "/usr/src/php" ] && echo "/usr/src/php Dirty" && exit 1 || echo "/usr/src/php Clean"; \
[ "$$(ls -A /tmp)" ] && echo "/tmp/* Dirty" && exit 1 || echo "/tmp/* Clean"; \
[ "$$(ls -A /var/tmp)" ] && echo "/var/tmp/* Dirty" && exit 1 || echo "/var/tmp/* Clean"; \
' \
; \
echo "::endgroup::"; \
done
.PHONY: new
new: new-build new-test-version new-test-module new-test-info new-test-tmp-files
.PHONY: new-test
new-test: new-test-version new-test-module new-test-info new-test-tmp-files
.PHONY: new-build
new-build:
@set -eu; \
for file in $(shell git diff --cached --name-only | grep Dockerfile | sort); do \
php_v=$$(basename $$(dirname $$(dirname $$(dirname $$file)))); \
os_v=$$(basename $$(dirname $$(dirname $$file))); \
ext_n=$$(basename $$(dirname $$file)); \
echo "-=-=- $@ \"Ext: $$ext_n, PHP: $$php_v, OS: $$os_v\" =-=-="; \
docker build -t my/php:$$php_v-$$os_v-$$ext_n $$php_v/$$os_v/$$ext_n; \
done
.PHONY: new-clean
new-clean:
@set -eu; \
for file in $(shell git diff --cached --name-only | grep Dockerfile | sort); do \
php_v=$$(basename $$(dirname $$(dirname $$(dirname $$file)))); \
os_v=$$(basename $$(dirname $$(dirname $$file))); \
ext_n=$$(basename $$(dirname $$file)); \
echo "-=-=- $@ \"Ext: $$ext_n, PHP: $$php_v, OS: $$os_v\" =-=-="; \
docker rmi -f my/php:$$php_v-$$os_v-$$ext_n; \
done
.PHONY: new-test-version
new-test-version:
@set -eu; \
for file in $(shell git diff --cached --name-only | grep Dockerfile | sort); do \
php_v=$$(basename $$(dirname $$(dirname $$(dirname $$file)))); \
os_v=$$(basename $$(dirname $$(dirname $$file))); \
ext_n=$$(basename $$(dirname $$file)); \
echo "-=-=- $@ \"Ext: $$ext_n, PHP: $$php_v, OS: $$os_v\" =-=-="; \
docker run --rm my/php:$$php_v-$$os_v-$$ext_n \
php --version \
; \
done
.PHONY: new-test-module
new-test-module:
@set -eu; \
for file in $(shell git diff --cached --name-only | grep Dockerfile | sort); do \
php_v=$$(basename $$(dirname $$(dirname $$(dirname $$file)))); \
os_v=$$(basename $$(dirname $$(dirname $$file))); \
ext_n=$$(basename $$(dirname $$file)); \
echo "-=-=- $@ \"Ext: $$ext_n, PHP: $$php_v, OS: $$os_v\" =-=-="; \
search=$$(echo $$ext_n | sed -e 's|pecl_||'); \
docker run --rm my/php:$$php_v-$$os_v-$$ext_n \
php -m \
| grep -i "$$search" \
; \
done
.PHONY: new-test-info
new-test-info:
@set -eu; \
for file in $(shell git diff --cached --name-only | grep Dockerfile | sort); do \
php_v=$$(basename $$(dirname $$(dirname $$(dirname $$file)))); \
os_v=$$(basename $$(dirname $$(dirname $$file))); \
ext_n=$$(basename $$(dirname $$file)); \
echo "-=-=- $@ \"Ext: $$ext_n, PHP: $$php_v, OS: $$os_v\" =-=-="; \
search=$$(echo $$ext_n | sed -e 's|pecl_||'); \
docker run --rm my/php:$$php_v-$$os_v-$$ext_n \
php -i \
| grep "$$search" \
; \
done
.PHONY: new-test-tmp-files
new-test-tmp-files:
@set -eu; \
for file in $(shell git diff --cached --name-only | grep Dockerfile | sort); do \
php_v=$$(basename $$(dirname $$(dirname $$(dirname $$file)))); \
os_v=$$(basename $$(dirname $$(dirname $$file))); \
ext_n=$$(basename $$(dirname $$file)); \
echo "-=-=- $@ \"Ext: $$ext_n, PHP: $$php_v, OS: $$os_v\" =-=-="; \
docker run --rm my/php:$$php_v-$$os_v-$$ext_n \
sh -c 'set -eu; \
[ -d "/usr/src/php" ] && echo "/usr/src/php Dirty" && exit 1 || echo "/usr/src/php Clean"; \
[ "$$(ls -A /tmp)" ] && echo "/tmp/* Dirty" && exit 1 || echo "/tmp/* Clean"; \
[ "$$(ls -A /var/tmp)" ] && echo "/var/tmp/* Dirty" && exit 1 || echo "/var/tmp/* Clean"; \
' \
; \
done