From e69fe212a38f8cfb4bbe0043444836ff2a382128 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20H=C3=B6glinger-Stelzer?= Date: Tue, 28 Jul 2026 01:06:19 +0200 Subject: [PATCH 1/2] Cache DMF libraries and build only the DmfU target BuildDmf previously rebuilt the entire Dmf.sln (including unused kernel-mode projects) on every CI run. Target only DmfU, which is what the UMDF driver links, and cache DMF/Release/ keyed on the submodule commit plus runner ImageVersion so warm jobs can --skip BuildDmf. Co-authored-by: Cursor --- .github/workflows/build.yml | 22 +++++++++++++++++++++- build/Build.cs | 7 +++++-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index be49daba..7953d878 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -112,9 +112,29 @@ jobs: dotnet restore .\ControlApp\ dotnet restore .\ipctest\ + # DMF output is fully determined by the submodule commit and the runner toolchain. + # Skip the build entirely on a cache hit (x86 never builds DMF). No restore-keys: a + # partial match must never reuse libs built for a different commit or image. + - name: 'Resolve DMF submodule commit' + if: matrix.platform != 'x86' + id: dmf-sha + shell: pwsh + run: | + $sha = git rev-parse HEAD:DMF + echo "sha=$sha" >> $env:GITHUB_OUTPUT + Write-Output "DMF submodule commit $sha" + + - name: 'Cache DMF libraries' + if: matrix.platform != 'x86' + id: dmf-cache + uses: actions/cache@v4 + with: + path: DMF/Release/${{ matrix.platform }} + key: dmf-v1-${{ matrix.platform }}-${{ steps.dmf-sha.outputs.sha }}-${{ env.ImageVersion }} + - name: 'Build' shell: cmd - run: .\build.cmd --target-platform ${{ matrix.platform }} + run: .\build.cmd --target-platform ${{ matrix.platform }} ${{ steps.dmf-cache.outputs.cache-hit == 'true' && '--skip BuildDmf' || '' }} - name: 'Publish ControlApp' if: matrix.platform == 'x64' diff --git a/build/Build.cs b/build/Build.cs index 1a3dc6c5..e3c15f6f 100644 --- a/build/Build.cs +++ b/build/Build.cs @@ -131,10 +131,13 @@ void InvokeSignTool(string arguments) foreach ((Configuration config, MSBuildTargetPlatform platform) in buildCombinations) { - Log.Information("Building DMF {Configuration} | {Platform}", config, platform); + // dshidmini is UMDF and links only DmfU.lib; skip the kernel-mode half of Dmf.sln. + // MSBuild resolves "DmfU" as a solution-level target and pulls in its dependencies + // (DmfUFramework, DmfUModules.Library, DmfUModules.Template, DmfUModules.Library.Tests). + Log.Information("Building DMF DmfU {Configuration} | {Platform}", config, platform); MSBuildTasks.MSBuild(s => s .SetTargetPath(DmfSolution) - .SetTargets("Build") + .SetTargets("DmfU") .SetConfiguration(config) .SetTargetPlatform(platform) .SetMaxCpuCount(Environment.ProcessorCount) From 4deb75ff685c789c91ed37acd2a504ebe46d63b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20H=C3=B6glinger-Stelzer?= Date: Tue, 28 Jul 2026 01:14:34 +0200 Subject: [PATCH 2/2] Fix DMF cache key to capture runner ImageVersion ${{ env.ImageVersion }} reads the Actions env context, which does not include runner process variables, so the key ended with an empty suffix. Capture $env:ImageVersion in the resolve step instead. Co-authored-by: Cursor --- .github/workflows/build.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7953d878..6d37e410 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -120,9 +120,13 @@ jobs: id: dmf-sha shell: pwsh run: | + # ImageVersion is a runner process env var, not an Actions `env:` context value, + # so capture it here for the cache key (invalidates on toolchain image upgrades). $sha = git rev-parse HEAD:DMF + $imageVersion = $env:ImageVersion echo "sha=$sha" >> $env:GITHUB_OUTPUT - Write-Output "DMF submodule commit $sha" + echo "image-version=$imageVersion" >> $env:GITHUB_OUTPUT + Write-Output "DMF submodule commit $sha (ImageVersion=$imageVersion)" - name: 'Cache DMF libraries' if: matrix.platform != 'x86' @@ -130,7 +134,7 @@ jobs: uses: actions/cache@v4 with: path: DMF/Release/${{ matrix.platform }} - key: dmf-v1-${{ matrix.platform }}-${{ steps.dmf-sha.outputs.sha }}-${{ env.ImageVersion }} + key: dmf-v1-${{ matrix.platform }}-${{ steps.dmf-sha.outputs.sha }}-${{ steps.dmf-sha.outputs.image-version }} - name: 'Build' shell: cmd