Skip to content

Commit b64cdb8

Browse files
feat(epic-8): complete AVD full automation build-out
Admin merging per user request.
2 parents ee13970 + 8b24c59 commit b64cdb8

55 files changed

Lines changed: 2285 additions & 149 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Validate Automation Contracts
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- 'config/**'
8+
- 'src/**'
9+
- 'tests/**'
10+
- '.github/workflows/validate-automation.yml'
11+
pull_request:
12+
branches: [main]
13+
paths:
14+
- 'config/**'
15+
- 'src/**'
16+
- 'tests/**'
17+
workflow_dispatch:
18+
19+
permissions:
20+
contents: read
21+
22+
jobs:
23+
contract-validation:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v4
28+
29+
- name: Setup Python
30+
uses: actions/setup-python@v5
31+
with:
32+
python-version: '3.12'
33+
34+
- name: Install validation dependencies
35+
run: pip install pyyaml jsonschema
36+
37+
- name: Validate canonical config
38+
run: python3 scripts/validate-config.py
39+
40+
pester-validation:
41+
runs-on: windows-latest
42+
steps:
43+
- name: Checkout
44+
uses: actions/checkout@v4
45+
46+
- name: Run contract tests
47+
shell: pwsh
48+
run: |
49+
Set-PSRepository PSGallery -InstallationPolicy Trusted
50+
if (-not (Get-Module -ListAvailable -Name Pester)) {
51+
Install-Module Pester -Force -Scope CurrentUser
52+
}
53+
Invoke-Pester -Path tests/Test-AVDDeployment.Tests.ps1 -CI

.github/workflows/validate-config.yml

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -38,23 +38,38 @@ jobs:
3838
- name: Install dependencies
3939
run: pip install pyyaml jsonschema
4040

41-
- name: Validate variables.example.yml against schema
42-
run: |
43-
python3 -c "
44-
import yaml, json, sys
45-
from jsonschema import validate, ValidationError
41+
- name: Validate canonical config files
42+
run: python3 scripts/validate-config.py
4643

47-
with open('config/variables.example.yml') as f:
48-
data = yaml.safe_load(f)
44+
- name: Validate negative schema fixtures fail
45+
run: |
46+
python3 - <<'PY'
47+
import json
48+
import pathlib
49+
import sys
50+
import yaml
51+
from jsonschema import ValidationError, validate
4952
50-
with open('config/schema/variables.schema.json') as f:
51-
schema = json.load(f)
53+
root = pathlib.Path('.').resolve()
54+
schema = json.loads((root / 'config' / 'schema' / 'variables.schema.json').read_text(encoding='utf-8'))
55+
invalid_dir = root / 'tests' / 'schemas'
56+
invalid_files = sorted(invalid_dir.glob('invalid-*.yml'))
57+
if not invalid_files:
58+
print('No negative fixtures found; skipping.')
59+
sys.exit(0)
5260
53-
try:
61+
failures = []
62+
for file in invalid_files:
63+
data = yaml.safe_load(file.read_text(encoding='utf-8'))
64+
try:
5465
validate(instance=data, schema=schema)
55-
print('✅ config/variables.example.yml passes schema validation')
56-
except ValidationError as e:
57-
print(f'❌ Schema validation failed: {e.message}')
58-
print(f' Path: {\" > \".join(str(p) for p in e.absolute_path)}')
59-
sys.exit(1)
60-
"
66+
failures.append(file.name)
67+
except ValidationError:
68+
print(f'Expected failure confirmed: {file.name}')
69+
70+
if failures:
71+
print('These files unexpectedly passed schema validation:')
72+
for name in failures:
73+
print(f' - {name}')
74+
sys.exit(1)
75+
PY

0 commit comments

Comments
 (0)