From 9a84cfdc5e34d0b840b79ff60ab52e81c28bda59 Mon Sep 17 00:00:00 2001 From: Chuck Walbourn Date: Tue, 22 Jul 2025 16:22:37 -0700 Subject: [PATCH] GHA and ADO pipeline updates (#623) --- .../DirectXTex-GitHub-CMake-Xbox-Dev17.yml | 50 +++--- .../DirectXTex-GitHub-CMake-Xbox.yml | 79 +++------ .../pipelines/DirectXTex-GitHub-CMake.yml | 86 ++-------- .../pipelines/DirectXTex-GitHub-GDK-Dev17.yml | 49 +++--- .../pipelines/DirectXTex-GitHub-GDK.yml | 22 ++- .../DirectXTex-GitHub-Test-Dev17.yml | 12 +- .../pipelines/DirectXTex-GitHub-Test.yml | 88 +--------- .azuredevops/pipelines/DirectXTex-GitHub.yml | 19 +-- .github/copilot-instructions.md | 107 ++++++++++++ .github/linters/actionlint.yml | 4 + .github/workflows/arm64.yml | 77 +++++++++ .github/workflows/arm64bvt.yml | 107 ++++++++++++ .github/workflows/bvt.yml | 2 +- build/RestoreGDK.proj | 20 +++ build/RestoreGDK.ps1 | 159 ++++++++++++++++++ build/SetupBWOI.cmd | 8 +- build/gdkedition.props | 6 + 17 files changed, 585 insertions(+), 310 deletions(-) create mode 100644 .github/copilot-instructions.md create mode 100644 .github/linters/actionlint.yml create mode 100644 .github/workflows/arm64.yml create mode 100644 .github/workflows/arm64bvt.yml create mode 100644 build/RestoreGDK.proj create mode 100644 build/RestoreGDK.ps1 create mode 100644 build/gdkedition.props diff --git a/.azuredevops/pipelines/DirectXTex-GitHub-CMake-Xbox-Dev17.yml b/.azuredevops/pipelines/DirectXTex-GitHub-CMake-Xbox-Dev17.yml index e722331..bc528f9 100644 --- a/.azuredevops/pipelines/DirectXTex-GitHub-CMake-Xbox-Dev17.yml +++ b/.azuredevops/pipelines/DirectXTex-GitHub-CMake-Xbox-Dev17.yml @@ -32,7 +32,6 @@ resources: - repository: self type: git ref: refs/heads/main - trigger: none - repository: testRepo name: walbourn/directxtextest type: github @@ -51,12 +50,14 @@ variables: value: '10.0.19041.0' - name: EXTRACTED_FOLDER value: '$(ExtractedFolder)' + - name: GDK_EDITION + value: $(GDKEditionNumber) - name: URL_FEED value: $(ADOFeedURL) - name: VC_PATH value: 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC' - name: GameDKLatest - value: '$(ExtractedFolder)\Microsoft.gdk.xbox.$(GDK_EDITION)\native\$(GDK_EDITION)\' + value: '$(ExtractedFolder)\Microsoft.gdk.xbox\native\$(GDK_EDITION)\' - name: skipNugetSecurityAnalysis value: true # We explicitly call this task so we don't need it to be auto-injected @@ -97,16 +98,13 @@ jobs: displayName: 'Secure Supply Chain Analysis' - task: NuGetAuthenticate@1 displayName: 'NuGet Auth' - - task: NuGetCommand@2 - displayName: NuGet install PGDK + - task: PowerShell@2 + displayName: 'NuGet Install GDK' inputs: - command: custom - arguments: install -prerelease Microsoft.GDK.PC.$(GDK_EDITION) -ExcludeVersion -OutputDirectory $(EXTRACTED_FOLDER) - - task: NuGetCommand@2 - displayName: NuGet install GDKX - inputs: - command: custom - arguments: install -prerelease Microsoft.GDK.Xbox.$(GDK_EDITION) -ExcludeVersion -OutputDirectory $(EXTRACTED_FOLDER) + targetType: filePath + filePath: ./build/RestoreGDK.ps1 + arguments: -GDKEditionNumber $(GDK_EDITION) -OutputDirectory $(EXTRACTED_FOLDER) + failOnStderr: true - task: CMake@1 displayName: 'CMake (MSVC): Config x64 (Xbox Series X|S)' inputs: @@ -251,16 +249,13 @@ jobs: displayName: 'Secure Supply Chain Analysis' - task: NuGetAuthenticate@1 displayName: 'NuGet Auth' - - task: NuGetCommand@2 - displayName: NuGet install PGDK + - task: PowerShell@2 + displayName: 'NuGet Install GDK' inputs: - command: custom - arguments: install -prerelease Microsoft.GDK.PC.$(GDK_EDITION) -ExcludeVersion -OutputDirectory $(EXTRACTED_FOLDER) - - task: NuGetCommand@2 - displayName: NuGet install GDKX - inputs: - command: custom - arguments: install -prerelease Microsoft.GDK.Xbox.$(GDK_EDITION) -ExcludeVersion -OutputDirectory $(EXTRACTED_FOLDER) + targetType: filePath + filePath: ./build/RestoreGDK.ps1 + arguments: -GDKEditionNumber $(GDK_EDITION) -OutputDirectory $(EXTRACTED_FOLDER) + failOnStderr: true - task: CmdLine@2 displayName: Setup BWOI for GDK command-line inputs: @@ -345,16 +340,13 @@ jobs: displayName: 'Secure Supply Chain Analysis' - task: NuGetAuthenticate@1 displayName: 'NuGet Auth' - - task: NuGetCommand@2 - displayName: NuGet install PGDK + - task: PowerShell@2 + displayName: 'NuGet Install GDK' inputs: - command: custom - arguments: install -prerelease Microsoft.GDK.PC.$(GDK_EDITION) -ExcludeVersion -OutputDirectory $(EXTRACTED_FOLDER) - - task: NuGetCommand@2 - displayName: NuGet install GDKX - inputs: - command: custom - arguments: install -prerelease Microsoft.GDK.Xbox.$(GDK_EDITION) -ExcludeVersion -OutputDirectory $(EXTRACTED_FOLDER) + targetType: filePath + filePath: ./build/RestoreGDK.ps1 + arguments: -GDKEditionNumber $(GDK_EDITION) -OutputDirectory $(EXTRACTED_FOLDER) + failOnStderr: true - task: CmdLine@2 displayName: Setup BWOI for GDK command-line inputs: diff --git a/.azuredevops/pipelines/DirectXTex-GitHub-CMake-Xbox.yml b/.azuredevops/pipelines/DirectXTex-GitHub-CMake-Xbox.yml index 2e27639..e277961 100644 --- a/.azuredevops/pipelines/DirectXTex-GitHub-CMake-Xbox.yml +++ b/.azuredevops/pipelines/DirectXTex-GitHub-CMake-Xbox.yml @@ -58,20 +58,22 @@ variables: - name: Codeql.Enabled value: false - name: VS_GENERATOR - value: 'Visual Studio 16 2019' + value: 'Visual Studio 17 2022' - name: WIN10_SDK value: '10.0.19041.0' - name: EXTRACTED_FOLDER value: '$(ExtractedFolder)' + - name: GDK_EDITION + value: $(GDKEditionNumber) - name: URL_FEED value: $(ADOFeedURL) - name: GameDKLatest - value: '$(ExtractedFolder)\Microsoft.gdk.xbox.$(GDK_EDITION)\native\$(GDK_EDITION)\' + value: '$(ExtractedFolder)\Microsoft.gdk.xbox\native\$(GDK_EDITION)\' - name: skipNugetSecurityAnalysis value: true # We explicitly call this task so we don't need it to be auto-injected pool: - vmImage: windows-2019 + vmImage: windows-2022 jobs: - job: CMAKE_BUILD @@ -107,22 +109,19 @@ jobs: displayName: 'Secure Supply Chain Analysis' - task: NuGetAuthenticate@1 displayName: 'NuGet Auth' - - task: NuGetCommand@2 - displayName: NuGet install PGDK + - task: PowerShell@2 + displayName: 'NuGet Install GDK' inputs: - command: custom - arguments: install -prerelease Microsoft.GDK.PC.$(GDK_EDITION) -ExcludeVersion -OutputDirectory $(EXTRACTED_FOLDER) - - task: NuGetCommand@2 - displayName: NuGet install GDKX - inputs: - command: custom - arguments: install -prerelease Microsoft.GDK.Xbox.$(GDK_EDITION) -ExcludeVersion -OutputDirectory $(EXTRACTED_FOLDER) + targetType: filePath + filePath: ./build/RestoreGDK.ps1 + arguments: -GDKEditionNumber $(GDK_EDITION) -OutputDirectory $(EXTRACTED_FOLDER) + failOnStderr: true - task: CMake@1 displayName: 'CMake (MSVC): Config x64 (Xbox Series X|S)' inputs: cwd: '' cmakeArgs: > - -G "$(VS_GENERATOR)" -A x64 -B out + -G "$(VS_GENERATOR)" -T v142 -A x64 -B out -DCMAKE_SYSTEM_VERSION=$(WIN10_SDK) -DBUILD_XBOX_EXTS_SCARLETT=ON -DBUILD_SAMPLE=OFF - task: CMake@1 @@ -135,66 +134,30 @@ jobs: inputs: cwd: '' cmakeArgs: --build out -v --config RelWithDebInfo - - task: CMake@1 - displayName: 'CMake (ClangCl): Config x64 (Xbox Series X|S)' - inputs: - cwd: '' - cmakeArgs: > - -G "$(VS_GENERATOR)" -A x64 -T clangcl -B out2 - -DCMAKE_SYSTEM_VERSION=$(WIN10_SDK) - -DBUILD_XBOX_EXTS_SCARLETT=ON -DBUILD_SAMPLE=OFF - - task: CMake@1 - displayName: 'CMake (ClangCl): Build x64 Debug (Xbox Series X|S)' - inputs: - cwd: '' - cmakeArgs: --build out2 -v --config Debug - - task: CMake@1 - displayName: 'CMake (ClangCl): Build x64 Release (Xbox Series X|S)' - inputs: - cwd: '' - cmakeArgs: --build out2 -v --config RelWithDebInfo - task: CMake@1 displayName: 'CMake (MSVC): Config x64 (Xbox One)' inputs: cwd: '' cmakeArgs: > - -G "$(VS_GENERATOR)" -A x64 -B out3 + -G "$(VS_GENERATOR)" -T v142 -A x64 -B out2 -DCMAKE_SYSTEM_VERSION=$(WIN10_SDK) -DBUILD_XBOX_EXTS_XBOXONE=ON -DBUILD_SAMPLE=OFF - task: CMake@1 displayName: 'CMake (MSVC): Build x64 Debug (Xbox One)' inputs: cwd: '' - cmakeArgs: --build out3 -v --config Debug + cmakeArgs: --build out2 -v --config Debug - task: CMake@1 displayName: 'CMake (MSVC): Build x64 Release (Xbox One)' inputs: cwd: '' - cmakeArgs: --build out3 -v --config RelWithDebInfo - - task: CMake@1 - displayName: 'CMake (ClangCl): Config x64 (Xbox One)' - inputs: - cwd: '' - cmakeArgs: > - -G "$(VS_GENERATOR)" -A x64 -T clangcl -B out4 - -DCMAKE_SYSTEM_VERSION=$(WIN10_SDK) - -DBUILD_XBOX_EXTS_XBOXONE=ON -DBUILD_SAMPLE=OFF - - task: CMake@1 - displayName: 'CMake (ClangCl): Build x64 Debug (Xbox One)' - inputs: - cwd: '' - cmakeArgs: --build out4 -v --config Debug - - task: CMake@1 - displayName: 'CMake (ClangCl): Build x64 Release (Xbox One)' - inputs: - cwd: '' - cmakeArgs: --build out4 -v --config RelWithDebInfo + cmakeArgs: --build out2 -v --config RelWithDebInfo - task: CMake@1 displayName: 'CMake (DLL): Config x64 (Xbox Series X|S)' inputs: cwd: '' cmakeArgs: > - -G "$(VS_GENERATOR)" -A x64 -B out5 + -G "$(VS_GENERATOR)" -T v142 -A x64 -B out3 -DCMAKE_SYSTEM_VERSION=$(WIN10_SDK) -DBUILD_XBOX_EXTS_SCARLETT=ON -DBUILD_SAMPLE=OFF -DBUILD_SHARED_LIBS=ON @@ -202,18 +165,18 @@ jobs: displayName: 'CMake (DLL): Build x64 Debug (Xbox Series X|S)' inputs: cwd: '' - cmakeArgs: --build out5 -v --config Debug + cmakeArgs: --build out3 -v --config Debug - task: CMake@1 displayName: 'CMake (DLL): Build x64 Release (Xbox Series X|S)' inputs: cwd: '' - cmakeArgs: --build out5 -v --config RelWithDebInfo + cmakeArgs: --build out3 -v --config RelWithDebInfo - task: CMake@1 displayName: 'CMake (DLL): Config x64 (Xbox One)' inputs: cwd: '' cmakeArgs: > - -G "$(VS_GENERATOR)" -A x64 -B out6 + -G "$(VS_GENERATOR)" -T v142 -A x64 -B out4 -DCMAKE_SYSTEM_VERSION=$(WIN10_SDK) -DBUILD_XBOX_EXTS_XBOXONE=ON -DBUILD_SAMPLE=OFF -DBUILD_SHARED_LIBS=ON @@ -221,9 +184,9 @@ jobs: displayName: 'CMake (DLL): Build x64 Debug (Xbox One)' inputs: cwd: '' - cmakeArgs: --build out6 -v --config Debug + cmakeArgs: --build out4 -v --config Debug - task: CMake@1 displayName: 'CMake (DLL): Build x64 Release (Xbox One)' inputs: cwd: '' - cmakeArgs: --build out6 -v --config RelWithDebInfo + cmakeArgs: --build out4 -v --config RelWithDebInfo diff --git a/.azuredevops/pipelines/DirectXTex-GitHub-CMake.yml b/.azuredevops/pipelines/DirectXTex-GitHub-CMake.yml index 28d3cfc..c80cd1f 100644 --- a/.azuredevops/pipelines/DirectXTex-GitHub-CMake.yml +++ b/.azuredevops/pipelines/DirectXTex-GitHub-CMake.yml @@ -69,14 +69,14 @@ variables: - name: VCPKG_MANIFEST_DIR value: '$(Build.SourcesDirectory)/build' - name: VS_GENERATOR - value: 'Visual Studio 16 2019' + value: 'Visual Studio 17 2022' - name: WIN10_SDK value: '10.0.19041.0' - name: WIN11_SDK value: '10.0.22000.0' pool: - vmImage: windows-2019 + vmImage: windows-2022 jobs: - job: CMAKE_BUILD @@ -90,7 +90,7 @@ jobs: inputs: cwd: $(Build.SourcesDirectory) cmakeArgs: > - -G "$(VS_GENERATOR)" -A x64 -B out + -G "$(VS_GENERATOR)" -T v142 -A x64 -B out -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON -DCMAKE_SYSTEM_VERSION=$(WIN10_SDK) -DBUILD_DX12=OFF - task: CMake@1 @@ -108,7 +108,7 @@ jobs: inputs: cwd: $(Build.SourcesDirectory) cmakeArgs: > - -G "$(VS_GENERATOR)" -A Win32 -B out2 + -G "$(VS_GENERATOR)" -T v142 -A Win32 -B out2 -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON -DCMAKE_SYSTEM_VERSION=$(WIN10_SDK) -DBUILD_DX12=OFF - task: CMake@1 @@ -126,82 +126,32 @@ jobs: inputs: cwd: $(Build.SourcesDirectory) cmakeArgs: > - -G "$(VS_GENERATOR)" -A x64 -B out3 + -G "$(VS_GENERATOR)" -T v142 -A x64 -B out3 -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON -DCMAKE_SYSTEM_VERSION=10.0 - task: CMake@1 displayName: 'CMake (UWP): Build x64' inputs: cwd: $(Build.SourcesDirectory) cmakeArgs: --build out3 -v - - task: CMake@1 - displayName: 'CMake (ClangCl): Config x64' - inputs: - cwd: $(Build.SourcesDirectory) - cmakeArgs: > - -G "$(VS_GENERATOR)" -A x64 -T clangcl -B out4 - -DCMAKE_SYSTEM_VERSION=$(WIN10_SDK) - - task: CMake@1 - displayName: 'CMake (ClangCl): Build x64 Debug' - inputs: - cwd: $(Build.SourcesDirectory) - cmakeArgs: --build out4 -v --config Debug - - task: CMake@1 - displayName: 'CMake (ClangCl): Build x64 Release' - inputs: - cwd: $(Build.SourcesDirectory) - cmakeArgs: --build out4 -v --config RelWithDebInfo - task: CMake@1 displayName: 'CMake (Win10): Config' inputs: cwd: $(Build.SourcesDirectory) cmakeArgs: > - -G "$(VS_GENERATOR)" -A x64 -B out5 + -G "$(VS_GENERATOR)" -T v142 -A x64 -B out4 -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON -DCMAKE_SYSTEM_VERSION=$(WIN10_SDK) -DBUILD_DX12=ON - task: CMake@1 displayName: 'CMake (Win10): Build' inputs: cwd: $(Build.SourcesDirectory) - cmakeArgs: --build out5 -v --config Debug - - task: CMake@1 - displayName: 'CMake (MSVC Spectre): Config x64' - inputs: - cwd: $(Build.SourcesDirectory) - cmakeArgs: > - -G "$(VS_GENERATOR)" -A x64 -B out6 - -DENABLE_SPECTRE_MITIGATION=ON -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON - -DCMAKE_SYSTEM_VERSION=$(WIN10_SDK) - -DBUILD_DX12=OFF - - task: CMake@1 - displayName: 'CMake (MSVC Spectre): Build x64 Debug' - inputs: - cwd: $(Build.SourcesDirectory) - cmakeArgs: --build out6 -v --config Debug - - task: CMake@1 - displayName: 'CMake (MSVC Spectre): Build x64 Release' - inputs: - cwd: $(Build.SourcesDirectory) - cmakeArgs: --build out6 -v --config RelWithDebInfo - - task: CMake@1 - displayName: 'CMake (Win10 Spectre): Config' - inputs: - cwd: $(Build.SourcesDirectory) - cmakeArgs: > - -G "$(VS_GENERATOR)" -A x64 -B out7 - -DENABLE_SPECTRE_MITIGATION=ON -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON - -DCMAKE_SYSTEM_VERSION=$(WIN10_SDK) - -DBUILD_DX12=ON - - task: CMake@1 - displayName: 'CMake (Win10 Spectre): Build' - inputs: - cwd: $(Build.SourcesDirectory) - cmakeArgs: --build out7 -v --config Debug + cmakeArgs: --build out4 -v --config Debug - task: CMake@1 displayName: 'CMake (NO_WCHAR_T): Config' inputs: cwd: $(Build.SourcesDirectory) cmakeArgs: > - -G "$(VS_GENERATOR)" -A x64 -B out8 + -G "$(VS_GENERATOR)" -T v142 -A x64 -B out5 -DNO_WCHAR_T=ON -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON -DCMAKE_SYSTEM_VERSION=$(WIN11_SDK) -DBUILD_DX12=ON @@ -209,13 +159,13 @@ jobs: displayName: 'CMake (NO_WCHAR_T): Build' inputs: cwd: $(Build.SourcesDirectory) - cmakeArgs: --build out8 -v --config Debug + cmakeArgs: --build out5 -v --config Debug - task: CMake@1 displayName: 'CMake (DLL): Config x64' inputs: cwd: $(Build.SourcesDirectory) cmakeArgs: > - -G "$(VS_GENERATOR)" -A x64 -B out9 + -G "$(VS_GENERATOR)" -T v142 -A x64 -B out6 -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON -DCMAKE_SYSTEM_VERSION=$(WIN10_SDK) -DBUILD_DX12=ON -DBUILD_SHARED_LIBS=ON @@ -223,25 +173,25 @@ jobs: displayName: 'CMake (DLL): Build x64 Debug' inputs: cwd: $(Build.SourcesDirectory) - cmakeArgs: --build out9 -v --config Debug + cmakeArgs: --build out6 -v --config Debug - task: CMake@1 displayName: 'CMake (DLL): Build x64 Release' inputs: cwd: $(Build.SourcesDirectory) - cmakeArgs: --build out9 -v --config RelWithDebInfo + cmakeArgs: --build out6 -v --config RelWithDebInfo - task: CMake@1 displayName: 'CMake (UWP DLL): Config x64' inputs: cwd: $(Build.SourcesDirectory) cmakeArgs: > - -G "$(VS_GENERATOR)" -A x64 -B out10 + -G "$(VS_GENERATOR)" -T v142 -A x64 -B out7 -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON -DCMAKE_SYSTEM_VERSION=10.0 -DBUILD_SHARED_LIBS=ON - task: CMake@1 displayName: 'CMake (UWP DLL): Build x64' inputs: cwd: $(Build.SourcesDirectory) - cmakeArgs: --build out10 -v + cmakeArgs: --build out7 -v - job: CMAKE_BUILD_VCPKG displayName: CMake using VCPKG @@ -272,7 +222,7 @@ jobs: inputs: cwd: $(Build.SourcesDirectory) cmakeArgs: > - -G "$(VS_GENERATOR)" -A x64 -B out -DCMAKE_SYSTEM_VERSION=$(WIN10_SDK) + -G "$(VS_GENERATOR)" -T v142 -A x64 -B out -DCMAKE_SYSTEM_VERSION=$(WIN10_SDK) -DCMAKE_TOOLCHAIN_FILE="$(VCPKG_CMAKE_DIR)" -DVCPKG_MANIFEST_DIR="$(VCPKG_MANIFEST_DIR)" -DVCPKG_TARGET_TRIPLET=x64-windows - task: CMake@1 @@ -285,7 +235,7 @@ jobs: inputs: cwd: $(Build.SourcesDirectory) cmakeArgs: > - -G "$(VS_GENERATOR)" -A x64 -B out2 -DENABLE_OPENEXR_SUPPORT=ON -DBUILD_TESTING=OFF -DCMAKE_SYSTEM_VERSION=$(WIN10_SDK) + -G "$(VS_GENERATOR)" -T v142 -A x64 -B out2 -DENABLE_OPENEXR_SUPPORT=ON -DBUILD_TESTING=OFF -DCMAKE_SYSTEM_VERSION=$(WIN10_SDK) -DCMAKE_TOOLCHAIN_FILE="$(VCPKG_CMAKE_DIR)" -DVCPKG_MANIFEST_DIR="$(VCPKG_MANIFEST_DIR)" -DVCPKG_TARGET_TRIPLET=x64-windows - task: CMake@1 @@ -298,7 +248,7 @@ jobs: inputs: cwd: $(Build.SourcesDirectory) cmakeArgs: > - -G "$(VS_GENERATOR)" -A x64 -B out3 -DENABLE_LIBJPEG_SUPPORT=ON -DBUILD_TESTING=OFF -DCMAKE_SYSTEM_VERSION=$(WIN10_SDK) + -G "$(VS_GENERATOR)" -T v142 -A x64 -B out3 -DENABLE_LIBJPEG_SUPPORT=ON -DBUILD_TESTING=OFF -DCMAKE_SYSTEM_VERSION=$(WIN10_SDK) -DCMAKE_TOOLCHAIN_FILE="$(VCPKG_CMAKE_DIR)" -DVCPKG_MANIFEST_DIR="$(VCPKG_MANIFEST_DIR)" -DVCPKG_TARGET_TRIPLET=x64-windows - task: CMake@1 @@ -311,7 +261,7 @@ jobs: inputs: cwd: $(Build.SourcesDirectory) cmakeArgs: > - -G "$(VS_GENERATOR)" -A x64 -B out4 -DENABLE_LIBPNG_SUPPORT=ON -DBUILD_TESTING=OFF -DCMAKE_SYSTEM_VERSION=$(WIN10_SDK) + -G "$(VS_GENERATOR)" -T v142 -A x64 -B out4 -DENABLE_LIBPNG_SUPPORT=ON -DBUILD_TESTING=OFF -DCMAKE_SYSTEM_VERSION=$(WIN10_SDK) -DCMAKE_TOOLCHAIN_FILE="$(VCPKG_CMAKE_DIR)" -DVCPKG_MANIFEST_DIR="$(VCPKG_MANIFEST_DIR)" -DVCPKG_TARGET_TRIPLET=x64-windows - task: CMake@1 diff --git a/.azuredevops/pipelines/DirectXTex-GitHub-GDK-Dev17.yml b/.azuredevops/pipelines/DirectXTex-GitHub-GDK-Dev17.yml index e7663b4..570e951 100644 --- a/.azuredevops/pipelines/DirectXTex-GitHub-GDK-Dev17.yml +++ b/.azuredevops/pipelines/DirectXTex-GitHub-GDK-Dev17.yml @@ -34,7 +34,6 @@ resources: - repository: self type: git ref: refs/heads/main - trigger: none name: $(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r) @@ -47,6 +46,8 @@ variables: value: false - name: EXTRACTED_FOLDER value: '$(ExtractedFolder)' + - name: GDK_EDITION + value: $(GDKEditionNumber) - name: GDKEnableBWOI value: true - name: URL_FEED @@ -92,16 +93,13 @@ jobs: displayName: 'Secure Supply Chain Analysis' - task: NuGetAuthenticate@1 displayName: 'NuGet Auth' - - task: NuGetCommand@2 - displayName: NuGet install PGDK + - task: PowerShell@2 + displayName: 'NuGet Install GDK' inputs: - command: custom - arguments: install -prerelease Microsoft.GDK.PC.$(GDK_EDITION) -ExcludeVersion -OutputDirectory $(EXTRACTED_FOLDER) - - task: NuGetCommand@2 - displayName: NuGet install GDKX - inputs: - command: custom - arguments: install -prerelease Microsoft.GDK.Xbox.$(GDK_EDITION) -ExcludeVersion -OutputDirectory $(EXTRACTED_FOLDER) + targetType: filePath + filePath: ./build/RestoreGDK.ps1 + arguments: -GDKEditionNumber $(GDK_EDITION) -OutputDirectory $(EXTRACTED_FOLDER) + failOnStderr: true - task: CopyFiles@2 displayName: Set up Directory.Build.props inputs: @@ -112,7 +110,6 @@ jobs: displayName: Setup BWOI VCTargets inputs: solution: build/SetupBWOI.targets - msbuildVersion: 17.0 msbuildArchitecture: x64 msbuildArguments: /p:GDKEditionNumber=$(GDK_EDITION) - template: '/.azuredevops/templates/DirectXTex-build-gdk.yml' @@ -155,16 +152,13 @@ jobs: displayName: 'Secure Supply Chain Analysis' - task: NuGetAuthenticate@1 displayName: 'NuGet Auth' - - task: NuGetCommand@2 - displayName: NuGet install PGDK + - task: PowerShell@2 + displayName: 'NuGet Install GDK' inputs: - command: custom - arguments: install -prerelease Microsoft.GDK.PC.$(GDK_EDITION) -ExcludeVersion -OutputDirectory $(EXTRACTED_FOLDER) - - task: NuGetCommand@2 - displayName: NuGet install GDKX - inputs: - command: custom - arguments: install -prerelease Microsoft.GDK.Xbox.$(GDK_EDITION) -ExcludeVersion -OutputDirectory $(EXTRACTED_FOLDER) + targetType: filePath + filePath: ./build/RestoreGDK.ps1 + arguments: -GDKEditionNumber $(GDK_EDITION) -OutputDirectory $(EXTRACTED_FOLDER) + failOnStderr: true - task: CmdLine@2 displayName: Setup BWOI for GDK command-line inputs: @@ -274,16 +268,13 @@ jobs: displayName: 'Secure Supply Chain Analysis' - task: NuGetAuthenticate@1 displayName: 'NuGet Auth' - - task: NuGetCommand@2 - displayName: NuGet install PGDK + - task: PowerShell@2 + displayName: 'NuGet Install GDK' inputs: - command: custom - arguments: install -prerelease Microsoft.GDK.PC.$(GDK_EDITION) -ExcludeVersion -OutputDirectory $(EXTRACTED_FOLDER) - - task: NuGetCommand@2 - displayName: NuGet install GDKX - inputs: - command: custom - arguments: install -prerelease Microsoft.GDK.Xbox.$(GDK_EDITION) -ExcludeVersion -OutputDirectory $(EXTRACTED_FOLDER) + targetType: filePath + filePath: ./build/RestoreGDK.ps1 + arguments: -GDKEditionNumber $(GDK_EDITION) -OutputDirectory $(EXTRACTED_FOLDER) + failOnStderr: true - task: CmdLine@2 displayName: Setup BWOI for GDK command-line inputs: diff --git a/.azuredevops/pipelines/DirectXTex-GitHub-GDK.yml b/.azuredevops/pipelines/DirectXTex-GitHub-GDK.yml index c6a8dc1..e7e6f4a 100644 --- a/.azuredevops/pipelines/DirectXTex-GitHub-GDK.yml +++ b/.azuredevops/pipelines/DirectXTex-GitHub-GDK.yml @@ -58,7 +58,7 @@ resources: name: $(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r) pool: - vmImage: windows-2019 + vmImage: windows-2022 variables: - group: dxtex-shared-variables @@ -66,6 +66,8 @@ variables: value: false - name: EXTRACTED_FOLDER value: '$(ExtractedFolder)' + - name: GDK_EDITION + value: $(GDKEditionNumber) - name: GDKEnableBWOI value: true - name: URL_FEED @@ -109,16 +111,13 @@ jobs: displayName: 'Secure Supply Chain Analysis' - task: NuGetAuthenticate@1 displayName: 'NuGet Auth' - - task: NuGetCommand@2 - displayName: NuGet install PGDK + - task: PowerShell@2 + displayName: 'NuGet Install GDK' inputs: - command: custom - arguments: install -prerelease Microsoft.GDK.PC.$(GDK_EDITION) -ExcludeVersion -OutputDirectory $(EXTRACTED_FOLDER) - - task: NuGetCommand@2 - displayName: NuGet install GDKX - inputs: - command: custom - arguments: install -prerelease Microsoft.GDK.Xbox.$(GDK_EDITION) -ExcludeVersion -OutputDirectory $(EXTRACTED_FOLDER) + targetType: filePath + filePath: ./build/RestoreGDK.ps1 + arguments: -GDKEditionNumber $(GDK_EDITION) -OutputDirectory $(EXTRACTED_FOLDER) + failOnStderr: true - task: CopyFiles@2 displayName: Set up Directory.Build.props inputs: @@ -129,10 +128,9 @@ jobs: displayName: Setup BWOI VCTargets inputs: solution: build/SetupBWOI.targets - msbuildVersion: 16.0 msbuildArchitecture: x64 msbuildArguments: /p:GDKEditionNumber=$(GDK_EDITION) - template: '/.azuredevops/templates/DirectXTex-build-gdk.yml' parameters: - msVersion: '16.0' + msVersion: '17.0' vsYear: 2019 diff --git a/.azuredevops/pipelines/DirectXTex-GitHub-Test-Dev17.yml b/.azuredevops/pipelines/DirectXTex-GitHub-Test-Dev17.yml index bbe0703..b87b7e5 100644 --- a/.azuredevops/pipelines/DirectXTex-GitHub-Test-Dev17.yml +++ b/.azuredevops/pipelines/DirectXTex-GitHub-Test-Dev17.yml @@ -39,9 +39,13 @@ pool: vmImage: windows-2022 variables: - Codeql.Enabled: false - VC_PATH: 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC' - GUID_FEED: $(ADOFeedGUID) + - group: dxtex-shared-variables + - name: Codeql.Enabled + value: false + - name: VC_PATH + value: 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC' + - name: GUID_FEED + value: $(ADOFeedGUID) jobs: - job: DESKTOP_BUILD @@ -93,7 +97,6 @@ jobs: displayName: Build solution DirectXTex_Tests_Desktop_2022.sln inputs: solution: Tests/DirectXTex_Tests_Desktop_2022.sln - vsVersion: 17.0 msbuildArgs: /p:PreferredToolArchitecture=x64 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' @@ -103,7 +106,6 @@ jobs: displayName: Build solution DirectXTex_Tests_Desktop_2022_Win10.sln inputs: solution: Tests/DirectXTex_Tests_Desktop_2022_Win10.sln - vsVersion: 17.0 msbuildArgs: /p:PreferredToolArchitecture=x64 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' diff --git a/.azuredevops/pipelines/DirectXTex-GitHub-Test.yml b/.azuredevops/pipelines/DirectXTex-GitHub-Test.yml index 910b3c7..bc63784 100644 --- a/.azuredevops/pipelines/DirectXTex-GitHub-Test.yml +++ b/.azuredevops/pipelines/DirectXTex-GitHub-Test.yml @@ -36,14 +36,12 @@ resources: name: $(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r) pool: - vmImage: windows-2019 + vmImage: windows-2022 variables: - group: dxtex-shared-variables - name: Codeql.Enabled value: false - - name: VC_PATH - value: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC' - name: GUID_FEED value: $(ADOFeedGUID) @@ -91,7 +89,6 @@ jobs: displayName: Build solution DirectXTex_Tests_Desktop_2019.sln inputs: solution: Tests/DirectXTex_Tests_Desktop_2019.sln - vsVersion: 16.0 msbuildArgs: /p:PreferredToolArchitecture=x64 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' @@ -99,89 +96,6 @@ jobs: displayName: Build solution DirectXTex_Tests_Desktop_2019_Win10.sln inputs: solution: Tests/DirectXTex_Tests_Desktop_2019_Win10.sln - vsVersion: 16.0 msbuildArgs: /p:PreferredToolArchitecture=x64 platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' - - - job: CMAKE_BUILD_X64 - displayName: 'CMake for X64 BUILD_TESTING=ON' - timeoutInMinutes: 120 - workspace: - clean: all - steps: - - checkout: self - clean: true - fetchTags: false - fetchDepth: 1 - path: 's' - - checkout: testRepo - displayName: Fetch Tests - clean: true - fetchTags: false - fetchDepth: 1 - path: 's/Tests' - - task: CmdLine@2 - displayName: Setup environment for CMake to use VS - inputs: - script: | - call "$(VC_PATH)\Auxiliary\Build\vcvars64.bat" - echo ##vso[task.setvariable variable=WindowsSdkVerBinPath;]%WindowsSdkVerBinPath% - echo ##vso[task.prependpath]%VSINSTALLDIR%Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja - echo ##vso[task.prependpath]%VCINSTALLDIR%Tools\Llvm\x64\bin - echo ##vso[task.prependpath]%WindowsSdkBinPath%x64 - echo ##vso[task.prependpath]%WindowsSdkVerBinPath%x64 - echo ##vso[task.prependpath]%VCToolsInstallDir%bin\Hostx64\x64 - echo ##vso[task.setvariable variable=EXTERNAL_INCLUDE;]%EXTERNAL_INCLUDE% - echo ##vso[task.setvariable variable=INCLUDE;]%INCLUDE% - echo ##vso[task.setvariable variable=LIB;]%LIB% - - - task: CMake@1 - displayName: CMake (MSVC; x64-Debug) Config - inputs: - cwd: '$(Build.SourcesDirectory)' - cmakeArgs: --preset=x64-Debug - - task: CMake@1 - displayName: CMake (MSVC; x64-Debug) Build - inputs: - cwd: '$(Build.SourcesDirectory)' - cmakeArgs: --build out/build/x64-Debug -v - - task: DeleteFiles@1 - inputs: - Contents: 'out' - - task: CMake@1 - displayName: CMake (MSVC; x64-Release) Config - inputs: - cwd: '$(Build.SourcesDirectory)' - cmakeArgs: --preset=x64-Release - - task: CMake@1 - displayName: CMake (MSVC; x64-Release) Build - inputs: - cwd: '$(Build.SourcesDirectory)' - cmakeArgs: --build out/build/x64-Release -v - - task: DeleteFiles@1 - inputs: - Contents: 'out' - - task: CMake@1 - displayName: CMake (clang/LLVM; x64-Debug) Config - inputs: - cwd: '$(Build.SourcesDirectory)' - cmakeArgs: --preset=x64-Debug-Clang - - task: CMake@1 - displayName: CMake (clang/LLVM; x64-Debug) Build - inputs: - cwd: '$(Build.SourcesDirectory)' - cmakeArgs: --build out/build/x64-Debug-Clang -v - - task: DeleteFiles@1 - inputs: - Contents: 'out' - - task: CMake@1 - displayName: CMake (clang/LLVM; x64-Release) Config - inputs: - cwd: '$(Build.SourcesDirectory)' - cmakeArgs: --preset=x64-Release-Clang - - task: CMake@1 - displayName: CMake (clang/LLVM; x64-Release) Build - inputs: - cwd: '$(Build.SourcesDirectory)' - cmakeArgs: --build out/build/x64-Release-Clang -v diff --git a/.azuredevops/pipelines/DirectXTex-GitHub.yml b/.azuredevops/pipelines/DirectXTex-GitHub.yml index 16b6be2..ab5f674 100644 --- a/.azuredevops/pipelines/DirectXTex-GitHub.yml +++ b/.azuredevops/pipelines/DirectXTex-GitHub.yml @@ -35,7 +35,7 @@ variables: Codeql.Enabled: false pool: - vmImage: windows-2019 + vmImage: windows-2022 jobs: - job: DESKTOP_BUILD @@ -61,22 +61,7 @@ jobs: BuildPlatform: x86 BuildConfiguration: Debug SpectreMitigation: false - Release_x64_SpectreMitigated: - BuildPlatform: x64 - BuildConfiguration: Release - SpectreMitigation: 'Spectre' - Debug_x64_SpectreMitigated: - BuildPlatform: x64 - BuildConfiguration: Debug - SpectreMitigation: 'Spectre' - Release_x86_SpectreMitigated: - BuildPlatform: x86 - BuildConfiguration: Release - SpectreMitigation: 'Spectre' - Debug_x86_SpectreMitigated: - BuildPlatform: x86 - BuildConfiguration: Debug - SpectreMitigation: 'Spectre' + # windows-2022 image is missing v142 spectre-mitigated libraries steps: - checkout: self clean: true diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 100644 index 0000000..7d56407 --- /dev/null +++ b/.github/copilot-instructions.md @@ -0,0 +1,107 @@ +# GitHub Copilot Instructions + +These instructions define how GitHub Copilot should assist with this project. The goal is to ensure consistent, high-quality code generation aligned with our conventions, stack, and best practices. + +## Context + +- **Project Type**: Graphics Library / DirectX / Direct3D 11 / Direct3D 12 / Image Processing +- **Project Name**: DirectXTex Texture Processing Library +- **Language**: C++ +- **Framework / Libraries**: STL / CMake / CTest +- **Architecture**: Modular / RAII / OOP + +## Getting Started + +- See the tutorial at [Getting Started](https://github.com/microsoft/DirectXTex/wiki/Getting-Started). +- The recommended way to integrate *DirectXTex* into your project is by using the *vcpkg* Package Manager. +- You can make use of the nuget.org packages **directxtex_desktop_2019**, **directxtex_desktop_win10**, or **directxtex_uwp**. +- You can also use the library source code directly in your project or as a git submodule. + +## General Guidelines + +- **Code Style**: The project uses an .editorconfig file to enforce coding standards. Follow the rules defined in `.editorconfig` for indentation, line endings, and other formatting. Additional information can be found on the wiki at [Implementation](https://github.com/microsoft/DirectXTK/wiki/Implementation). The code requires C++11/C++14 features. +- **Documentation**: The project provides documentation in the form of wiki pages available at [Documentation](https://github.com/microsoft/DirectXTex/wiki/). +- **Error Handling**: Use C++ exceptions for error handling and uses RAII smart pointers to ensure resources are properly managed. For some functions that return HRESULT error codes, they are marked `noexcept`, use `std::nothrow` for memory allocation, and should not throw exceptions. +- **Testing**: Unit tests for this project are implemented in this repository [Test Suite](https://github.com/walbourn/directxtextest/) and can be run using CTest per the instructions at [Test Documentation](https://github.com/walbourn/directxtextest/wiki). +- **Security**: This project uses secure coding practices from the Microsoft Secure Coding Guidelines, and is subject to the `SECURITY.md` file in the root of the repository. Functions that read input from geometry files are subject to OneFuzz testing to ensure they are secure against malformed files. +- **Dependencies**: The project uses CMake and VCPKG for managing dependencies, making optional use of DirectXMath and DirectX-Headers. The project can be built without these dependencies, relying on the Windows SDK for core functionality. +- **Continuous Integration**: This project implements GitHub Actions for continuous integration, ensuring that all code changes are tested and validated before merging. This includes building the project for a number of configurations and toolsets, running a subset of unit tests, and static code analysis including GitHub super-linter, CodeQL, and MSVC Code Analysis. +- **Code of Conduct**: The project adheres to the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). All contributors are expected to follow this code of conduct in all interactions related to the project. + +## File Structure + +```txt +.azuredevops/ # Azure DevOps pipeline configuration and policy files. +.github/ # GitHub Actions workflow files and linter configuration files. +.nuget/ # NuGet package configuration files. +build/ # Miscellaneous build files and scripts. +Auxiliary/ # Auxiliary functions such as Xbox tiling extensions, OpenEXR support, etc. +DirectXTex/ # DirectXTex implementation files. + Shaders/ # HLSL shader files. +DDSView/ # Sample application for viewing DDS texture files using DirectXTex. +texassemble/ # CLI tool for creating complex DDS files from multiple image files. +texconv/ # CLI tool for converting image files to DDS texture files including block compression, mipmaps, and resizing. +texdiag/ # CLI tool for diagnosing and validating DDS texture files. +DDSTextureLoader/ # Standalone version of the DDS texture loader for Direct3D 9/11/12. +ScreenGrab/ # Standalone version of the screenshot capture utility for Direct3D 9/11/12. +WICTextureLoader/ # Standalone versoin of the WIC texture loader for Direct3D 9/11/12. +Tests/ # Tests are designed to be cloned from a separate repository at this location. +``` + +> Note that DDSTextureLoader, ScreenGrab, and WICTextureLoader are standalone version of utilities which are also included in the *DirectX Tool Kit for DirectX 11* and *DirectX Tool Kit for DirectX 12*. + +## Patterns + +### Patterns to Follow + +- Use RAII for all resource ownership (memory, file handles, etc.). +- Many classes utilize the pImpl idiom to hide implementation details, and to enable optimized memory alignment in the implementation. +- Use `std::unique_ptr` for exclusive ownership and `std::shared_ptr` for shared ownership. +- Use `Microsoft::WRL::ComPtr` for COM object management. +- Make use of anonymous namespaces to limit scope of functions and variables. +- Make use of `assert` for debugging checks, but be sure to validate input parameters in release builds. + +### Patterns to Avoid + +- Don’t use raw pointers for ownership. +- Avoid macros for constants—prefer `constexpr` or `inline` `const`. +- Don’t put implementation logic in header files unless using templates, although the SimpleMath library does use an .inl file for performance. +- Avoid using `using namespace` in header files to prevent polluting the global namespace. + +## References + +- [C++ Core Guidelines](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines) +- [Microsoft Secure Coding Guidelines](https://learn.microsoft.com/en-us/security/develop/secure-coding-guidelines) +- [CMake Documentation](https://cmake.org/documentation/) +- [VCPK Documentation](https://learn.microsoft.com/vcpkg/) +- [DirectXTex Wiki](https://github.com/microsoft/DirectXTex/wiki/) +- [Games for Windows and the DirectX SDK blog - October 2021](https://walbourn.github.io/directxtex/) +- [Games for Windows and the DirectX SDK blog - April 2025](https://walbourn.github.io/github-project-updates-2025/) + +## No speculation + +When creating documentation: + +### Document Only What Exists + +- Only document features, patterns, and decisions that are explicitly present in the source code. +- Only include configurations and requirements that are clearly specified. +- Do not make assumptions about implementation details. + +### Handle Missing Information + +- Ask the user questions to gather missing information. +- Document gaps in current implementation or specifications. +- List open questions that need to be addressed. + +### Source Material + +- Always cite the specific source file and line numbers for documented features. +- Link directly to relevant source code when possible. +- Indicate when information comes from requirements vs. implementation. + +### Verification Process + +- Review each documented item against source code whenever related to the task. +- Remove any speculative content. +- Ensure all documentation is verifiable against the current state of the codebase. diff --git a/.github/linters/actionlint.yml b/.github/linters/actionlint.yml new file mode 100644 index 0000000..8f70803 --- /dev/null +++ b/.github/linters/actionlint.yml @@ -0,0 +1,4 @@ +self-hosted-runner: + # Workaround until linter is updated + labels: + - windows-11-arm diff --git a/.github/workflows/arm64.yml b/.github/workflows/arm64.yml new file mode 100644 index 0000000..c5d172c --- /dev/null +++ b/.github/workflows/arm64.yml @@ -0,0 +1,77 @@ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# +# http://go.microsoft.com/fwlink/?LinkId=248926 + +name: 'CMake (Windows on ARM64)' + +on: + push: + branches: "main" + paths-ignore: + - '*.md' + - LICENSE + - '.azuredevops/**' + - '.nuget/*' + - build/*.cmd + - build/*.json + - build/*.props + - build/*.ps1 + - build/*.targets + - build/*.xvd + pull_request: + branches: "main" + paths-ignore: + - '*.md' + - LICENSE + - '.azuredevops/**' + - '.nuget/*' + - build/*.cmd + - build/*.json + - build/*.props + - build/*.ps1 + - build/*.targets + - build/*.xvd + +permissions: + contents: read + +jobs: + build: + runs-on: windows-11-arm + + strategy: + fail-fast: false + + matrix: + build_type: [arm64-Debug, arm64-Release, arm64-Debug-UWP, arm64-Release-UWP] + + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + + - name: 'Install Ninja' + run: choco install ninja + + - uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0 + with: + arch: arm64 + + - name: 'Configure CMake' + working-directory: ${{ github.workspace }} + run: cmake --preset=${{ matrix.build_type }} + + - name: 'Build' + working-directory: ${{ github.workspace }} + run: cmake --build out\build\${{ matrix.build_type }} + + - name: 'Clean up' + working-directory: ${{ github.workspace }} + run: Remove-Item -Path out -Recurse -Force + + - name: 'Configure CMake (DLL)' + working-directory: ${{ github.workspace }} + run: cmake --preset=${{ matrix.build_type }} -DBUILD_SHARED_LIBS=ON + + - name: 'Build (DLL)' + working-directory: ${{ github.workspace }} + run: cmake --build out\build\${{ matrix.build_type }} diff --git a/.github/workflows/arm64bvt.yml b/.github/workflows/arm64bvt.yml new file mode 100644 index 0000000..1e51ac8 --- /dev/null +++ b/.github/workflows/arm64bvt.yml @@ -0,0 +1,107 @@ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# +# https://go.microsoft.com/fwlink/?LinkId=248926 + +name: 'BVTs (arm64)' + +on: + push: + branches: "main" + paths-ignore: + - '*.md' + - LICENSE + - '.azuredevops/**' + - '.nuget/*' + - build/*.cmd + - build/*.json + - build/*.props + - build/*.ps1 + - build/*.targets + - build/*.xvd + pull_request: + branches: "main" + paths-ignore: + - '*.md' + - LICENSE + - '.azuredevops/**' + - '.nuget/*' + - build/*.cmd + - build/*.json + - build/*.props + - build/*.ps1 + - build/*.targets + - build/*.xvd + +permissions: + contents: read + +jobs: + build: + runs-on: windows-11-arm + timeout-minutes: 60 + + strategy: + fail-fast: false + + matrix: + build_type: [arm64-Release] + + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + + - name: Clone test repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + repository: walbourn/directxtextest + path: Tests + ref: main + + - name: 'Install Ninja' + run: choco install ninja + + - uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0 + with: + arch: arm64 + + - name: 'Set triplet' + shell: pwsh + run: echo "VCPKG_DEFAULT_TRIPLET=arm64-windows" >> $env:GITHUB_ENV + + - name: Get vcpkg commit hash + shell: pwsh + run: | + if ($Env:vcpkgRelease) { + echo "Using vcpkg commit from repo variable..." + $VCPKG_COMMIT_ID = $Env:vcpkgRelease + } + else { + echo "Fetching latest vcpkg commit hash..." + $commit = (git ls-remote https://github.com/microsoft/vcpkg.git HEAD | Select-String -Pattern '([a-f0-9]{40})').Matches.Value + $VCPKG_COMMIT_ID = $commit + } + Write-Host "VCPKG_COMMIT_ID=$VCPKG_COMMIT_ID" + echo "VCPKG_COMMIT_ID=$VCPKG_COMMIT_ID" >> $env:GITHUB_ENV + env: + vcpkgRelease: '${{ vars.VCPKG_COMMIT_ID }}' + + - uses: lukka/run-vcpkg@7d259227a1fb6471a0253dd5ab7419835228f7d7 # v11 + with: + runVcpkgInstall: true + vcpkgJsonGlob: '**/build/vcpkg.json' + vcpkgGitCommitId: '${{ env.VCPKG_COMMIT_ID }}' + + - name: 'Configure CMake' + working-directory: ${{ github.workspace }} + run: > + cmake --preset=${{ matrix.build_type }} -DBUILD_TESTING=ON -DBUILD_TOOLS=OFF -DBUILD_SAMPLE=OFF -DBUILD_BVT=ON + -DCMAKE_TOOLCHAIN_FILE="${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake" -DVCPKG_MANIFEST_DIR="${{ github.workspace }}/build" + -DVCPKG_TARGET_TRIPLET="${env:VCPKG_DEFAULT_TRIPLET}" + + - name: 'Build' + working-directory: ${{ github.workspace }} + run: cmake --build out\build\${{ matrix.build_type }} + + - name: 'Run BVTs' + working-directory: ${{ github.workspace }} + run: ctest --preset=${{ matrix.build_type }} --output-on-failure diff --git a/.github/workflows/bvt.yml b/.github/workflows/bvt.yml index fa3715c..350f1ff 100644 --- a/.github/workflows/bvt.yml +++ b/.github/workflows/bvt.yml @@ -3,7 +3,7 @@ # # https://go.microsoft.com/fwlink/?LinkId=248926 -name: 'CTest (BVTs)' +name: 'BVTs (x64)' on: push: diff --git a/build/RestoreGDK.proj b/build/RestoreGDK.proj new file mode 100644 index 0000000..512d0fc --- /dev/null +++ b/build/RestoreGDK.proj @@ -0,0 +1,20 @@ + + + + + + + + $(GDKEditionNumber.Substring(0,2))$(GDKEditionNumber.Substring(2,2)) + $(GDKEditionNumber.Substring(4,2).TrimStart('0')) + 0 + + + net472 + x64 + + + + + + diff --git a/build/RestoreGDK.ps1 b/build/RestoreGDK.ps1 new file mode 100644 index 0000000..5f62959 --- /dev/null +++ b/build/RestoreGDK.ps1 @@ -0,0 +1,159 @@ +<# + +.SYNOPSIS +Download and extract GDK NuGet based on edition number + +.DESCRIPTION +This script determines the NuGet package id to use based on the provided GDK edition number. It makes use of MSBuild PackageReference floating version numbers to do the restore operation. + +.PARAMETER GDKEditionNumber +The GDK edition number in the form of YYMMQQ. + +.PARAMETER OutputDirectory +Directory to write the packages into. Path should not already contain the packages. + +#> + +param( + [Parameter( + Mandatory, + Position = 0 + )] + [string]$GDKEditionNumber, + [Parameter( + Mandatory, + Position = 1 + )] + [string]$OutputDirectory +) + +# Validate output directory +if ([string]::IsNullOrEmpty($OutputDirectory)) { + Write-Error "##[error]Output Directory is required" -ErrorAction Stop +} + +# Parse edition number +if (-not ($GDKEditionNumber -match '^([0-9][0-9])([0-9][0-9])([0-9][0-9])$')) { + Write-Error "##[error]This script requires a valid GDK edition number!" -ErrorAction Stop +} + +$year = $Matches.1 +$month = [int]$Matches.2 +$qfe = [int]$Matches.3 + +if ($year -lt 21) +{ + Write-Error "##[error]Edition year not supported: 20$year" -ErrorAction Stop +} + +if (($month -lt 1) -or ($month -gt 12)) +{ + Write-Error "##[error]Edition month not supported: $month" -ErrorAction Stop +} + +if ($qfe -gt 0) { + Write-Host ("##[debug]GDKEditionNumber = $GDKEditionNumber ({0} 20{1} QFE {2})" -f (Get-Culture).DateTimeFormat.GetMonthName($month), $year, $qfe) +} +else { + Write-Host ("##[debug]GDKEditionNumber = $GDKEditionNumber ({0} 20{1})" -f (Get-Culture).DateTimeFormat.GetMonthName($month), $year) +} + +# Verify NuGet tool is available +$nuget = Get-Command nuget.exe -ErrorAction SilentlyContinue +if (-Not $nuget) { + Write-Error "##[error]Missing required nuget.exe tool" -ErrorAction Stop +} + +# Determine NuGet package ID +if ($GDKEditionNumber -ge 241000) { + $PGDK_ID = "Microsoft.GDK.PC" + $GDKX_ID = "Microsoft.GDK.Xbox" +} +else { + Write-Error "##[error]Script supports October 2024 or later" -ErrorAction Stop +} + +# Check that the package isn't already present +$PGDK_DIR = [IO.Path]::Combine($OutputDirectory, $PGDK_ID) +if (Test-Path $PGDK_DIR) { + Write-Error "##[error]PC Package ID already exists!" -ErrorAction Stop +} + +$GDKX_DIR = [IO.Path]::Combine($OutputDirectory, $GDKX_ID) +if (Test-Path $GDKX_DIR) { + Write-Error "##[error]Xbox Package ID already exists!" -ErrorAction Stop +} + +# Restore Nuget packages using floating versions +$propsfile = [IO.Path]::Combine( $PSScriptRoot , "gdkedition.props") +$props = Get-Content -Path $propsfile +$props = $props -replace '.+', ("{0}" -f $GDKEditionNumber) +Set-Content -Path $propsfile -Value $props + +$nugetArgs = "restore RestoreGDK.proj -PackageSaveMode nuspec -packagesDirectory `"{0}`"" -f $OutputDirectory.TrimEnd('\') +Write-Host "##[command]nuget $nugetArgs" +$nugetrun = Start-Process -PassThru -Wait -FilePath $nuget.Path -WorkingDirectory $PSScriptRoot -ArgumentList $nugetArgs -NoNewWindow +if ($nugetrun.ExitCode -gt 0) { + Write-Error "##[error]nuget restore failed" -ErrorAction Stop +} + +# Verify expected output of restore +if (-Not (Test-Path $PGDK_DIR)) { + Write-Error "##[error]Missing PC package after restore!" -ErrorAction Stop +} + +if (-Not (Test-Path $GDKX_DIR)) { + Write-Error "##[error]Missing Xbox package after restore!" -ErrorAction Stop +} + +# Reduce path depth removing version folder +$PGDK_VER = Get-ChildItem $PGDK_DIR +if ($PGDK_VER.Count -ne 1) { + Write-Error "##[error]Expected a single directory for the version!" -ErrorAction Stop +} + +$content = Get-ChildItem $PGDK_VER.Fullname +ForEach-Object -InputObject $content { Move-Item $_.Fullname -Destination $PGDK_DIR } +Remove-Item $PGDK_VER.Fullname + +$GDKX_VER = Get-ChildItem $GDKX_DIR +if ($GDKX_VER.Count -ne 1) { + Write-Error "##[error]Expected a single directory for the version!" -ErrorAction Stop +} + +$content = Get-ChildItem $GDKX_VER.Fullname +ForEach-Object -InputObject $content { Move-Item $_.Fullname -Destination $GDKX_DIR } +Remove-Item $GDKX_VER.Fullname + +Write-Host ("##[debug]PC Package ID: {0} Version: {1}" -f $PGDK_ID, $PGDK_VER) +Write-Host ("##[debug]Xbox Package ID: {0} Version: {1}" -f $GDKX_ID, $GDKX_VER) + +# Read the nuspec files +$PGDK_NUSPEC = New-Object xml +$PGDK_NUSPEC.PreserveWhitespace = $true +$PGDK_NUSPEC.Load([IO.Path]::Combine($PGDK_DIR, $PGDK_ID + ".nuspec")) + +$GDKX_NUSPEC = New-Object xml +$GDKX_NUSPEC.PreserveWhitespace = $true +$GDKX_NUSPEC.Load([IO.Path]::Combine($GDKX_DIR, $GDKX_ID + ".nuspec")) + +# Log results +Write-Host "##[group]PC Nuget Package nuspec" +Write-host $PGDK_NUSPEC.outerxml +Write-Host "##[endgroup]" + +Write-Host "##[group]Xbox Nuget Package nuspec" +Write-host $GDKX_NUSPEC.outerxml +Write-Host "##[endgroup]" + +$id = $PGDK_NUSPEC.package.metadata.id +Write-Host "##vso[task.setvariable variable=PCNuGetPackage;]$id" + +$id = $GDKX_NUSPEC.package.metadata.id +Write-Host "##vso[task.setvariable variable=XboxNuGetPackage;]$id" + +$ver = $PGDK_NUSPEC.package.metadata.version +Write-Host "##vso[task.setvariable variable=PCNuGetPackageVersion;]$ver" + +$ver = $GDKX_NUSPEC.package.metadata.version +Write-Host "##vso[task.setvariable variable=XboxNuGetPackageVersion;]$ver" diff --git a/build/SetupBWOI.cmd b/build/SetupBWOI.cmd index 64ef0d4..f50ef7e 100644 --- a/build/SetupBWOI.cmd +++ b/build/SetupBWOI.cmd @@ -13,7 +13,7 @@ goto needconsole set GXDKEDITION=%2 echo GXDKEDITION: %GXDKEDITION% -set PCNUGET=%1\Microsoft.GDK.PC.%GXDKEDITION%\ +set PCNUGET=%1\Microsoft.GDK.PC\ if NOT EXIST %PCNUGET% goto missingpcnuget set GRDKLatest=%PCNUGET%native\%GXDKEDITION%\GRDK\ @@ -21,7 +21,7 @@ echo GRDKLatest: %GRDKLatest% if %3.==PC. goto grdkonly -set XBOXNUGET=%1\Microsoft.gdk.xbox.%GXDKEDITION%\ +set XBOXNUGET=%1\Microsoft.gdk.xbox\ if NOT EXIST %XBOXNUGET% goto missingxboxnuget set GXDKLatest=%XBOXNUGET%native\%GXDKEDITION%\GXDK\ @@ -68,9 +68,9 @@ echo Usage: This script requires the target type of PC, Scarlett, or XboxOne in exit /b 1 :missingpcnuget -echo ERROR - Cannot find Microsoft.GDK.PC. installed at '%1' +echo ERROR - Cannot find Microsoft.GDK.PC installed at '%1' exit /b 1 :missingxboxnuget -echo ERROR - Cannot find Microsoft.GDK.Xbox. installed at '%1' +echo ERROR - Cannot find Microsoft.GDK.Xbox installed at '%1' exit /b 1 diff --git a/build/gdkedition.props b/build/gdkedition.props new file mode 100644 index 0000000..36ae935 --- /dev/null +++ b/build/gdkedition.props @@ -0,0 +1,6 @@ + + + + 000000 + +