Skip to content

Commit

Permalink
Merge branch 'main' into custom_renderer_multi
Browse files Browse the repository at this point in the history
  • Loading branch information
jfversluis committed Feb 2, 2024
2 parents a37ef89 + 5390ebe commit a6033fa
Show file tree
Hide file tree
Showing 4,656 changed files with 41,926 additions and 8,745 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
92 changes: 92 additions & 0 deletions .github/workflows/build-all.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: Build All C# Projects in Repo

on:
workflow_dispatch:

jobs:
build:
strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-13]

runs-on: ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v4

# Remove when .NET 8 is default on hosted runners
- name: Install .NET 8
uses: actions/setup-dotnet@v3.2.0
with:
dotnet-version: 8.0

- name: Install .NET MAUI Workload
run: dotnet workload install maui
# if: runner.os == 'macOS' # reenable when .NET 8 is default on hosted runners

- name: Select Xcode Version
run: sudo xcode-select -s /Applications/Xcode_15.0.1.app
if: runner.os == 'macOS' # Remove when Xcode 15+ is default on the hosted runners

- name: Find and build all C# projects
run: |
$failedProjectCount=0
$skippedProjectCount=0
$excluded_projects_file="./eng/excluded_projects_" + "${{ runner.os }}".ToLower() + ".txt"
$excluded_projects=@()
$jobSummaryFile=$env:GITHUB_STEP_SUMMARY
if (Test-Path $excluded_projects_file) {
$excluded_projects = Get-Content -Path $excluded_projects_file | Where-Object { $_ -notmatch "^\s*#" -and $_ -match "\S" }
}
Write-Output "# .NET MAUI Sample Apps Build Status (${{ runner.os }})" | Out-File -FilePath $jobSummaryFile -Append
Write-Output "| Project | Build Status |" | Out-File -FilePath $jobSummaryFile -Append
Write-Output "|---|---|" | Out-File -FilePath $jobSummaryFile -Append
Get-ChildItem -Path . -Filter *.csproj -File -Recurse | ForEach-Object {
$csproj = $_.FullName
$relativePath = (Resolve-Path -Path $csproj -Relative).Replace("\", "/")
# Check if the project is in the exclusion list
if ($excluded_projects -contains $relativePath) {
Write-Output "::notice:: Skipping build for excluded project: $relativePath"
Write-Output "| $csproj | Skipped |" | Out-File -FilePath $jobSummaryFile -Append
$skippedProjectCount++
}
else {
Write-Output "::group:: Building $csproj"
dotnet build $csproj
if ($LASTEXITCODE -gt 0) {
Write-Output "::error:: Build failed for $csproj"
Write-Output "| $relativePath | :x: |" | Out-File -FilePath $jobSummaryFile -Append
$failedProjectCount++
}
else {
Write-Output "Build succeeded for $csproj"
Write-Output "| $relativePath | :white_check_mark: |" | Out-File -FilePath $jobSummaryFile -Append
}
$proj_dir = [System.IO.Path]::GetDirectoryName($csproj)
Write-Output "Cleaning up bin & obj in $proj_dir"
Get-ChildItem -Path $proj_dir -Directory -Recurse -Include bin,obj | Remove-Item -Recurse -Force
Write-Output "::endgroup::"
}
}
if ($failedProjectCount -gt 0) {
Write-Output "" | Out-File -FilePath $jobSummaryFile -Append
Write-Output "# Failed builds: $failedProjectCount" | Out-File -FilePath $jobSummaryFile -Append
Write-Output "# Skipped builds: $skippedProjectCount" | Out-File -FilePath $jobSummaryFile -Append
exit $failedProjectCount
}
shell: powershell
134 changes: 134 additions & 0 deletions .github/workflows/build-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
name: Build Changed C# Projects for PR

on:
pull_request:
paths-ignore:
- '**.md'

jobs:
build:
strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-13]

runs-on: ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 2

# Remove when .NET 8 is default on hosted runners
- name: Install .NET 8
uses: actions/setup-dotnet@v3.2.0
with:
dotnet-version: 8.0

- name: Install .NET MAUI Workload
run: dotnet workload install maui
# if: runner.os == 'macOS' # reenable when .NET 8 is default on hosted runners

- name: Select Xcode Version
run: sudo xcode-select -s /Applications/Xcode_15.2.app
if: runner.os == 'macOS' # Remove when Xcode 15+ is default on the hosted runners

- name: Find and build changed projects
run: |
$failedProjectCount=0
# Get the list of changed files
$changedFiles = git diff --name-only -r --diff-filter=d HEAD^1 HEAD
$excluded_projects_file="./eng/excluded_projects_" + "${{ runner.os }}".ToLower() + ".txt"
$excluded_projects=@()
$processedProjects=@()
$jobSummaryFile=$env:GITHUB_STEP_SUMMARY
if (Test-Path $excluded_projects_file) {
$excluded_projects = Get-Content -Path $excluded_projects_file | Where-Object { $_ -notmatch "^\s*#" -and $_ -match "\S" }
}
Write-Output "# .NET MAUI Sample Apps Build Status (${{ runner.os }})" | Out-File -FilePath $jobSummaryFile -Append
Write-Output "Only projects that have changes are built." | Out-File -FilePath $jobSummaryFile -Append
Write-Output "| Project | Build Status |" | Out-File -FilePath $jobSummaryFile -Append
Write-Output "|---|---|" | Out-File -FilePath $jobSummaryFile -Append
# Determine the corresponding project for each changed file
foreach ($file in $changedFiles) {
$projectToBuild=""
# Check if the file is a .csproj file
if ($file -like '*.csproj') {
$projectToBuild = $file
} else {
$currentFolder = (Get-Item -LiteralPath (Resolve-Path -Path "$file")).Directory
while ($currentFolder -ne $null -and '' -ne $currentFolder) {
$csprojFiles = Get-ChildItem -Path $currentFolder -Filter '*.csproj' -File
if ($csprojFiles.Count -gt 0) {
break
}
$currentFolder = Split-Path -Parent $currentFolder
}
if ($csprojFiles.Count -gt 0) {
$projectToBuild = $csprojFiles[0].FullName
}
}
if (-not [string]::IsNullOrEmpty($projectToBuild)) {
$projectToBuild = (Resolve-Path -Path $projectToBuild -Relative).Replace("\", "/")
# Only proceed when this project has not been built yet
if (-not ($processedProjects -contains $projectToBuild)) {
Write-Output "::notice:: $projectToBuild is not in processed builds yet"
$processedProjects += $projectToBuild
Write-Output "::notice:: Added $projectToBuild to processed builds"
if ($excluded_projects -contains $projectToBuild) {
Write-Output "::notice:: Skipping build for excluded project: $projectToBuild"
Write-Output "| $projectToBuild | Skipped |" | Out-File -FilePath $jobSummaryFile -Append
$skippedProjectCount++
}
else {
Write-Output "::group:: Building $projectToBuild"
dotnet build $projectToBuild
if ($LASTEXITCODE -gt 0) {
Write-Output "::error:: Build failed for $projectToBuild"
Write-Output "| $projectToBuild | :x: |" | Out-File -FilePath $jobSummaryFile -Append
$failedProjectCount++
}
else {
Write-Output "Build succeeded for $projectToBuild"
Write-Output "| $projectToBuild | :white_check_mark: |" | Out-File -FilePath $jobSummaryFile -Append
}
$proj_dir = [System.IO.Path]::GetDirectoryName($projectToBuild)
Write-Output "Cleaning up bin & obj in $proj_dir"
Get-ChildItem -Path $proj_dir -Directory -Recurse -Include bin,obj | Remove-Item -Recurse -Force
Write-Output "::endgroup::"
}
}
}
else {
Write-Output "::warning:: Found no csproj for file $file"
}
}
if ($failedProjectCount -gt 0) {
Write-Output "" | Out-File -FilePath $jobSummaryFile -Append
Write-Output "# Failed builds: $failedProjectCount" | Out-File -FilePath $jobSummaryFile -Append
Write-Output "# Skipped builds: $skippedProjectCount" | Out-File -FilePath $jobSummaryFile -Append
exit $failedProjectCount
}
shell: powershell
55 changes: 0 additions & 55 deletions 6.0/Animations/Animations/Animations.csproj

This file was deleted.

22 changes: 0 additions & 22 deletions 6.0/Animations/README.md

This file was deleted.

49 changes: 0 additions & 49 deletions 6.0/Apps/Calculator/src/Calculator/Calculator.csproj

This file was deleted.

Loading

0 comments on commit a6033fa

Please sign in to comment.