forked from php-imagine/Imagine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun-tests.sh
More file actions
executable file
·55 lines (46 loc) · 2 KB
/
run-tests.sh
File metadata and controls
executable file
·55 lines (46 loc) · 2 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
#!/bin/bash
LOG_DIR="/tmp"
# Default test matrix
# Note: gmagick doesn't compile on PHP 8.5, so it's excluded
DEFAULT_SERVICES="php83-imagick php83-gmagick php84-imagick php84-gmagick php85-imagick"
SERVICES="${1:-$DEFAULT_SERVICES}"
echo "=== Imagine PHP Compatibility Tests ===" | tee "${LOG_DIR}/imagine-tests.log"
echo "Services: ${SERVICES}" | tee -a "${LOG_DIR}/imagine-tests.log"
echo "" | tee -a "${LOG_DIR}/imagine-tests.log"
PASSED=0
FAILED=0
RESULTS=""
for SERVICE in ${SERVICES}; do
LOG_FILE="${LOG_DIR}/imagine-${SERVICE}.log"
echo "=== Testing ${SERVICE} ===" | tee -a "${LOG_DIR}/imagine-tests.log"
# Build the image first
docker-compose build "${SERVICE}" 2>&1 | tee "${LOG_FILE}.build"
if [ ${PIPESTATUS[0]} -ne 0 ]; then
RESULTS="${RESULTS}\n${SERVICE}: BUILD FAILED"
echo "${SERVICE}: BUILD FAILED" | tee -a "${LOG_DIR}/imagine-tests.log"
FAILED=$((FAILED + 1))
echo "" | tee -a "${LOG_DIR}/imagine-tests.log"
continue
fi
# Run tests
docker-compose run --rm "${SERVICE}" sh -c \
"php -v && composer install --quiet && composer run test -- --exclude-group always-skipped" 2>&1 | tee "${LOG_FILE}"
if [ ${PIPESTATUS[0]} -eq 0 ]; then
RESULTS="${RESULTS}\n${SERVICE}: PASSED"
echo "${SERVICE}: PASSED" | tee -a "${LOG_DIR}/imagine-tests.log"
PASSED=$((PASSED + 1))
else
RESULTS="${RESULTS}\n${SERVICE}: FAILED"
echo "${SERVICE}: FAILED" | tee -a "${LOG_DIR}/imagine-tests.log"
FAILED=$((FAILED + 1))
fi
echo "" | tee -a "${LOG_DIR}/imagine-tests.log"
done
echo "=== Summary ===" | tee -a "${LOG_DIR}/imagine-tests.log"
echo -e "${RESULTS}" | tee -a "${LOG_DIR}/imagine-tests.log"
echo "" | tee -a "${LOG_DIR}/imagine-tests.log"
echo "Passed: ${PASSED}, Failed: ${FAILED}" | tee -a "${LOG_DIR}/imagine-tests.log"
echo "=== Done ===" | tee -a "${LOG_DIR}/imagine-tests.log"
echo "Logs available at: ${LOG_DIR}/imagine-*.log"
# Exit with failure if any tests failed
[ ${FAILED} -eq 0 ]