diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 10446cc..282727c 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -17,7 +17,7 @@ "rollForward": false }, "fallout.globaltool": { - "version": "10.3.49", + "version": "10.4.0", "commands": [ "fallout" ], diff --git a/.fallout/build.schema.json b/.fallout/build.schema.json index b092ad0..4f19016 100644 --- a/.fallout/build.schema.json +++ b/.fallout/build.schema.json @@ -102,6 +102,13 @@ "Verbosity": { "description": "Logging verbosity during build execution. Default is 'Normal'", "$ref": "#/definitions/Verbosity" + }, + "BuildProjectFile": { + "type": [ + "null", + "string" + ], + "description": "Path to the build project (.csproj) relative to the repository root. Defaults to 'build/_build.csproj' when unset. Read by the Fallout global tool's in-tool runner." } } } @@ -109,13 +116,17 @@ "allOf": [ { "properties": { + "BuildArchitecture": { + "type": "string", + "description": "Build architecture" + }, "Configuration": { "type": "string", - "description": "Configuration to build - Default is 'Debug' (local) or 'Release' (server)", "enum": [ "Debug", "Release" - ] + ], + "description": "Configuration to build - Default is 'Debug' (local) or 'Release' (server)" }, "CoverallsJobID": { "type": "string", diff --git a/.fallout/parameters.json b/.fallout/parameters.json index 13d9948..ebd5de5 100644 --- a/.fallout/parameters.json +++ b/.fallout/parameters.json @@ -1,4 +1,5 @@ { "$schema": "build.schema.json", - "Solution": "DemoEngine.slnx" + "Solution": "DemoEngine.slnx", + "BuildProjectFile": "build/Build.csproj" } diff --git a/.github/workflows/CI-arm.yml b/.github/workflows/CI-arm.yml new file mode 100644 index 0000000..ce21b80 --- /dev/null +++ b/.github/workflows/CI-arm.yml @@ -0,0 +1,70 @@ +# ------------------------------------------------------------------------------ +# +# +# This code was generated. +# +# - To turn off auto-generation set: +# +# [GitHubActions (AutoGenerate = false)] +# +# - To trigger manual generation invoke: +# +# fallout --generate-configuration GitHubActions_CI-arm --host GitHubActions +# +# +# ------------------------------------------------------------------------------ + +name: CI-arm + +on: [push] + +env: + DEMO_ENGINE_BUILD_ARCH: arm64 + +jobs: + windows-latest: + name: windows-latest + runs-on: [windows-11-arm] + steps: + - uses: actions/checkout@v7 + with: + lfs: true + fetch-depth: 0 + - name: 'Cache: .fallout/temp, ~/.nuget/packages' + uses: actions/cache@v6 + with: + path: | + .fallout/temp + ~/.nuget/packages + key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj', '**/Directory.Packages.props') }} + - name: 'Setup: .NET SDK' + uses: actions/setup-dotnet@v6 + with: + global-json-file: global.json + - name: 'Restore: dotnet tools' + run: dotnet tool restore + - name: 'Run: Clean, Compile, Test, Publish' + run: dotnet fallout Clean Compile Test Publish + env: + CoverallsToken: ${{ secrets.COVERALLS_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: 'Publish: coverage.zip' + uses: actions/upload-artifact@v7 + with: + name: coverage.zip + path: artifacts/coverage.zip + - name: 'Publish: Demo.Engine.zip' + uses: actions/upload-artifact@v7 + with: + name: Demo.Engine.zip + path: artifacts/Demo.Engine.zip + - name: 'Publish: Demo.Engine.win-x64.zip' + uses: actions/upload-artifact@v7 + with: + name: Demo.Engine.win-x64.zip + path: artifacts/Demo.Engine.win-x64.zip + - name: 'Publish: Demo.Engine.win-arm64.zip' + uses: actions/upload-artifact@v7 + with: + name: Demo.Engine.win-arm64.zip + path: artifacts/Demo.Engine.win-arm64.zip diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index b38105d..67edf27 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -18,44 +18,53 @@ name: CI on: [push] +env: + DEMO_ENGINE_BUILD_ARCH: x64 + jobs: windows-latest: name: windows-latest runs-on: windows-latest steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@v7 with: lfs: true fetch-depth: 0 - name: 'Cache: .fallout/temp, ~/.nuget/packages' - uses: actions/cache@v4 + uses: actions/cache@v6 with: path: | .fallout/temp ~/.nuget/packages key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj', '**/Directory.Packages.props') }} + - name: 'Setup: .NET SDK' + uses: actions/setup-dotnet@v6 + with: + global-json-file: global.json + - name: 'Restore: dotnet tools' + run: dotnet tool restore - name: 'Run: Clean, Compile, Test, Publish' - run: ./build.cmd Clean Compile Test Publish + run: dotnet fallout Clean Compile Test Publish env: CoverallsToken: ${{ secrets.COVERALLS_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: 'Publish: coverage.zip' - uses: actions/upload-artifact@v5 + uses: actions/upload-artifact@v7 with: name: coverage.zip path: artifacts/coverage.zip - name: 'Publish: Demo.Engine.zip' - uses: actions/upload-artifact@v5 + uses: actions/upload-artifact@v7 with: name: Demo.Engine.zip path: artifacts/Demo.Engine.zip - name: 'Publish: Demo.Engine.win-x64.zip' - uses: actions/upload-artifact@v5 + uses: actions/upload-artifact@v7 with: name: Demo.Engine.win-x64.zip path: artifacts/Demo.Engine.win-x64.zip - name: 'Publish: Demo.Engine.win-arm64.zip' - uses: actions/upload-artifact@v5 + uses: actions/upload-artifact@v7 with: name: Demo.Engine.win-arm64.zip path: artifacts/Demo.Engine.win-arm64.zip diff --git a/Directory.Packages.props b/Directory.Packages.props index 447dfa1..6f88490 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -7,32 +7,32 @@ - + - + - - + + - - + + - - + + - + - + @@ -44,11 +44,10 @@ - + - - + - + \ No newline at end of file diff --git a/build.ps1 b/build.ps1 index bf4ff26..9a46133 100644 --- a/build.ps1 +++ b/build.ps1 @@ -13,10 +13,9 @@ $PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent # CONFIGURATION ########################################################################### -$BuildProjectFile = "$PSScriptRoot\build\Build.csproj" -$TempDirectory = "$PSScriptRoot\\.fallout\temp" +$TempDirectory = Join-Path $PSScriptRoot '/.fallout/temp' -$DotNetGlobalFile = "$PSScriptRoot\\global.json" +$DotNetGlobalFile = Join-Path $PSScriptRoot '/global.json' $DotNetInstallUrl = "https://dot.net/v1/dotnet-install.ps1" $DotNetChannel = "STS" @@ -32,19 +31,17 @@ function ExecSafe([scriptblock] $cmd) { if ($LASTEXITCODE) { exit $LASTEXITCODE } } -# If dotnet CLI is installed globally and it matches requested version, use for execution +# If dotnet CLI is installed globally, use it; otherwise provision a local copy under .fallout\temp. if ($null -ne (Get-Command "dotnet" -ErrorAction SilentlyContinue) -and ` $(dotnet --version) -and $LASTEXITCODE -eq 0) { $env:DOTNET_EXE = (Get-Command "dotnet").Path } else { - # Download install script - $DotNetInstallFile = "$TempDirectory\dotnet-install.ps1" + $DotNetInstallFile = Join-Path $TempDirectory 'dotnet-install.ps1' New-Item -ItemType Directory -Path $TempDirectory -Force | Out-Null [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 (New-Object System.Net.WebClient).DownloadFile($DotNetInstallUrl, $DotNetInstallFile) - # If global.json exists, load expected version if (Test-Path $DotNetGlobalFile) { $DotNetGlobal = $(Get-Content $DotNetGlobalFile | Out-String | ConvertFrom-Json) if ($DotNetGlobal.PSObject.Properties["sdk"] -and $DotNetGlobal.sdk.PSObject.Properties["version"]) { @@ -52,23 +49,17 @@ else { } } - # Install by channel or version - $DotNetDirectory = "$TempDirectory\dotnet-win" + $DotNetDirectory = Join-Path $TempDirectory 'dotnet-win' if (!(Test-Path variable:DotNetVersion)) { ExecSafe { & powershell $DotNetInstallFile -InstallDir $DotNetDirectory -Channel $DotNetChannel -NoPath } } else { ExecSafe { & powershell $DotNetInstallFile -InstallDir $DotNetDirectory -Version $DotNetVersion -NoPath } } - $env:DOTNET_EXE = "$DotNetDirectory\dotnet.exe" + $env:DOTNET_EXE = Join-Path $DotNetDirectory 'dotnet.exe' $env:PATH = "$DotNetDirectory;$env:PATH" } Write-Output "Microsoft (R) .NET SDK version $(& $env:DOTNET_EXE --version)" -if (Test-Path env:NUKE_ENTERPRISE_TOKEN) { - & $env:DOTNET_EXE nuget remove source "nuke-enterprise" > $null - & $env:DOTNET_EXE nuget add source "https://f.feedz.io/nuke/enterprise/nuget" --name "nuke-enterprise" --username "PAT" --password $env:NUKE_ENTERPRISE_TOKEN > $null -} - -ExecSafe { & $env:DOTNET_EXE build $BuildProjectFile /nodeReuse:false /p:UseSharedCompilation=false -nologo -clp:NoSummary --verbosity quiet } -ExecSafe { & $env:DOTNET_EXE run --project $BuildProjectFile --no-build -- $BuildArguments } +ExecSafe { & $env:DOTNET_EXE tool restore } +ExecSafe { & $env:DOTNET_EXE fallout $BuildArguments } diff --git a/build.sh b/build.sh index 28a50f4..02b2257 100755 --- a/build.sh +++ b/build.sh @@ -9,7 +9,6 @@ SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd) # CONFIGURATION ########################################################################### -BUILD_PROJECT_FILE="$SCRIPT_DIR/build/Build.csproj" TEMP_DIRECTORY="$SCRIPT_DIR//.fallout/temp" DOTNET_GLOBAL_FILE="$SCRIPT_DIR//global.json" @@ -27,17 +26,15 @@ function FirstJsonValue { perl -nle 'print $1 if m{"'"$1"'": "([^"]+)",?}' <<< "${@:2}" } -# If dotnet CLI is installed globally and it matches requested version, use for execution +# If dotnet CLI is installed globally, use it; otherwise provision a local copy under .fallout/temp. if [ -x "$(command -v dotnet)" ] && dotnet --version &>/dev/null; then export DOTNET_EXE="$(command -v dotnet)" else - # Download install script DOTNET_INSTALL_FILE="$TEMP_DIRECTORY/dotnet-install.sh" mkdir -p "$TEMP_DIRECTORY" curl -Lsfo "$DOTNET_INSTALL_FILE" "$DOTNET_INSTALL_URL" chmod +x "$DOTNET_INSTALL_FILE" - # If global.json exists, load expected version if [[ -f "$DOTNET_GLOBAL_FILE" ]]; then DOTNET_VERSION=$(FirstJsonValue "version" "$(cat "$DOTNET_GLOBAL_FILE")") if [[ "$DOTNET_VERSION" == "" ]]; then @@ -45,7 +42,6 @@ else fi fi - # Install by channel or version DOTNET_DIRECTORY="$TEMP_DIRECTORY/dotnet-unix" if [[ -z ${DOTNET_VERSION+x} ]]; then "$DOTNET_INSTALL_FILE" --install-dir "$DOTNET_DIRECTORY" --channel "$DOTNET_CHANNEL" --no-path @@ -58,10 +54,5 @@ fi echo "Microsoft (R) .NET SDK version $("$DOTNET_EXE" --version)" -if [[ ! -z ${NUKE_ENTERPRISE_TOKEN+x} && "$NUKE_ENTERPRISE_TOKEN" != "" ]]; then - "$DOTNET_EXE" nuget remove source "nuke-enterprise" &>/dev/null || true - "$DOTNET_EXE" nuget add source "https://f.feedz.io/nuke/enterprise/nuget" --name "nuke-enterprise" --username "PAT" --password "$NUKE_ENTERPRISE_TOKEN" --store-password-in-clear-text &>/dev/null || true -fi - -"$DOTNET_EXE" build "$BUILD_PROJECT_FILE" /nodeReuse:false /p:UseSharedCompilation=false -nologo -clp:NoSummary --verbosity quiet -"$DOTNET_EXE" run --project "$BUILD_PROJECT_FILE" --no-build -- "$@" +"$DOTNET_EXE" tool restore +exec "$DOTNET_EXE" fallout "$@" diff --git a/build/Build.cs b/build/Build.cs index 4c4f860..a788ef9 100644 --- a/build/Build.cs +++ b/build/Build.cs @@ -10,7 +10,6 @@ using Fallout.Common.Execution; using Fallout.Common.Git; using Fallout.Common.IO; -using Fallout.Common.ProjectModel; using Fallout.Common.Tooling; using Fallout.Common.Tools.CoverallsNet; using Fallout.Common.Tools.Coverlet; @@ -21,6 +20,7 @@ using Fallout.Common.Tools.ReportGenerator; using Fallout.Common.Utilities; using Fallout.Common.Utilities.Collections; +using Fallout.Solutions; using Serilog; using static Fallout.Common.IO.PathConstruction; using static Fallout.Common.Tools.CoverallsNet.CoverallsNetTasks; @@ -34,6 +34,10 @@ namespace BuildScript; [GitHubActions( "CI", GitHubActionsImage.WindowsLatest, + //RunsOnLabels = [ + // "windows-latest", + // "windows-11-arm", + //], On = [ GitHubActionsTrigger.Push @@ -51,7 +55,37 @@ namespace BuildScript; nameof(CoverallsToken) ], FetchDepth = 0, - Lfs = true)] + Lfs = true, + Env = [ + "DEMO_ENGINE_BUILD_ARCH: x64", + ])] +[GitHubActions( + "CI-arm", + GitHubActionsImage.WindowsLatest, + RunsOnLabels = [ + "windows-11-arm", + ], + On = + [ + GitHubActionsTrigger.Push + ], + InvokedTargets = + [ + nameof(Clean), + nameof(Compile), + nameof(Test), + nameof(Publish) + ], + EnableGitHubToken = true, + ImportSecrets = + [ + nameof(CoverallsToken) + ], + FetchDepth = 0, + Lfs = true, + Env = [ + "DEMO_ENGINE_BUILD_ARCH: arm64", + ])] internal sealed partial class Build : FalloutBuild { /* Install Global Tool @@ -89,6 +123,13 @@ var nuke when nuke.TryGetValue("NUKE_RUN_ID", out var nukeid) => nukeid, _ => null }; + [Parameter("Build architecture")] + public readonly string BuildArchitecture = EnvironmentInfo.Variables switch + { + var gh when gh.TryGetValue("DEMO_ENGINE_BUILD_ARCH", out var arch) => arch, + _ => "x64", + }; + [Solution(GenerateProjects = true)] public readonly Solution Solution = default!; [GitRepository] private readonly GitRepository _gitRepository = default!; @@ -153,8 +194,9 @@ var nuke when nuke.TryGetValue("NUKE_RUN_ID", out var nukeid) => nukeid, { ReadOnlySpan<(string os, string arch)> rids = [ - ("win", "x64"), + //("win", "x64"), //("win", "arm64"), + ("win", BuildArchitecture) ]; foreach (var testProj in TestProjects) diff --git a/src/Demo.Engine.Platform.DirectX12/Cube.cs b/src/Demo.Engine.Platform.DirectX12/Cube.cs index 771287b..e6d806e 100644 --- a/src/Demo.Engine.Platform.DirectX12/Cube.cs +++ b/src/Demo.Engine.Platform.DirectX12/Cube.cs @@ -135,7 +135,7 @@ public Cube( _pipelineState = _renderingEngine.Device.CreateGraphicsPipelineState(gfxPipelineStateDesc); } - public GraphicsPipelineStateDescription PrepareRenderingPipeline() + public unsafe GraphicsPipelineStateDescription PrepareRenderingPipeline() { const RootSignatureFlags ROOT_SIGNATURE_FLAGS = RootSignatureFlags.AllowInputAssemblerInputLayout