Use actions/cache for vcpkg binary cache and fix Windows integration with Mesa3D (#3422)

This commit is contained in:
tdcosta100
2025-04-30 15:15:40 -03:00
committed by GitHub
parent 6491d98b63
commit ca4e02c123
17 changed files with 282 additions and 286 deletions

View File

@@ -9,7 +9,6 @@ switch ($env:RENDERER)
'opengl' { $compile_flags += '-DMLN_WITH_OPENGL=ON'; break; }
'egl' { $compile_flags += '-DMLN_WITH_EGL=ON' ; break; }
'vulkan' { $compile_flags += @('-DMLN_WITH_VULKAN=ON', '-DMLN_WITH_OPENGL=OFF'); break; }
'osmesa' { $compile_flags += '-DMLN_WITH_OSMESA=ON'; break; }
}
Write-Host 'Compile flags: ' $compile_flags

View File

@@ -277,10 +277,10 @@ jobs:
working-directory: platform/node
env:
LIBGL_ALWAYS_SOFTWARE: true
GALLIUM_DRIVER: softpipe
GALLIUM_DRIVER: llvmpipe
run: |
Invoke-WebRequest https://github.com/pal1000/mesa-dist-win/releases/download/22.3.5/mesa3d-22.3.5-release-msvc.7z -OutFile mesa3d.7z
& 'C:\Program Files\7-Zip\7z.exe' e -olib\node-v131 .\mesa3d.7z x64\opengl32.dll x64\libgallium_wgl.dll x64\libGLESv2.dll x64\libglapi.dll
(Invoke-WebRequest https://api.github.com/repos/pal1000/mesa-dist-win/releases -Headers @{ Authorization = ('Bearer {0}' -f '${{ secrets.GITHUB_TOKEN }}') } | ConvertFrom-Json)[0].assets | Where-Object name -match 'mesa3d-.+-(release|devel)-msvc\.7z' | foreach { Invoke-WebRequest $_.browser_download_url -OutFile mesa3d.7z }
& 'C:\Program Files\7-Zip\7z.exe' e -olib\node-v131 .\mesa3d.7z x64\opengl32.dll x64\libgallium_wgl.dll x64\libGLESv2.dll
npm test
# On PRs make sure that the npm package can be packaged.

View File

@@ -64,30 +64,46 @@ jobs:
with:
submodules: recursive
- uses: ilammy/msvc-dev-cmd@v1
- name: Get vcpkg commit id
run: |
$vcpkg_commit_id = ($(git submodule status .\platform\windows\vendor\vcpkg).Trim() -split ' ')[0]
Add-Content -Path $env:GITHUB_ENV -Value "VCPKG_COMMIT_ID=${vcpkg_commit_id}"
- name: Export GitHub Actions cache environment variables
uses: actions/github-script@v7
- name: Restore vcpkg binary cache
id: vcpkg-cache
uses: actions/cache/restore@v4
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
path: ${{ github.workspace }}\platform\windows\vendor\vcpkg\archives
key: vcpkg-${{ env.VCPKG_COMMIT_ID }}
lookup-only: true
- uses: ilammy/msvc-dev-cmd@v1
if: steps.vcpkg-cache.outputs.cache-hit != 'true'
- name: Acquire/Build Maplibre Native Core Dependencies
if: steps.vcpkg-cache.outputs.cache-hit != 'true'
env:
CI: 1,
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
timeout-minutes: 120
# VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
VCPKG_BINARY_SOURCES: "clear;files,${{ github.workspace }}\\platform\\windows\\vendor\\vcpkg\\archives,readwrite"
timeout-minutes: 60
run: |
& ${{ github.workspace }}\platform\windows\Get-VendorPackages.ps1 -Triplet ${{ env.VSCMD_ARG_TGT_ARCH }}-windows -Renderer All
- name: Save vcpkg binary cache
if: steps.vcpkg-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: ${{ github.workspace }}\platform\windows\vendor\vcpkg\archives
key: vcpkg-${{ env.VCPKG_COMMIT_ID }}
windows-build-and-test:
# if: needs.pre-job.outputs.should_skip != 'true'
needs: windows-get-or-build-dependencies
strategy:
matrix:
renderer: [opengl, egl, vulkan, osmesa]
renderer: [opengl, egl, vulkan]
runs-on: windows-2022
steps:
- run: |
@@ -96,7 +112,6 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
@@ -105,13 +120,6 @@ jobs:
- uses: ilammy/msvc-dev-cmd@v1
- name: Export GitHub Actions cache environment variables
uses: actions/github-script@v7
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- uses: mozilla-actions/sccache-action@v0.0.9
- name: Initialize sccache
@@ -119,16 +127,27 @@ jobs:
& $env:SCCACHE_PATH --start-server
& $env:SCCACHE_PATH --zero-stats
- name: Get vcpkg commit id
run: |
$vcpkg_commit_id = ($(git submodule status .\platform\windows\vendor\vcpkg).Trim() -split ' ')[0]
Add-Content -Path $env:GITHUB_ENV -Value "VCPKG_COMMIT_ID=${vcpkg_commit_id}"
- name: Restore vcpkg binary cache
uses: actions/cache/restore@v4
with:
path: ${{ github.workspace }}\platform\windows\vendor\vcpkg\archives
key: vcpkg-${{ env.VCPKG_COMMIT_ID }}
- name: Configure MapLibre Native Core
env:
CI: 1
VCPKG_INSTALL_OPTIONS: "--debug"
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
# VCPKG_KEEP_ENV_VARS: "CMAKE_CXX_COMPILER_LAUNCHER;CMAKE_C_COMPILER_LAUNCHER"
# VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
VCPKG_BINARY_SOURCES: "clear;files,${{ github.workspace }}\\platform\\windows\\vendor\\vcpkg\\archives,readwrite"
CMAKE_C_COMPILER_LAUNCHER: "${{ env.SCCACHE_PATH }}"
CMAKE_CXX_COMPILER_LAUNCHER: "${{ env.SCCACHE_PATH }}"
RENDERER: "${{ matrix.renderer }}"
timeout-minutes: 120
timeout-minutes: 60
run: |
cmake --version
& ${{ github.workspace }}\.github\scripts\windows-ci_configure_wrapper.ps1
@@ -145,29 +164,28 @@ jobs:
category: "/language:cpp"
- name: Download Mesa3D
if: matrix.renderer != 'egl'
run: |
Invoke-WebRequest https://github.com/pal1000/mesa-dist-win/releases/download/24.2.5/mesa3d-24.2.5-release-msvc.7z -OutFile mesa3d.7z
(Invoke-WebRequest https://api.github.com/repos/pal1000/mesa-dist-win/releases -Headers @{ Authorization = ('Bearer {0}' -f '${{ secrets.GITHUB_TOKEN }}') } | ConvertFrom-Json)[0].assets | Where-Object name -match 'mesa3d-.+-(release|devel)-msvc\.7z' | foreach { Invoke-WebRequest $_.browser_download_url -OutFile mesa3d.7z }
- name: Extract Mesa3D files for OpenGL
if: matrix.renderer != 'egl' && matrix.renderer != 'vulkan'
if: matrix.renderer != 'vulkan'
run: |
& 'C:\Program Files\7-Zip\7z.exe' e -obuild .\mesa3d.7z x64\opengl32.dll x64\libgallium_wgl.dll x64\libGLESv2.dll x64\libglapi.dll
& 'C:\Program Files\7-Zip\7z.exe' e -bb3 -obuild .\mesa3d.7z x64\opengl32.dll x64\libgallium_wgl.dll x64\libGLESv2.dll
- name: Extract Mesa3D files for EGL
if: matrix.renderer == 'egl'
run: |
& 'C:\Program Files\7-Zip\7z.exe' e -bb3 -obuild .\mesa3d.7z x64\d3d10warp.dll
- name: Extract Mesa3D files for Vulkan
if: matrix.renderer != 'egl' && matrix.renderer == 'vulkan'
if: matrix.renderer == 'vulkan'
run: |
& 'C:\Program Files\7-Zip\7z.exe' e -obuild .\mesa3d.7z x64\lvp_icd.x86_64.json x64\vulkan_lvp.dll
- name: Extract Mesa3D files for OSMesa
if: matrix.renderer == 'osmesa'
run: |
& 'C:\Program Files\7-Zip\7z.exe' e -obuild .\mesa3d.7z x64\osmesa.dll
& 'C:\Program Files\7-Zip\7z.exe' e -bb3 -obuild .\mesa3d.7z x64\lvp_icd.x86_64.json x64\vulkan_lvp.dll
# unit tests
- name: Configure Mesa3D drivers (OpenGL)
if: matrix.renderer != 'egl' && matrix.renderer != 'vulkan'
if: matrix.renderer != 'vulkan'
run: |
Add-Content -Path $env:GITHUB_ENV -Value 'GALLIUM_DRIVER=llvmpipe'
@@ -179,11 +197,16 @@ jobs:
- name: Download and configure Vulkan
if: matrix.renderer == 'vulkan'
run: |
Invoke-WebRequest https://sdk.lunarg.com/sdk/download/1.3.296.0/windows/VulkanRT-1.3.296.0-Components.zip -OutFile VulkanRT.zip
& 'C:\Program Files\7-Zip\7z.exe' e -obuild -r .\VulkanRT.zip *x64\vulkan-1.dll
$version = (Invoke-WebRequest -Uri "https://vulkan.lunarg.com/sdk/latest.json" | ConvertFrom-Json).windows
Invoke-WebRequest https://sdk.lunarg.com/sdk/download/$version/windows/VulkanRT-$version-Components.zip -OutFile VulkanRT.zip
& 'C:\Program Files\7-Zip\7z.exe' e -bb3 -obuild -r .\VulkanRT.zip *x64\vulkan-1.*
- name: Run C++ tests
continue-on-error: ${{ matrix.renderer == 'vulkan' }}
env:
ANGLE_DEFAULT_PLATFORM: 'gl'
GALLIUM_DRIVER: llvmpipe
LIBGL_ALWAYS_SOFTWARE: true
run: build/mbgl-test-runner.exe
# render tests
@@ -191,7 +214,10 @@ jobs:
- name: Run render test
id: render_test
env:
manifest_file: ${{ matrix.renderer == 'osmesa' && 'opengl' || matrix.renderer }}
manifest_file: ${{ matrix.renderer }}
ANGLE_DEFAULT_PLATFORM: 'gl'
GALLIUM_DRIVER: llvmpipe
LIBGL_ALWAYS_SOFTWARE: true
run: build/mbgl-render-test-runner.exe "--manifestPath=metrics/windows-${env:manifest_file}.json"
- name: Upload render test result
@@ -200,7 +226,7 @@ jobs:
with:
name: render-test-result-${{ matrix.renderer }}
path: |
metrics/windows-${{ matrix.renderer == 'osmesa' && 'opengl' || matrix.renderer }}.html
metrics/windows-${{ matrix.renderer }}.html
# expression tests