|
1 | | -name: Basic CI |
| 1 | +name: Basic CI |
2 | 2 |
|
3 | | -# Basic CI workflow for syntax and lint checks. |
4 | | -# This workflow ensures the codebase has no syntax errors and passes linting. |
| 3 | +# Basic CI workflow for backend syntax and lint checks. |
| 4 | +# This workflow ensures the backend codebase has no syntax errors and passes linting. |
5 | 5 | # It does NOT run tests, start servers, or require external services. |
| 6 | +# |
| 7 | +# Note: Frontend source code is in a separate private repository. |
| 8 | +# Frontend CI/CD is handled there. This repo only contains pre-built frontend assets. |
6 | 9 |
|
7 | 10 | on: |
8 | 11 | push: |
@@ -72,70 +75,43 @@ jobs: |
72 | 75 | # - Core module structure is intact |
73 | 76 |
|
74 | 77 | frontend-check: |
75 | | - name: Frontend Syntax Check |
| 78 | + name: Frontend Build Check |
76 | 79 | runs-on: ubuntu-latest |
77 | 80 |
|
78 | 81 | steps: |
79 | 82 | - name: Checkout code |
80 | 83 | uses: actions/checkout@v4 |
81 | 84 |
|
82 | | - - name: Set up Node.js |
83 | | - uses: actions/setup-node@v4 |
84 | | - with: |
85 | | - node-version: '20' |
86 | | - # Use Node.js 20 to meet dependency requirements (commander@14.0.0 requires Node >= 20) |
87 | | - # Note: Dockerfile uses Node 18, but dependencies require Node 20 |
88 | | - |
89 | | - - name: Install dependencies |
90 | | - working-directory: ./quantdinger_vue |
91 | | - env: |
92 | | - HUSKY: 0 |
93 | | - # Disable husky in CI (git hooks are not needed in CI environment) |
| 85 | + - name: Verify frontend dist exists |
94 | 86 | run: | |
95 | | - # Project uses yarn (as specified in package.json packageManager field) |
96 | | - # Enable corepack to use the correct yarn version |
97 | | - corepack enable |
98 | | - # Configure yarn registry with fallback to mirror for better reliability |
99 | | - # Try official registry first, fallback to Taobao mirror if needed |
100 | | - yarn config set registry https://registry.npmjs.org/ || true |
101 | | - yarn config set network-timeout 300000 || true |
102 | | - # IMPORTANT: skip lifecycle scripts in CI to avoid running `prepare` (husky install), |
103 | | - # which fails because `.git` is not present in GitHub Actions checkouts by default. |
104 | | - # Retry logic: try up to 3 times with exponential backoff |
105 | | - max_retries=3 |
106 | | - retry_count=0 |
107 | | - while [ $retry_count -lt $max_retries ]; do |
108 | | - if yarn install --frozen-lockfile --ignore-scripts; then |
109 | | - echo "✓ Dependencies installed successfully" |
110 | | - break |
111 | | - else |
112 | | - retry_count=$((retry_count + 1)) |
113 | | - if [ $retry_count -lt $max_retries ]; then |
114 | | - echo "⚠ Install failed, retrying ($retry_count/$max_retries)..." |
115 | | - # Switch to Taobao mirror on retry for better reliability in China/network issues |
116 | | - if [ $retry_count -eq 2 ]; then |
117 | | - echo "Switching to Taobao mirror for retry..." |
118 | | - yarn config set registry https://registry.npmmirror.com/ || true |
119 | | - fi |
120 | | - sleep $((retry_count * 5)) |
121 | | - else |
122 | | - echo "✗ Failed to install dependencies after $max_retries attempts" |
123 | | - exit 1 |
124 | | - fi |
125 | | - fi |
126 | | - done |
127 | | - # Use --frozen-lockfile for reproducible installs. Use --ignore-scripts to keep CI non-intrusive. |
| 87 | + # Since frontend source is in a private repo, we only verify |
| 88 | + # that the pre-built frontend assets are present and valid |
| 89 | + echo "Checking frontend dist directory..." |
| 90 | + if [ -d "frontend/dist" ] && [ "$(ls -A frontend/dist 2>/dev/null)" ]; then |
| 91 | + echo "✓ frontend/dist/ exists and is not empty" |
| 92 | + echo "Files found:" |
| 93 | + find frontend/dist -type f | head -20 |
| 94 | + else |
| 95 | + echo "⚠ frontend/dist/ is empty or missing" |
| 96 | + echo "This is expected for initial setup. Run build-frontend.sh or wait for CI to populate it." |
| 97 | + fi |
128 | 98 |
|
129 | | - - name: Frontend lint check |
130 | | - working-directory: ./quantdinger_vue |
| 99 | + - name: Verify Nginx config |
131 | 100 | run: | |
132 | | - # Run ESLint to check JavaScript/Vue syntax and code quality |
133 | | - # Using --no-fix to ensure we only check, not modify code |
134 | | - npm run lint:nofix |
135 | | - # This will FAIL if: |
136 | | - # - JavaScript/Vue syntax errors exist |
137 | | - # - ESLint rules are violated |
138 | | - # This will PASS if: |
139 | | - # - Code is syntactically valid |
140 | | - # - Code passes ESLint rules |
| 101 | + echo "Checking Nginx configuration..." |
| 102 | + if [ -f "frontend/nginx.conf" ]; then |
| 103 | + echo "✓ frontend/nginx.conf exists" |
| 104 | + else |
| 105 | + echo "✗ frontend/nginx.conf is missing!" |
| 106 | + exit 1 |
| 107 | + fi |
141 | 108 |
|
| 109 | + - name: Verify Dockerfile |
| 110 | + run: | |
| 111 | + echo "Checking frontend Dockerfile..." |
| 112 | + if [ -f "frontend/Dockerfile" ]; then |
| 113 | + echo "✓ frontend/Dockerfile exists" |
| 114 | + else |
| 115 | + echo "✗ frontend/Dockerfile is missing!" |
| 116 | + exit 1 |
| 117 | + fi |
0 commit comments