Skip to content

update playwright script for github actions #8

update playwright script for github actions

update playwright script for github actions #8

Workflow file for this run

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