-
Notifications
You must be signed in to change notification settings - Fork 0
182 lines (157 loc) · 6.32 KB
/
build.yml
File metadata and controls
182 lines (157 loc) · 6.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
name: Build and Validate
on:
push:
branches: [ main, master, develop ]
pull_request:
branches: [ main, master ]
workflow_dispatch: # Allow manual triggers
jobs:
build:
runs-on: windows-latest # Required for .NET Framework
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2
with:
msbuild-architecture: x64
- name: Setup NuGet
uses: NuGet/setup-nuget@v2
- name: Restore NuGet packages
run: nuget restore source/MyModelViewPresenter/MyModelViewPresenter.sln
- name: Build Solution
run: msbuild source/MyModelViewPresenter/MyModelViewPresenter.sln /p:Configuration=Release /p:Platform="Any CPU"
- name: Upload Build Artifacts
uses: actions/upload-artifact@v4
if: success()
with:
name: build-artifacts
path: |
source/MyModelViewPresenter/Web/bin/
source/MyModelViewPresenter/Web/App_Data/products.db
retention-days: 30
- name: List Build Output
run: |
echo "=== Core Project Output ==="
if (Test-Path "source\MyModelViewPresenter\Core\bin\Release\") {
dir source\MyModelViewPresenter\Core\bin\Release\
} else {
echo "No Release build found for Core"
}
echo "=== Infrastructure Project Output ==="
if (Test-Path "source\MyModelViewPresenter\Infrastructure\bin\Release\") {
dir source\MyModelViewPresenter\Infrastructure\bin\Release\
} else {
echo "No Release build found for Infrastructure"
}
echo "=== Presentation Project Output ==="
if (Test-Path "source\MyModelViewPresenter\Presentation\bin\Release\") {
dir source\MyModelViewPresenter\Presentation\bin\Release\
} else {
echo "No Release build found for Presentation"
}
echo "=== Web Project Output ==="
if (Test-Path "source\MyModelViewPresenter\Web\bin\") {
dir source\MyModelViewPresenter\Web\bin\
} else {
echo "No bin folder found for Web"
}
shell: pwsh
validate:
runs-on: windows-latest
needs: build
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Validate Project Structure
run: |
echo "Validating project structure..."
# Check if all required projects exist
$projects = @(
"source/MyModelViewPresenter/Core/Core.csproj",
"source/MyModelViewPresenter/Infrastructure/Infrastructure.csproj",
"source/MyModelViewPresenter/Presentation/Presentation.csproj",
"source/MyModelViewPresenter/Web/Web.csproj"
)
foreach ($project in $projects) {
if (Test-Path $project) {
Write-Host "✓ Found $project" -ForegroundColor Green
} else {
Write-Host "✗ Missing $project" -ForegroundColor Red
exit 1
}
}
# Check for solution file
if (Test-Path "source/MyModelViewPresenter/MyModelViewPresenter.sln") {
Write-Host "✓ Found solution file" -ForegroundColor Green
} else {
Write-Host "✗ Missing solution file" -ForegroundColor Red
exit 1
}
# Check for key Web files
$keyFiles = @(
"source/MyModelViewPresenter/Web/ProductManagement.aspx",
"source/MyModelViewPresenter/Web/Site.Master",
"source/MyModelViewPresenter/Web/Global.asax",
"source/MyModelViewPresenter/Web/Web.config"
)
foreach ($file in $keyFiles) {
if (Test-Path $file) {
Write-Host "✓ Found $file" -ForegroundColor Green
} else {
Write-Host "✗ Missing $file" -ForegroundColor Red
Write-Host " Warning: This file should exist" -ForegroundColor Yellow
}
}
# Check Core project structure
$coreDirs = @(
"source/MyModelViewPresenter/Core/Models",
"source/MyModelViewPresenter/Core/Repositories",
"source/MyModelViewPresenter/Core/Services"
)
foreach ($dir in $coreDirs) {
if (Test-Path $dir) {
Write-Host "✓ Found directory $dir" -ForegroundColor Green
} else {
Write-Host "✗ Missing directory $dir" -ForegroundColor Red
}
}
# Check Infrastructure project structure
$infrastructureDirs = @(
"source/MyModelViewPresenter/Infrastructure/Repositories"
)
foreach ($dir in $infrastructureDirs) {
if (Test-Path $dir) {
Write-Host "✓ Found directory $dir" -ForegroundColor Green
} else {
Write-Host "✗ Missing directory $dir" -ForegroundColor Red
}
}
# Check Presentation project structure
$presentationDirs = @(
"source/MyModelViewPresenter/Presentation/Infrastructure",
"source/MyModelViewPresenter/Presentation/Presenters",
"source/MyModelViewPresenter/Presentation/Views"
)
foreach ($dir in $presentationDirs) {
if (Test-Path $dir) {
Write-Host "✓ Found directory $dir" -ForegroundColor Green
} else {
Write-Host "✗ Missing directory $dir" -ForegroundColor Red
}
}
# Validate clean architecture - Infrastructure should contain ProductRepository
if (Test-Path "source/MyModelViewPresenter/Infrastructure/Repositories/ProductRepository.cs") {
Write-Host "✓ ProductRepository correctly placed in Infrastructure layer" -ForegroundColor Green
} else {
Write-Host "✗ ProductRepository missing from Infrastructure layer" -ForegroundColor Red
exit 1
}
# Ensure Presentation no longer has repository implementation
if (Test-Path "source/MyModelViewPresenter/Presentation/Repositories/ProductRepository.cs") {
Write-Host "✗ ProductRepository found in Presentation layer - should be in Infrastructure" -ForegroundColor Red
exit 1
} else {
Write-Host "✓ Presentation layer correctly contains no repository implementations" -ForegroundColor Green
}
shell: pwsh