Merge pull request #2 from Qualcomm-Capstone/refactor/deploy-restructure #52
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI - Validate Deploy Configs | |
| on: | |
| push: | |
| branches: [main, develop] | |
| pull_request: | |
| branches: [main, develop] | |
| concurrency: | |
| group: ci-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| validate-yaml: | |
| name: YAML Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install yamllint | |
| run: pip install yamllint | |
| - name: Lint YAML files | |
| run: | | |
| yamllint -d relaxed compose/ | |
| yamllint -d relaxed config/ | |
| validate-compose: | |
| name: Docker Compose Validation | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set dummy environment variables | |
| run: | | |
| # compose 파일에서 사용하는 환경변수에 더미 값 설정 | |
| cat env/hosts.env.example | sed 's/=.*/=dummy/' > .env | |
| echo "ARTIFACT_REGISTRY=dummy.pkg.dev/project/repo" >> .env | |
| - name: Validate compose files | |
| run: | | |
| for f in compose/docker-compose.*.yml; do | |
| echo "Validating $f..." | |
| docker compose -f "$f" config --quiet 2>&1 || echo "WARNING: $f has issues (may need env vars)" | |
| done | |
| validate-scripts: | |
| name: ShellCheck | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Run ShellCheck | |
| run: | | |
| shellcheck scripts/*.sh || true | |
| validate-templates: | |
| name: Template Variables Check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Check template variables are defined | |
| run: | | |
| # hosts.env.example에 정의된 변수 추출 | |
| defined_vars=$(grep -oP '^\w+' env/hosts.env.example | sort) | |
| # 템플릿 파일에서 사용하는 변수 추출 | |
| template_vars=$(grep -orhP '\$\{(\w+)\}' config/ | grep -oP '\w+' | sort -u) | |
| echo "=== hosts.env.example에 정의된 변수 ===" | |
| echo "$defined_vars" | |
| echo "" | |
| echo "=== 템플릿에서 사용하는 변수 ===" | |
| echo "$template_vars" | |
| echo "" | |
| # 누락된 변수 확인 | |
| missing=$(comm -23 <(echo "$template_vars") <(echo "$defined_vars")) | |
| if [ -n "$missing" ]; then | |
| echo "⚠️ 템플릿에서 사용하지만 hosts.env.example에 없는 변수:" | |
| echo "$missing" | |
| else | |
| echo "✅ 모든 템플릿 변수가 hosts.env.example에 정의되어 있습니다." | |
| fi |