@@ -14,10 +14,10 @@ jobs:
1414 strategy :
1515 matrix :
1616 os : [ubuntu-latest, windows-latest]
17-
17+
1818 steps :
1919 - uses : actions/checkout@v4
20-
20+
2121 - name : Validate PowerShell scripts (Windows)
2222 if : matrix.os == 'windows-latest'
2323 run : |
2929 exit 1
3030 }
3131 }
32-
32+
3333 - name : Validate Shell scripts (Linux)
3434 if : matrix.os == 'ubuntu-latest'
3535 run : |
@@ -39,3 +39,107 @@ jobs:
3939 bash -n "$file" || exit 1
4040 done
4141
42+ validate-infrastructure :
43+ name : Validate Infrastructure
44+ runs-on : ubuntu-latest
45+ steps :
46+ - uses : actions/checkout@v4
47+
48+ - name : Install Bicep CLI
49+ uses : azure/setup-bicep@v1
50+
51+ - name : Validate Bicep templates
52+ run : |
53+ for file in infrastructure/bicep/*.bicep; do
54+ if [ -f "$file" ]; then
55+ echo "Validating $file"
56+ az bicep build --file "$file" --no-restore || exit 1
57+ fi
58+ done
59+
60+ - name : Setup Terraform
61+ uses : hashicorp/setup-terraform@v3
62+ with :
63+ terraform_version : ' 1.6.0'
64+
65+ - name : Validate Terraform
66+ working-directory : infrastructure/terraform
67+ run : |
68+ terraform fmt -check -recursive
69+ terraform init -backend=false
70+ terraform validate
71+
72+ validate-bootstrap :
73+ name : Validate Bootstrap Scripts
74+ runs-on : ubuntu-latest
75+ steps :
76+ - uses : actions/checkout@v4
77+
78+ - name : Install PSScriptAnalyzer
79+ shell : pwsh
80+ run : Install-Module -Name PSScriptAnalyzer -Force -Scope CurrentUser
81+
82+ - name : Lint Bootstrap PowerShell scripts
83+ shell : pwsh
84+ run : |
85+ $scripts = Get-ChildItem -Path "bootstrap/scripts" -Filter "*.ps1" -ErrorAction SilentlyContinue
86+ foreach ($script in $scripts) {
87+ Write-Host "Linting $($script.FullName)"
88+ $results = Invoke-ScriptAnalyzer -Path $script.FullName -Severity Error,Warning
89+ if ($results) {
90+ $results | Format-Table -AutoSize
91+ Write-Warning "PSScriptAnalyzer found issues in $($script.Name)"
92+ }
93+ }
94+
95+ - name : Validate Bootstrap PowerShell syntax
96+ shell : pwsh
97+ run : |
98+ $scripts = Get-ChildItem -Path "bootstrap/scripts" -Filter "*.ps1" -ErrorAction SilentlyContinue
99+ foreach ($script in $scripts) {
100+ Write-Host "Validating syntax: $($script.FullName)"
101+ $null = [System.Management.Automation.PSParser]::Tokenize(
102+ (Get-Content $script.FullName -Raw),
103+ [ref]$null
104+ )
105+ if (-not $?) {
106+ Write-Error "Syntax error in $($script.FullName)"
107+ exit 1
108+ }
109+ Write-Host "✓ $($script.Name) syntax is valid"
110+ }
111+
112+ validate-packages :
113+ name : Validate Packages
114+ runs-on : ubuntu-latest
115+ steps :
116+ - uses : actions/checkout@v4
117+
118+ # TypeScript package validation
119+ - name : Setup Node.js
120+ uses : actions/setup-node@v4
121+ with :
122+ node-version : ' 20'
123+ cache : ' npm'
124+ cache-dependency-path : packages/@codeflow/utils/package.json
125+
126+ - name : Validate TypeScript package
127+ working-directory : packages/@codeflow/utils
128+ run : |
129+ npm ci
130+ npm run lint || true
131+ npm run build
132+ npm test
133+
134+ # Python package validation
135+ - name : Setup Python
136+ uses : actions/setup-python@v5
137+ with :
138+ python-version : ' 3.10'
139+
140+ - name : Validate Python package
141+ working-directory : packages/codeflow-utils-python
142+ run : |
143+ pip install -e ".[dev]" || pip install pytest pytest-cov black ruff mypy
144+ pip install -e .
145+ pytest tests/ -v || true
0 commit comments