Reviewer 역할 검증 보고서 smoke #5
1 changed files with 147 additions and 0 deletions
147
scripts/verify-smoke.sh
Normal file
147
scripts/verify-smoke.sh
Normal file
|
|
@ -0,0 +1,147 @@
|
|||
#!/bin/bash
|
||||
# Smoke Verification Script
|
||||
# Usage: ./scripts/verify-smoke.sh
|
||||
|
||||
set -e
|
||||
|
||||
PROJECT_NAME="runtime-role-matrix-live-202607141522-v4"
|
||||
REPORT_DIR="docs/reviewer/reports"
|
||||
TIMESTAMP=$(date +"%Y%m%d_%H%M%S")
|
||||
|
||||
# Colors for output
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m'
|
||||
|
||||
log_info() { echo -e "${GREEN}[INFO]${NC} $1"; }
|
||||
log_warn() { echo -e "${YELLOW}[WARN]${NC} $1"; }
|
||||
log_error() { echo -e "${RED}[ERROR]${NC} $1"; }
|
||||
|
||||
# Create report directory
|
||||
mkdir -p "${REPORT_DIR}"
|
||||
|
||||
log_info "Starting Smoke Verification for ${PROJECT_NAME}"
|
||||
|
||||
# 1. Verify Changed Files
|
||||
echo ""
|
||||
log_info "=== 1. Changed Files Verification ==="
|
||||
|
||||
if [ -d ".git" ]; then
|
||||
CHANGED_FILES=$(git diff --name-only HEAD~1 2>/dev/null || echo "")
|
||||
if [ -n "${CHANGED_FILES}" ]; then
|
||||
echo "Changed files:"
|
||||
echo "${CHANGED_FILES}" | while read -r file; do
|
||||
echo " - ${file}"
|
||||
done
|
||||
echo "CHANGED_FILES=${CHANGED_FILES}" > "${REPORT_DIR}/changed_files_${TIMESTAMP}.txt"
|
||||
else
|
||||
log_warn "No changed files found"
|
||||
fi
|
||||
else
|
||||
log_warn "Not a git repository, skipping changed files check"
|
||||
fi
|
||||
|
||||
# 2. Run Tests
|
||||
echo ""
|
||||
log_info "=== 2. Test Verification ==="
|
||||
|
||||
if [ -f "pom.xml" ]; then
|
||||
log_info "Running Maven tests..."
|
||||
mvn test -q 2>&1 | tee "${REPORT_DIR}/test_results_${TIMESTAMP}.txt"
|
||||
TEST_RESULT=$?
|
||||
if [ ${TEST_RESULT} -eq 0 ]; then
|
||||
log_info "All tests passed"
|
||||
else
|
||||
log_error "Some tests failed"
|
||||
fi
|
||||
elif [ -f "package.json" ]; then
|
||||
log_info "Running npm tests..."
|
||||
npm test 2>&1 | tee "${REPORT_DIR}/test_results_${TIMESTAMP}.txt"
|
||||
TEST_RESULT=$?
|
||||
else
|
||||
log_warn "No test framework detected"
|
||||
TEST_RESULT=0
|
||||
fi
|
||||
|
||||
# 3. CI Verification
|
||||
echo ""
|
||||
log_info "=== 3. CI Verification ==="
|
||||
|
||||
if [ -f ".github/workflows/ci.yml" ] || [ -f ".gitlab-ci.yml" ] || [ -f "Jenkinsfile" ]; then
|
||||
log_info "CI configuration found"
|
||||
echo "CI_CONFIG=found" > "${REPORT_DIR}/ci_status_${TIMESTAMP}.txt"
|
||||
else
|
||||
log_warn "No CI configuration found"
|
||||
echo "CI_CONFIG=not_found" > "${REPORT_DIR}/ci_status_${TIMESTAMP}.txt"
|
||||
fi
|
||||
|
||||
# 4. Build Verification
|
||||
echo ""
|
||||
log_info "=== 4. Build Verification ==="
|
||||
|
||||
if [ -f "pom.xml" ]; then
|
||||
log_info "Building with Maven..."
|
||||
mvn clean package -DskipTests -q 2>&1 | tee "${REPORT_DIR}/build_results_${TIMESTAMP}.txt"
|
||||
BUILD_RESULT=$?
|
||||
if [ ${BUILD_RESULT} -eq 0 ]; then
|
||||
log_info "Build successful"
|
||||
else
|
||||
log_error "Build failed"
|
||||
fi
|
||||
elif [ -f "package.json" ]; then
|
||||
log_info "Building with npm..."
|
||||
npm run build 2>&1 | tee "${REPORT_DIR}/build_results_${TIMESTAMP}.txt"
|
||||
BUILD_RESULT=$?
|
||||
else
|
||||
log_warn "No build configuration detected"
|
||||
BUILD_RESULT=0
|
||||
fi
|
||||
|
||||
# 5. Generate Summary Report
|
||||
echo ""
|
||||
log_info "=== 5. Generating Summary Report ==="
|
||||
|
||||
cat > "${REPORT_DIR}/smoke_summary_${TIMESTAMP}.json" << EOF
|
||||
{
|
||||
"project": "${PROJECT_NAME}",
|
||||
"timestamp": "${TIMESTAMP}",
|
||||
"verification_type": "smoke",
|
||||
"results": {
|
||||
"changed_files": {
|
||||
"status": "verified",
|
||||
"count": $(echo "${CHANGED_FILES}" | grep -c "^" || echo 0)
|
||||
},
|
||||
"tests": {
|
||||
"status": $([ ${TEST_RESULT} -eq 0 ] && echo "passed" || echo "failed"),
|
||||
"exit_code": ${TEST_RESULT}
|
||||
},
|
||||
"ci": {
|
||||
"status": "verified"
|
||||
},
|
||||
"build": {
|
||||
"status": $([ ${BUILD_RESULT} -eq 0 ] && echo "success" || echo "failed"),
|
||||
"exit_code": ${BUILD_RESULT}
|
||||
}
|
||||
},
|
||||
"overall_status": $([ ${TEST_RESULT} -eq 0 ] && [ ${BUILD_RESULT} -eq 0 ] && echo "passed" || echo "failed"),
|
||||
"report_files": {
|
||||
"changed_files": "${REPORT_DIR}/changed_files_${TIMESTAMP}.txt",
|
||||
"test_results": "${REPORT_DIR}/test_results_${TIMESTAMP}.txt",
|
||||
"ci_status": "${REPORT_DIR}/ci_status_${TIMESTAMP}.txt",
|
||||
"build_results": "${REPORT_DIR}/build_results_${TIMESTAMP}.txt"
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
log_info "Summary report: ${REPORT_DIR}/smoke_summary_${TIMESTAMP}.json"
|
||||
|
||||
# Final status
|
||||
echo ""
|
||||
if [ ${TEST_RESULT} -eq 0 ] && [ ${BUILD_RESULT} -eq 0 ]; then
|
||||
log_info "=== SMOKE VERIFICATION PASSED ==="
|
||||
exit 0
|
||||
else
|
||||
log_error "=== SMOKE VERIFICATION FAILED ==="
|
||||
exit 1
|
||||
fi
|
||||
Loading…
Add table
Add a link
Reference in a new issue