Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Windows to CI tests #2968

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Avoid line conversions between Unix (LF) and Windows (CRLF)

test/fixtures/storage/assets/* binary
2 changes: 1 addition & 1 deletion .github/actions/qt5-build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ghcr.io/maplibre/linux-builder:centos7-gcc11-cmake3.19
FROM ghcr.io/maplibre/linux-builder:centos7-gcc11-cmake3.24

# Copy and set the entry point
COPY entrypoint.sh /entrypoint.sh
Expand Down
17 changes: 17 additions & 0 deletions .github/changed-files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,23 @@ linux:
- 'BUILD.bazel'
- '.bazelrc'
- '.bazelversion'
windows:
- '.github/workflows/windows-ci.yml'
- 'src/**'
- 'include/**'
- 'platform/default/**'
- 'platform/windows/**'
- 'expression-test/**'
- 'render-test/**'
- 'test/**'
- 'metrics/**'
- 'vendor/**'
- '.gitmodules'
- '!**/*.md'
- 'WORKSPACE'
- 'BUILD.bazel'
- '.bazelrc'
- '.bazelversion'
ios:
- 'platform/ios/**'
- 'platform/darwin/**'
Expand Down
23 changes: 23 additions & 0 deletions .github/scripts/windows-ci_configure_wrapper.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
$compile_flags = @(
'-DCMAKE_POLICY_DEFAULT_CMP0141=NEW',
'-DCMAKE_MSVC_DEBUG_INFORMATION_FORMAT=Embedded',
'-DCMAKE_BUILD_TYPE=RelWithDebInfo'
)

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; }
}

switch ($env:RENDERING_MODE)
{
'legacy' { $compile_flags += '-DMLN_LEGACY_RENDERER=ON' ; break; }
'drawable' { $compile_flags += '-DMLN_DRAWABLE_RENDERER=ON'; break; }
}

Write-Host 'Compile flags: ' $compile_flags

& cmake -B build -G Ninja $($compile_flags)
194 changes: 194 additions & 0 deletions .github/workflows/windows-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
name: windows-ci

on:
workflow_dispatch:
push:
branches:
- main
- windows-*.*.x
tags:
- windows-*

pull_request:
branches:
- '*'

env:
SCCACHE_GHA_ENABLED: "true"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
# INFO: We are cancelling the concurrency group if the change is on PR. For workflow dispatch, this will not work.
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

permissions:
actions: read # needed for CodeQL
contents: read # needed for CodeQL
security-events: write # needed for CodeQL

jobs:
pre-job:
runs-on: windows-2022
outputs:
should_skip: ${{ github.event_name != 'workflow_dispatch' && steps.changed-files.outputs.windows_any_modified != 'true' }}
steps:
- run: |
git config --system core.longpaths true
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Get all Windows files that have changed
if: github.event_name != 'workflow_dispatch'
id: changed-files
uses: tj-actions/changed-files@v45
with:
files_yaml_from_source_file: .github/changed-files.yml

- name: List changed files
if: steps.changed-files.outputs.windows_any_modified == 'true'
run: |
Write-Host "Changed file(s): ${{ steps.changed-files.outputs.windows_all_changed_files }}"
windows-build-and-test:
if: needs.pre-job.outputs.should_skip != 'true'
needs: pre-job
strategy:
matrix:
renderer: [opengl, egl, vulkan, osmesa]
rendering_mode: [legacy, drawable]
exclude:
- renderer: egl
rendering_mode: drawable
- renderer: vulkan
rendering_mode: legacy
runs-on: windows-2022
steps:
- run: |
git config --system core.longpaths true
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0

- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: cpp

- 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/[email protected]

- name: Initialize sccache
run: |
& $env:SCCACHE_PATH --start-server
& $env:SCCACHE_PATH --zero-stats
- name: Configure MapLibre Native Core
env:
CI: 1
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
VCPKG_KEEP_ENV_VARS: "CMAKE_CXX_COMPILER_LAUNCHER;CMAKE_C_COMPILER_LAUNCHER"
CMAKE_C_COMPILER_LAUNCHER: "${{ env.SCCACHE_PATH }}"
CMAKE_CXX_COMPILER_LAUNCHER: "${{ env.SCCACHE_PATH }}"
RENDERER: "${{ matrix.renderer }}"
RENDERING_MODE: "${{ matrix.rendering_mode }}"
run: |
tdcosta100 marked this conversation as resolved.
Show resolved Hide resolved
cmake --version
& ${{ github.workspace }}\.github\scripts\windows-ci_configure_wrapper.ps1
- name: Build MapLibre Native Core
run: |
cmake --build build --target mbgl-core mbgl-test-runner mbgl-render-test-runner mbgl-expression-test mbgl-render mbgl-benchmark-runner
# CodeQL

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
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
- name: Extract Mesa3D files for OpenGL
if: matrix.renderer != 'egl' && 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
- name: Extract Mesa3D files for Vulkan
if: matrix.renderer != 'egl' && 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
# unit tests

- name: Configure Mesa3D drivers (OpenGL)
if: matrix.renderer != 'egl' && matrix.renderer != 'vulkan'
run: |
Add-Content -Path $env:GITHUB_ENV -Value 'GALLIUM_DRIVER=llvmpipe'
- name: Configure Mesa3D drivers (Vulkan)
if: matrix.renderer == 'vulkan'
run: |
reg add 'HKLM\Software\Khronos\Vulkan\Drivers' /f /v '${{ github.workspace }}\build\lvp_icd.x86_64.json' /t REG_DWORD /d 0
- 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
- name: Run C++ tests
continue-on-error: ${{ matrix.renderer == 'vulkan' }}
run: build/mbgl-test-runner.exe

# render tests

- name: Run render test
id: render_test
env:
manifest_file: ${{ matrix.renderer == 'osmesa' && 'opengl' || matrix.renderer }}
run: build/mbgl-render-test-runner.exe "--manifestPath=metrics/windows-${env:manifest_file}.json"

- name: Upload render test result
if: always() && steps.render_test.outcome == 'failure'
uses: actions/upload-artifact@v4
with:
name: render-test-result-${{ matrix.renderer }}
path: |
metrics/windows-${{ matrix.renderer == 'osmesa' && 'opengl' || matrix.renderer }}.html
# expression tests

- name: Run expression test
run: build/expression-test/mbgl-expression-test.exe

windows-ci-result:
name: Windows CI Result
if: needs.pre-job.outputs.should_skip != 'true' && always()
runs-on: windows-2022
needs:
- pre-job
- windows-build-and-test
steps:
- name: Mark result as failed
if: needs.windows-build-and-test.result != 'success'
run: exit 1
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.19 FATAL_ERROR)
cmake_minimum_required(VERSION 3.24 FATAL_ERROR)

option(MLN_WITH_CORE_ONLY "Build only the core bits, no platform code" OFF)
option(MLN_WITH_CLANG_TIDY "Build with clang-tidy checks enabled" OFF)
Expand Down
2 changes: 1 addition & 1 deletion expression-test/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ int main(int argc, char** argv) try {

bool shouldIgnore = false;
std::string ignoreReason;
const std::string ignoreName = "expression-tests/" + id;
const std::filesystem::path ignoreName("expression-tests/" + id);
const auto it = std::find_if(
ignores.cbegin(), ignores.cend(), [&ignoreName](const auto& ignore) { return ignore.id == ignoreName; });
if (it != ignores.end()) {
Expand Down
14 changes: 14 additions & 0 deletions metrics/ignores/windows-egl.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"render-tests/circle-sort-key/literal": "Needs investigation (Diff: 0.034423828125)",
"render-tests/map-mode/tile-avoid-edges": "Needs investigation (Diff: 0.008159637451171875)",
"render-tests/regressions/mapbox-gl-js#2534": "Needs investigation (Diff: 0.000301361083984375)",
"render-tests/regressions/mapbox-gl-js#7066": "Needs investigation (Diff: 0.0002777777777777778)",
"render-tests/symbol-placement/line-center-buffer-tile-map-mode": "Needs investigation (Diff: 0.0058155059814453125)",
"render-tests/symbol-placement/line-center-tile-map-mode": "Needs investigation (Diff: 0.005688667297363281)",
"render-tests/text-variable-anchor/all-anchors-tile-map-mode": "Needs investigation (Diff: 0.011456489562988281)",
"render-tests/text-variable-anchor/left-top-right-bottom-offset-tile-map-mode": "Needs investigation (Diff: 0.012059211730957031)",
"render-tests/within/layout-text": "Needs investigation (Diff: 0.000244140625)",
"render-tests/within/paint-circle": "Needs investigation (Diff: 0.000244140625)",
"render-tests/within/paint-icon": "Needs investigation (Diff: 0.000244140625)",
"render-tests/within/paint-text": "Needs investigation (Diff: 0.000244140625)"
}
9 changes: 9 additions & 0 deletions metrics/ignores/windows-opengl.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"render-tests/line-pattern/overscaled": "Needs investigation (Diff: 0.0089111328125)",
"render-tests/regressions/mapbox-gl-js#5642": "Needs investigation (Diff: 0.013671875)",
"render-tests/regressions/mapbox-gl-js#7066": "Needs investigation (Diff: 0.00024305555555555555)",
"render-tests/regressions/mapbox-gl-native#9976": "Needs investigation (Diff: 0.00769805908203125 in Legacy, 0.00756072998046875 in Drawable)",
"render-tests/runtime-styling/image-add-pattern": "Needs investigation (Diff: 0.001953125)",
"render-tests/runtime-styling/image-update-pattern": "Needs investigation (Diff: 0.001953125)",
"render-tests/sprites/2x-screen-2x-pattern": "Needs investigation (Diff: 0.00042724609375)"
}
6 changes: 6 additions & 0 deletions metrics/ignores/windows-vulkan.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"render-tests/fill-extrusion-color/function": "Needs investigation (Diff: 0.0014495849609375)",
"render-tests/icon-text-fit/enlargen-both": "Needs investigation (Diff: 0.0059814453125)",
"render-tests/regressions/mapbox-gl-js#5642": "Needs investigation (Diff: 0.01416015625)",
"render-tests/regressions/mapbox-gl-js#7066": "Needs investigation (Diff: 0.0002777777777777778)"
}
15 changes: 15 additions & 0 deletions metrics/windows-egl.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"base_test_path": "integration",
"cache_path": "cache-style.db",
"expectation_paths": [
],
"ignore_paths": [
"ignores/platform-all.json",
"ignores/windows-egl.json"
],
"metric_path": "windows-msvc-release",
"probes": [
"probeGFX",
"probeNetwork"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"network": [
[
"probeNetwork - default - end",
0,
0
],
[
"probeNetwork - default - start",
0,
0
]
],
"gfx": [
[
"probeGFX - default - end",
0,
5,
5,
1,
[
65536,
65536
],
[
22,
22
],
[
64,
64
]
]
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"network": [
[
"probeNetwork - default - end",
0,
0
],
[
"probeNetwork - default - start",
0,
0
]
],
"gfx": [
[
"probeGFX - default - end",
0,
2,
5,
1,
[
16384,
16384
],
[
22,
22
],
[
64,
64
]
]
]
}
Loading
Loading