|
11 | 11 | - develop |
12 | 12 |
|
13 | 13 | jobs: |
14 | | - architecture-checks: |
15 | | - name: Validate Architecture Rules |
16 | | - runs-on: ubuntu-latest |
17 | | - timeout-minutes: 30 |
18 | | - |
19 | | - steps: |
20 | | - - name: Checkout code |
21 | | - uses: actions/checkout@v4 |
22 | | - |
23 | | - - name: Setup Node.js |
24 | | - uses: actions/setup-node@v3 |
25 | | - with: |
26 | | - node-version: '18' |
27 | | - cache: 'npm' |
28 | | - |
29 | | - - name: Install dependencies |
30 | | - run: npm ci --legacy-peer-deps |
31 | | - continue-on-error: true |
32 | | - |
33 | | - - name: Run TypeScript compilation |
34 | | - run: npm run build |
35 | | - continue-on-error: false |
36 | | - |
37 | | - # - name: Run ESLint with boundary rules |
38 | | - # run: npm run lint -- --format json --output-file eslint-report.json || echo "Linting failed, but continuing..." |
39 | | - # continue-on-error: true |
40 | | - |
41 | | - - name: Check circular dependencies with Madge |
42 | | - run: | |
43 | | - npx madge --circular --extensions ts src/ |
44 | | - echo "Circular dependency check completed" |
45 | | - continue-on-error: true |
46 | | - |
47 | | - - name: Run dependency analysis |
48 | | - run: | |
49 | | - node tools/analyze-simple.js 2>&1 | tee dependency-analysis.log |
50 | | - continue-on-error: true |
51 | | - |
52 | | - - name: Validate against architecture rules |
53 | | - run: | |
54 | | - echo "=== Architecture Validation Results ===" |
55 | | - echo "" |
56 | | - echo "✓ TypeScript compilation: PASSED" |
57 | | - echo "→ Circular dependencies: Check Madge output above" |
58 | | - echo "→ Module boundaries: Check ESLint boundary rules above" |
59 | | - echo "" |
60 | | - echo "For detailed reports, see:" |
61 | | - echo " - eslint-report.json" |
62 | | - echo " - docs/DEPENDENCY_AUDIT.md" |
63 | | - continue-on-error: false |
64 | | - |
65 | | - - name: Generate architecture report |
66 | | - if: always() |
67 | | - run: | |
68 | | - cat > architecture-report.md << 'EOF' |
69 | | - # Architecture Validation Report |
70 | | - |
71 | | - Generated: $(date -u +'%Y-%m-%dT%H:%M:%SZ') |
72 | | - Commit: ${{ github.sha }} |
73 | | - Branch: ${{ github.ref }} |
74 | | - |
75 | | - ## Summary |
76 | | - |
77 | | - This workflow validates the codebase against the ADR (Architecture Decision Record) rules: |
78 | | - - ADR-001: Domain-Driven Design (11-level hierarchy) |
79 | | - - ADR-002: Infrastructure Isolation |
80 | | - - ADR-003: Dependency Hierarchy |
81 | | - - ADR-004: Shared Layer Guidelines |
82 | | - |
83 | | - ## Checks Performed |
84 | | - |
85 | | - 1. **TypeScript Compilation** ✓ |
86 | | - - All TypeScript files compile without errors |
87 | | - - Type safety validated |
88 | | - |
89 | | - 2. **ESLint Boundary Rules** |
90 | | - - Module dependencies validated |
91 | | - - Shared layer usage checked |
92 | | - - Import restrictions enforced |
93 | | - |
94 | | - 3. **Circular Dependency Detection** |
95 | | - - Using Madge library |
96 | | - - All module cycles identified |
97 | | - - Must be zero in production |
98 | | - |
99 | | - 4. **Dependency Analysis** |
100 | | - - Full module graph analyzed |
101 | | - - Violations against ADR rules identified |
102 | | - - Reports generated in docs/DEPENDENCY_AUDIT.md |
103 | | - |
104 | | - ## Next Steps |
105 | | - |
106 | | - If checks fail: |
107 | | - 1. Review the specific ESLint errors above |
108 | | - 2. Check docs/CIRCULAR_DEPENDENCIES_RESOLUTION.md for guidance |
109 | | - 3. Consult docs/DEPENDENCY_HIERARCHY.md for allowed dependencies |
110 | | - 4. Contact architecture team if unclear |
111 | | - |
112 | | - ## References |
113 | | - |
114 | | - - [ADR-003: Dependency Hierarchy](../../docs/adr/ADR-003-dependency-hierarchy.md) |
115 | | - - [DEPENDENCY_AUDIT](../../docs/DEPENDENCY_AUDIT.md) |
116 | | - - [CIRCULAR_DEPENDENCIES_RESOLUTION](../../docs/CIRCULAR_DEPENDENCIES_RESOLUTION.md) |
117 | | - EOF |
118 | | - cat architecture-report.md |
119 | | -
|
120 | | - - name: Upload artifact reports |
121 | | - if: always() |
122 | | - uses: actions/upload-artifact@v3 |
123 | | - with: |
124 | | - name: architecture-reports |
125 | | - path: | |
126 | | - eslint-report.json |
127 | | - dependency-analysis.log |
128 | | - architecture-report.md |
129 | | - retention-days: 30 |
130 | | - |
131 | | - - name: Comment on PR with results |
132 | | - if: github.event_name == 'pull_request' && always() |
133 | | - uses: actions/github-script@v6 |
134 | | - with: |
135 | | - script: | |
136 | | - const fs = require('fs'); |
137 | | - const report = fs.readFileSync('architecture-report.md', 'utf8'); |
138 | | - |
139 | | - github.rest.issues.createComment({ |
140 | | - issue_number: context.issue.number, |
141 | | - owner: context.repo.owner, |
142 | | - repo: context.repo.repo, |
143 | | - body: `## 🏛️ Architecture Validation\n\n${report}` |
144 | | - }); |
145 | | -
|
146 | 14 | # lint: |
147 | 15 | # name: Lint Code |
148 | 16 | # runs-on: ubuntu-latest |
|
0 commit comments