Skip to content

Commit 5d05f81

Browse files
authored
ci: Migrate a lot to GitHub Actions. (#356)
1 parent 3045ea4 commit 5d05f81

18 files changed

+519
-133
lines changed

.azure-pipelines/nuget/stage_nuget.ps1

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,17 @@ Copy-Item (Join-Path $SDKRelease "include") (Join-Path $NugetStaging "include")
5555
#
5656
function CopyLoader($Platform) {
5757
$PlatformSDKPath = Join-Path $SDKRelease "$Platform"
58-
$NuGetPlatformPath = Join-Path $NugetStaging "native/$Platform/release"
58+
if (Test-Path $PlatformSDKPath) {
59+
$NuGetPlatformPath = Join-Path $NugetStaging "native/$Platform/release"
5960

60-
$NugetLibPath = Join-Path $NuGetPlatformPath "lib"
61-
New-Item $NugetLibPath -ItemType "directory" -Force
62-
Copy-Item (Join-Path $PlatformSDKPath "lib/openxr_loader.lib") $NugetLibPath
61+
$NugetLibPath = Join-Path $NuGetPlatformPath "lib"
62+
New-Item $NugetLibPath -ItemType "directory" -Force
63+
Copy-Item (Join-Path $PlatformSDKPath "lib/openxr_loader.lib") $NugetLibPath
6364

64-
$NugetBinPath = Join-Path $NuGetPlatformPath "bin"
65-
New-Item $NugetBinPath -ItemType "directory" -Force
66-
Copy-Item (Join-Path $PlatformSDKPath "bin/openxr_loader.dll") $NugetBinPath
65+
$NugetBinPath = Join-Path $NuGetPlatformPath "bin"
66+
New-Item $NugetBinPath -ItemType "directory" -Force
67+
Copy-Item (Join-Path $PlatformSDKPath "bin/openxr_loader.dll") $NugetBinPath
68+
}
6769
}
6870

6971
# Currently there are no non-UWP ARM/ARM64 binaries available from the SDK release.

.github/scripts/CMakePresets.json

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
{
2+
"version": 3,
3+
"cmakeMinimumRequired": {
4+
"major": 3,
5+
"minor": 21,
6+
"patch": 0
7+
},
8+
"configurePresets": [
9+
{
10+
"name": ".base-msvc",
11+
"generator": "Visual Studio 17 2022",
12+
"hidden": true,
13+
"installDir": "$env{INSTALL_DIR}",
14+
"cacheVariables": {
15+
"DYNAMIC_LOADER": true,
16+
"INSTALL_TO_ARCHITECTURE_PREFIXES": true,
17+
"BUILD_ALL_EXTENSIONS": true
18+
},
19+
"condition": {
20+
"type": "equals",
21+
"lhs": "${hostSystemName}",
22+
"rhs": "Windows"
23+
}
24+
},
25+
{
26+
"name": "win32",
27+
"inherits": ".base-msvc",
28+
"architecture": "Win32"
29+
},
30+
{
31+
"name": "win32_uwp",
32+
"inherits": "win32",
33+
"cacheVariables": {
34+
"CMAKE_SYSTEM_NAME": "WindowsStore",
35+
"CMAKE_SYSTEM_VERSION": "10.0"
36+
}
37+
},
38+
{
39+
"name": "x64",
40+
"inherits": ".base-msvc",
41+
"architecture": "x64"
42+
},
43+
{
44+
"name": "x64_uwp",
45+
"inherits": "x64",
46+
"cacheVariables": {
47+
"CMAKE_SYSTEM_NAME": "WindowsStore",
48+
"CMAKE_SYSTEM_VERSION": "10.0"
49+
}
50+
},
51+
{
52+
"name": "arm_uwp",
53+
"inherits": ".base-msvc",
54+
"architecture": "ARM",
55+
"cacheVariables": {
56+
"CMAKE_SYSTEM_NAME": "WindowsStore",
57+
"CMAKE_SYSTEM_VERSION": "10.0"
58+
}
59+
},
60+
{
61+
"name": "arm64_uwp",
62+
"inherits": ".base-msvc",
63+
"architecture": "ARM64",
64+
"cacheVariables": {
65+
"CMAKE_SYSTEM_NAME": "WindowsStore",
66+
"CMAKE_SYSTEM_VERSION": "10.0"
67+
}
68+
}
69+
]
70+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
SPDX-FileCopyrightText: 2022 Collabora, Ltd
2+
SPDX-License-Identifier: CC0-1.0
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env python3
2+
# Copyright (c) 2019 The Khronos Group Inc.
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
from itertools import product
6+
import sys
7+
8+
from shared import BUILD_CONFIGS, output_json
9+
10+
if __name__ == "__main__":
11+
12+
matrix = {"include": [{"preset": c.preset()} for c in BUILD_CONFIGS]}
13+
var_name = None
14+
if len(sys.argv) >= 2:
15+
var_name = sys.argv[1]
16+
output_json(matrix, variable_name=var_name)

.github/scripts/install_vulkan.ps1

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Copyright (c) 2019-2022 The Khronos Group Inc.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
$ErrorActionPreference = 'Stop'
5+
6+
if (-not $env:VULKAN_SDK_VERSION) {
7+
$env:VULKAN_SDK_VERSION = "1.1.114.0"
8+
}
9+
10+
$SDK_VER = $env:VULKAN_SDK_VERSION
11+
12+
if (-not (Test-Path env:VULKAN_SDK)) {
13+
if ($env:SYSTEM_DEFAULTWORKINGDIRECTORY) {
14+
$env:VULKAN_SDK = "$env:SYSTEM_DEFAULTWORKINGDIRECTORY\vulkan_sdk\$SDK_VER"
15+
}
16+
else {
17+
$env:VULKAN_SDK = Join-Path (Get-Location) "VulkanSDK\$SDK_VER"
18+
}
19+
}
20+
$parent = Split-Path -Path $env:VULKAN_SDK
21+
Write-Output "Trying for Vulkan SDK $SDK_VER"
22+
$FN = "vksdk-$SDK_VER-lite.7z"
23+
$URL = "https://people.collabora.com/~rpavlik/ci_resources/$FN"
24+
if (-not (Test-Path "$env:VULKAN_SDK/Include/vulkan/vulkan.h")) {
25+
Write-Output "Downloading $URL"
26+
$wc = New-Object System.Net.WebClient
27+
$wc.DownloadFile($URL, "$(Get-Location)\$FN")
28+
29+
Write-Output "Extracting $FN in silent, blocking mode to $env:VULKAN_SDK"
30+
Start-Process "c:\Program Files\7-Zip\7z" -ArgumentList "x", $FN, "-o$parent" -Wait
31+
}
32+
else {
33+
Write-Output "$env:VULKAN_SDK found and contains header"
34+
}
35+
36+
Write-Output "VULKAN_SDK=$env:VULKAN_SDK" >> $env:GITHUB_ENV
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/usr/bin/env python3
2+
# Copyright (c) 2019-2022 The Khronos Group Inc.
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
from pathlib import Path
6+
import shutil
7+
import sys
8+
9+
from shared import BUILD_CONFIGS
10+
11+
CWD = Path.cwd()
12+
13+
def move(src, dest):
14+
15+
print(str(src), "->", str(dest))
16+
src.replace(dest)
17+
18+
19+
if __name__ == "__main__":
20+
21+
configs = {}
22+
workspace = Path(sys.argv[1])
23+
outbase = Path(sys.argv[2])
24+
25+
common_copied = False
26+
27+
for config in BUILD_CONFIGS:
28+
platform_dirname = config.platform_dirname()
29+
30+
name = config.win_artifact_name()
31+
32+
artifact = workspace / "artifacts" / name
33+
34+
if not common_copied:
35+
# Start by copying the full tree over.
36+
shutil.copytree(artifact, outbase, dirs_exist_ok=True)
37+
common_copied = True
38+
continue
39+
40+
# lib files
41+
shutil.copytree(
42+
artifact / platform_dirname, outbase / platform_dirname, dirs_exist_ok=True
43+
)

.github/scripts/shared.py

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Copyright (c) 2019 The Khronos Group Inc.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
import json
5+
import sys
6+
from dataclasses import dataclass
7+
from itertools import product
8+
9+
VS_VERSION = "Visual Studio 17 2022"
10+
11+
PLATFORMS = ("Win32", "x64", "ARM", "ARM64")
12+
13+
TRUE_FALSE = (True, False)
14+
15+
16+
@dataclass
17+
class BuildConfig:
18+
arch: str
19+
uwp: bool
20+
21+
def should_skip(self) -> bool:
22+
# ARM/ARM64 is only built for the UWP platform.
23+
return "ARM" in self.arch and not self.uwp
24+
25+
# can switch to just doing x64 for speed of testing
26+
# return self.arch != "x64"
27+
28+
def preset(self) -> str:
29+
if self.uwp:
30+
return f"{self.arch.lower()}_uwp"
31+
32+
return self.arch.lower()
33+
34+
def win_artifact_name(self) -> str:
35+
return f"loader_{self.preset()}"
36+
37+
def platform_dirname(self) -> str:
38+
if self.uwp:
39+
return f"{self.arch}_uwp"
40+
return self.arch
41+
42+
43+
_UNFILTERED_BUILD_CONFIGS = [
44+
BuildConfig(arch, uwp) for arch, uwp in product(PLATFORMS, TRUE_FALSE)
45+
]
46+
47+
BUILD_CONFIGS = [c for c in _UNFILTERED_BUILD_CONFIGS if not c.should_skip()]
48+
49+
50+
def output_json(data, variable_name=None):
51+
if variable_name:
52+
print(f"::set-output name={variable_name}::{json.dumps(data)}")
53+
else:
54+
print(json.dumps(data, indent=4))

.github/workflows/android-OpenXR-loader.yml

Lines changed: 0 additions & 30 deletions
This file was deleted.

.github/workflows/android-helloxr-ci.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.

.github/workflows/android-snapshot.yml

Lines changed: 0 additions & 40 deletions
This file was deleted.

0 commit comments

Comments
 (0)