Skip to content

Fix: remove preferred_server from technician UPDATE query #186

Fix: remove preferred_server from technician UPDATE query

Fix: remove preferred_server from technician UPDATE query #186

Workflow file for this run

name: CI
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
workflow_call: # Allow release.yml to call this workflow
jobs:
# ─── PHP Lint ───────────────────────────────────────────────
php-lint:
name: PHP Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
extensions: pdo_mysql, curl, openssl, json, mbstring, redis
- name: Check PHP syntax
run: |
echo "Checking PHP files for syntax errors..."
error_count=0
while IFS= read -r file; do
if ! php -l "$file" 2>&1 | grep -q "No syntax errors"; then
php -l "$file"
error_count=$((error_count + 1))
fi
done < <(find FINAL_PRODUCTION_SYSTEM -name '*.php' -not -path '*/vendor/*' -not -path '*/frontend/*')
if [ "$error_count" -gt 0 ]; then
echo "❌ Found syntax errors in $error_count file(s)"
exit 1
else
echo "✅ All PHP files pass syntax check"
fi
# ─── Frontend Build & Test ──────────────────────────────────
frontend:
name: Frontend Build & Test
runs-on: ubuntu-latest
defaults:
run:
working-directory: FINAL_PRODUCTION_SYSTEM/frontend
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
cache-dependency-path: FINAL_PRODUCTION_SYSTEM/frontend/package-lock.json
- name: Install dependencies
run: npm ci
- name: TypeScript & Build
run: npm run build
- name: Run tests
run: npm test
- name: Lint (warnings only)
continue-on-error: true
run: npm run lint
# ─── Docker Stack Health Check ──────────────────────────────
docker-health:
name: Docker Stack
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Create .env file
run: |
cat > .env <<'EOF'
DB_HOST=db
DB_NAME=oem_activation
DB_USER=oem_user
DB_PASS=ci_oem_pass
MARIADB_ROOT_PASSWORD=ci_root_pass
REDIS_HOST=redis
REDIS_PORT=6379
REDIS_PASSWORD=ci_redis_pass
APP_TIMEZONE=UTC
BACKUP_RETENTION_DAYS=30
CORS_ORIGINS=
PHP_MEMORY_LIMIT=256M
PHP_UPLOAD_MAX_FILESIZE=50M
PHP_POST_MAX_SIZE=50M
EOF
# Strip leading whitespace from heredoc
sed -i 's/^[[:space:]]*//' .env
echo "--- .env contents ---"
cat .env
- name: Generate self-signed SSL cert for CI
run: |
mkdir -p ssl
openssl req -x509 -nodes -days 1 -newkey rsa:2048 \
-keyout ssl/server.key -out ssl/server.crt \
-subj "/CN=localhost" 2>/dev/null
echo "✅ SSL cert generated"
- name: Build Docker images
run: docker compose build
- name: Start database and Redis first
run: |
docker compose up -d db redis
echo "Waiting for database to be healthy..."
for i in $(seq 1 40); do
if docker compose exec -T db mariadb -uroot -pci_root_pass -e "SELECT 1" > /dev/null 2>&1; then
echo "✅ Database ready after ~$((i * 5))s"
break
fi
if [ "$i" -eq 40 ]; then
echo "❌ Database failed to start"
docker compose logs db
exit 1
fi
sleep 5
done
- name: Start web and remaining services
run: docker compose up -d
- name: Wait for web server
run: |
echo "Waiting for web server health endpoint..."
for i in $(seq 1 30); do
if curl -sf http://localhost:8080/api/health.php > /dev/null 2>&1; then
echo "✅ Web server healthy after ~$((i * 5))s"
break
fi
if [ "$i" -eq 30 ]; then
echo "❌ Web server failed to start"
docker compose ps
docker compose logs web --tail 50
exit 1
fi
sleep 5
done
- name: Test API health endpoint
run: |
response=$(curl -sf http://localhost:8080/api/health.php)
echo "Health response: $response"
echo "$response" | grep -q "healthy" || (echo "❌ Health check failed" && exit 1)
echo "✅ API health check passed"
- name: Test database connectivity
run: |
docker compose exec -T db mariadb -uoem_user -pci_oem_pass oem_activation -e "SELECT COUNT(*) as table_count FROM information_schema.tables WHERE table_schema = 'oem_activation';" || (echo "❌ Database check failed" && exit 1)
echo "✅ Database connectivity check passed"
- name: Cleanup
if: always()
run: docker compose down -v