Skip to content

fix: resolve Adobe CF compatibility issues in router performance indexes #16

fix: resolve Adobe CF compatibility issues in router performance indexes

fix: resolve Adobe CF compatibility issues in router performance indexes #16

name: Test Lucee 7 + MySQL
on:
push:
branches:
- 'claude/**'
permissions:
contents: write
jobs:
test-lucee7-mysql:
name: Lucee 7 + MySQL
runs-on: ubuntu-latest
env:
PORT: 60007
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Start Lucee 7
run: docker compose up -d lucee7
- name: Start MySQL
run: docker compose up -d mysql
- name: Wait for MySQL to be healthy
run: |
echo "Waiting for MySQL to be ready..."
MAX_WAIT=30
WAIT_COUNT=0
while [ "$WAIT_COUNT" -lt "$MAX_WAIT" ]; do
WAIT_COUNT=$((WAIT_COUNT + 1))
echo -n "Checking MySQL (attempt ${WAIT_COUNT}/${MAX_WAIT})... "
if docker exec $(docker ps -q -f "name=mysql") mysqladmin ping -h localhost -u root -pwheelstestdb --silent 2>/dev/null; then
echo "MySQL is ready!"
break
else
echo "Not ready yet"
sleep 5
fi
done
if [ "$WAIT_COUNT" -ge "$MAX_WAIT" ]; then
echo "Warning: MySQL may not be fully ready after ${MAX_WAIT} attempts"
fi
- name: Wait for Lucee 7 to be ready
run: |
echo "Waiting for Lucee 7 to be ready..."
# Wait for container to exist
timeout 150 bash -c 'until docker ps --filter "name=lucee7" | grep -q "lucee7"; do
echo "Waiting for container to start..."
sleep 2
done'
# Wait for service to respond
MAX_WAIT=60
WAIT_COUNT=0
while [ "$WAIT_COUNT" -lt "$MAX_WAIT" ]; do
WAIT_COUNT=$((WAIT_COUNT + 1))
echo -n "Checking service (attempt ${WAIT_COUNT}/${MAX_WAIT})... "
if curl -s -o /dev/null --connect-timeout 2 --max-time 5 -w "%{http_code}" "http://localhost:${PORT}/" | grep -q "200\|404\|302"; then
echo "Service is ready!"
break
else
echo "Not ready yet"
if [ "$WAIT_COUNT" -lt "$MAX_WAIT" ]; then
sleep 5
fi
fi
done
if [ "$WAIT_COUNT" -ge "$MAX_WAIT" ]; then
echo "Warning: Service may not be fully ready after ${MAX_WAIT} attempts"
fi
- name: Run Tests
id: run-tests
run: |
TEST_URL="http://localhost:${PORT}/wheels/core/tests?db=mysql&format=json&only=failure,error"
RESULT_FILE="/tmp/lucee7-mysql-result.txt"
MAX_RETRIES=3
RETRY_COUNT=0
HTTP_CODE="000"
while [ "$RETRY_COUNT" -lt "$MAX_RETRIES" ] && [ "$HTTP_CODE" = "000" ]; do
RETRY_COUNT=$((RETRY_COUNT + 1))
echo "Test attempt ${RETRY_COUNT} of ${MAX_RETRIES}..."
HTTP_CODE=$(curl -s -o "${RESULT_FILE}" \
--max-time 900 \
--write-out "%{http_code}" \
"${TEST_URL}" || echo "000")
echo "HTTP Code: ${HTTP_CODE}"
if [ "$HTTP_CODE" = "000" ] && [ "$RETRY_COUNT" -lt "$MAX_RETRIES" ]; then
echo "Connection failed, waiting 10 seconds before retry..."
sleep 10
fi
done
echo "http_code=${HTTP_CODE}" >> $GITHUB_OUTPUT
if [ -f "$RESULT_FILE" ]; then
echo "Response content:"
cat "$RESULT_FILE"
fi
if [ "$HTTP_CODE" = "200" ]; then
echo "Tests passed with HTTP 200"
exit 0
else
echo "Tests failed with HTTP code: ${HTTP_CODE}"
exit 1
fi
- name: Debug Information
if: failure()
run: |
echo "=== Docker Container Status ==="
docker ps -a
echo -e "\n=== Container Logs for lucee7 ==="
docker logs $(docker ps -aq -f "name=lucee7") 2>&1 | tail -50 || echo "Could not get logs"
echo -e "\n=== Container Logs for mysql ==="
docker logs $(docker ps -aq -f "name=mysql") 2>&1 | tail -50 || echo "Could not get logs"
echo -e "\n=== Test Result File ==="
if [ -f "/tmp/lucee7-mysql-result.txt" ]; then
cat "/tmp/lucee7-mysql-result.txt"
else
echo "Result file not found"
fi
- name: Commit workflow results to branch
if: always()
run: |
RESULTS_DIR=".github/workflow-results"
RESULTS_FILE="${RESULTS_DIR}/test-lucee7-mysql.md"
mkdir -p "$RESULTS_DIR"
# Determine status
if [ "${{ steps.run-tests.outcome }}" = "success" ]; then
STATUS="PASSED"
else
STATUS="FAILED"
fi
# Build the results file
echo "# Workflow Results: Test Lucee 7 + MySQL" > "$RESULTS_FILE"
{
echo ""
echo "**Status:** ${STATUS}"
echo "**Run:** [#${{ github.run_number }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})"
echo "**Commit:** ${{ github.sha }}"
echo "**Branch:** ${{ github.ref_name }}"
echo "**Date:** $(date -u '+%Y-%m-%d %H:%M:%S UTC')"
echo ""
echo "## Test Results"
echo ""
if [ -f "/tmp/lucee7-mysql-result.txt" ]; then
CONTENT=$(cat /tmp/lucee7-mysql-result.txt)
# Try to detect if content is JSON and format accordingly
if echo "$CONTENT" | python3 -m json.tool > /dev/null 2>&1; then
echo '```json'
echo "$CONTENT" | python3 -m json.tool 2>/dev/null || echo "$CONTENT"
echo '```'
else
echo '```'
echo "$CONTENT"
echo '```'
fi
else
echo "No test result file was generated."
fi
} >> "$RESULTS_FILE"
# Add debug info on failure
if [ "$STATUS" = "FAILED" ]; then
{
echo ""
echo "## Debug Information"
echo ""
echo "### Docker Container Status"
echo '```'
docker ps -a 2>&1 || echo "Could not get container status"
echo '```'
echo ""
echo "### Lucee 7 Container Logs (last 50 lines)"
echo '```'
docker logs $(docker ps -aq -f "name=lucee7") 2>&1 | tail -50 || echo "Could not get logs"
echo '```'
echo ""
echo "### MySQL Container Logs (last 50 lines)"
echo '```'
docker logs $(docker ps -aq -f "name=mysql") 2>&1 | tail -50 || echo "Could not get logs"
echo '```'
} >> "$RESULTS_FILE"
fi
# Commit and push results back to the branch
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add "$RESULTS_FILE"
# Only commit if there are changes
if git diff --cached --quiet; then
echo "No changes to commit"
else
git commit -m "ci: add workflow results for test-lucee7-mysql [skip ci]"
git push origin HEAD:${{ github.ref_name }}
fi
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-lucee7-mysql
path: /tmp/lucee7-mysql-result.txt