Skip to content

Update dotnet-desktop.yml #19

Update dotnet-desktop.yml

Update dotnet-desktop.yml #19

name: .NET Core Desktop
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
strategy:
matrix:
configuration: [Debug, Release]
runs-on: windows-latest
env:
Solution_Name: RAYTRACER_UNILIGHT.sln
Project_Name: RAYTRACER_UNILIGHT.csproj
steps:
# Checkout main repository
- name: Checkout RAYTRACER_UNILIGHT
uses: actions/checkout@v4
with:
fetch-depth: 0
# Checkout COMMON_GRAPHICS repository into a subfolder
- name: Checkout COMMON_GRAPHICS
uses: actions/checkout@v4
with:
repository: danmunteanu/COMMON_GRAPHICS
path: COMMON_GRAPHICS
fetch-depth: 0
# Install .NET SDK
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
# Setup MSBuild
- name: Setup MSBuild.exe
uses: microsoft/setup-msbuild@v2
# Restore and build COMMON_GRAPHICS
- name: Restore COMMON_GRAPHICS
shell: pwsh
run: msbuild "$PWD/COMMON_GRAPHICS/COMMON_GRAPHICS.sln" /t:Restore /p:Configuration=${{ matrix.configuration }}
- name: Build COMMON_GRAPHICS
shell: pwsh
run: msbuild "$PWD/COMMON_GRAPHICS/COMMON_GRAPHICS.sln" /p:Configuration=${{ matrix.configuration }}
# Copy the compiled DLL into the main project folder
- name: Copy COMMON_GRAPHICS DLL
shell: pwsh
run: |
$dllSource = "$PWD/COMMON_GRAPHICS/bin/${{ matrix.configuration }}/net8.0/COMMON_GRAPHICS.dll"
$dllDestFolder = "$PWD/RAYTRACER_UNILIGHT/libs"
if (!(Test-Path $dllDestFolder)) { New-Item -ItemType Directory -Path $dllDestFolder | Out-Null }
Copy-Item $dllSource $dllDestFolder
# Restore main project packages
- name: Restore RAYTRACER_UNILIGHT
shell: pwsh
run: msbuild "$PWD/$env:Solution_Name" /t:Restore /p:Configuration=${{ matrix.configuration }}
# Build main project
- name: Build RAYTRACER_UNILIGHT
shell: pwsh
run: msbuild "$PWD/$env:Solution_Name" /p:Configuration=${{ matrix.configuration }}
# Run tests (optional)
- name: Run tests
shell: pwsh
run: dotnet test "$PWD/$env:Solution_Name" --configuration ${{ matrix.configuration }}
continue-on-error: true
# Publish main project
- name: Publish RAYTRACER_UNILIGHT
shell: pwsh
run: dotnet publish "$PWD/$env:Project_Name" -c ${{ matrix.configuration }} -o "$PWD/publish"
# Upload build artifacts
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: RAYTRACER_UNILIGHT_${{ matrix.configuration }}
path: publish/**