diff --git a/.github/workflows/call-build-images.yaml b/.github/workflows/call-build-images.yaml index 8608d58a50b..9b3c1a6b929 100644 --- a/.github/workflows/call-build-images.yaml +++ b/.github/workflows/call-build-images.yaml @@ -413,6 +413,26 @@ jobs: username: ${{ inputs.username }} password: ${{ secrets.token }} + # https://github.com/actions/runner-images/issues/12199 + # https://github.com/moby/moby/issues/48093 + # https://support.microsoft.com/en-us/topic/gettemppath-changes-in-windows-february-cumulative-update-preview-4cc631fb-9d97-4118-ab6d-f643cd0a7259#ID0EDF + - name: Change system temp directory to the drive having sufficient disk space + id: relocate-system-temp-dir + run: | + $ErrorActionPreference = "Stop" + if (Test-Path -Path "D:\") { + $newSystemTempDir = "D:\SystemTemp" + New-Item -ItemType Directory -Path "${newSystemTempDir}" -Force + $acl = New-Object System.Security.AccessControl.DirectorySecurity + $acl.SetSecurityDescriptorSddlForm("O:SYG:SYD:PAI(A;OICI;FA;;;SY)(A;OICI;FA;;;BA)") + Set-Acl "${newSystemTempDir}" -AclObject ${acl} + [Environment]::SetEnvironmentVariable("SYSTEMTEMP", "${newSystemTempDir}", [EnvironmentVariableTarget]::Machine) + Restart-Service docker + } else { + Write-Warning "Drive D doesn't exist, so there is no disk to relocate system temp directory" + } + shell: pwsh + - name: Pull the last release image to speed up the build with a cache continue-on-error: true run: | diff --git a/.github/workflows/pr-image-tests.yaml b/.github/workflows/pr-image-tests.yaml index fff17f4a2c2..987e488b788 100644 --- a/.github/workflows/pr-image-tests.yaml +++ b/.github/workflows/pr-image-tests.yaml @@ -108,6 +108,26 @@ jobs: flavor: | suffix=-windows-${{ matrix.windows-base-version }} + # https://github.com/actions/runner-images/issues/12199 + # https://github.com/moby/moby/issues/48093 + # https://support.microsoft.com/en-us/topic/gettemppath-changes-in-windows-february-cumulative-update-preview-4cc631fb-9d97-4118-ab6d-f643cd0a7259#ID0EDF + - name: Change system temp directory to the drive having sufficient disk space + id: relocate-system-temp-dir + run: | + $ErrorActionPreference = "Stop" + if (Test-Path -Path "D:\") { + $newSystemTempDir = "D:\SystemTemp" + New-Item -ItemType Directory -Path "${newSystemTempDir}" -Force + $acl = New-Object System.Security.AccessControl.DirectorySecurity + $acl.SetSecurityDescriptorSddlForm("O:SYG:SYD:PAI(A;OICI;FA;;;SY)(A;OICI;FA;;;BA)") + Set-Acl "${newSystemTempDir}" -AclObject ${acl} + [Environment]::SetEnvironmentVariable("SYSTEMTEMP", "${newSystemTempDir}", [EnvironmentVariableTarget]::Machine) + Restart-Service docker + } else { + Write-Warning "Drive D doesn't exist, so there is no disk to relocate system temp directory" + } + shell: pwsh + - name: Build the windows images id: build run: | diff --git a/dockerfiles/Dockerfile.windows b/dockerfiles/Dockerfile.windows index 8a380660ace..52c5e11143d 100644 --- a/dockerfiles/Dockerfile.windows +++ b/dockerfiles/Dockerfile.windows @@ -47,10 +47,7 @@ RUN $msvs_build_tools_dist_name=\"vs_buildtools.exe\"; ` \"--channelUri ${msvs_build_tools_channel}\", ` \"--installChannelUri ${msvs_build_tools_channel}\", ` '--add Microsoft.VisualStudio.Workload.VCTools', ` - '--add Microsoft.VisualStudio.Workload.MSBuildTools', ` '--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64', ` - '--add Microsoft.VisualStudio.Component.VC.CoreBuildTools', ` - '--add Microsoft.VisualStudio.Component.VC.MSVC.143', ` '--add Microsoft.VisualStudio.Component.Windows10SDK.19041' ` -NoNewWindow -Wait -PassThru; ` if (${p}.ExitCode -ne 0 -and ${p}.ExitCode -ne 3010) { ` @@ -94,6 +91,26 @@ RUN if ([System.Version] \"${env:CMAKE_VERSION}\" -ge [System.Version] \"3.20.0\ Write-Host \"${env:PATH}\"; ` [Environment]::SetEnvironmentVariable(\"PATH\", \"${env:PATH}\", [EnvironmentVariableTarget]::Machine); +ENV NINJA_HOME="C:\ninja" +ARG NINJA_VERSION="1.13.2" +ARG NINJA_URL="https://github.com/ninja-build/ninja/releases/download" + +RUN $ninja_dist_name=\"ninja-win.zip\"; ` + $ninja_dist=\"${env:TMP}\${ninja_dist_name}\"; ` + $ninja_download_url=\"${env:NINJA_URL}/v${env:NINJA_VERSION}/${ninja_dist_name}\"; ` + Write-Host \"Downloading Ninja...\"; ` + Write-Host \"${ninja_download_url} -> ${ninja_dist}\"; ` + Invoke-WebRequest -OutFile \"${ninja_dist}\" \"${ninja_download_url}\"; ` + New-Item -Path \"${env:NINJA_HOME}\" -ItemType \"directory\"; ` + Write-Host \"Extracting Ninja...\"; ` + Write-Host \"${ninja_dist} -> ${env:NINJA_HOME}\"; ` + Expand-Archive \"${ninja_dist}\" -Destination \"${env:NINJA_HOME}\"; ` + Remove-Item -Force \"${ninja_dist}\"; ` + $env:PATH=\"${env:PATH};${env:NINJA_HOME}\"; ` + Write-Host \"Setting PATH...\"; ` + Write-Host \"${env:PATH}\"; ` + [Environment]::SetEnvironmentVariable(\"PATH\", \"${env:PATH}\", [EnvironmentVariableTarget]::Machine); + ENV WIN_FLEX_BISON_VERSION="2.5.22" ` WIN_FLEX_BISON_HOME="C:\WinFlexBison" ` WIN_FLEX_BISON_DOWNLOAD_URL="https://github.com/lexxmark/winflexbison/releases/download" @@ -181,7 +198,7 @@ COPY . /src/ ARG BUILD_PARALLEL=1 SHELL ["cmd", "/S", "/C"] RUN call "%MSVS_HOME%\VC\Auxiliary\Build\vcvars64.bat" && ` - cmake -G "NMake Makefiles" ` + cmake -G "Ninja" ` -DOPENSSL_ROOT_DIR='C:\dev\vcpkg\packages\openssl_x64-windows-static' ` -DFLB_LIBYAML_DIR='C:\dev\vcpkg\packages\libyaml_x64-windows-static' ` -DFLB_SIMD=On ` @@ -191,7 +208,7 @@ RUN call "%MSVS_HOME%\VC\Auxiliary\Build\vcvars64.bat" && ` -DFLB_DEBUG=Off ` -DFLB_RELEASE=On ` ..\ && ` - cmake --build . --config Release -j "%BUILD_PARALLEL%" + cmake --build . -j "%BUILD_PARALLEL%" SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]