-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from JuliaGPU/try-ci
Add basic Github Actions CI support
- Loading branch information
Showing
10 changed files
with
533 additions
and
211 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
# Based on https://github.com/vsg-dev/VulkanSceneGraph/blob/master/.github/workflows/ci.yml | ||
name: CI | ||
on: | ||
push: | ||
pull_request: | ||
env: | ||
JuliaVersion: 1.5 | ||
VulkanSDKVersion: 1.2.148.1 | ||
JULIA_GITHUB_ACTIONS_CI: ON | ||
jobs: | ||
ubuntu-latest-x64: | ||
runs-on: ubuntu-latest | ||
env: | ||
VULKAN_SDK: $GITHUB_WORKSPACE/../$VulkanSDKVersion/x86_64 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Download & Extract Vulkan SDK | ||
run: | | ||
wget --no-cookies -O ../vulkansdk-linux-x86_64-${{env.VulkanSDKVersion}}.tar.gz https://sdk.lunarg.com/sdk/download/${{env.VulkanSDKVersion}}/linux/vulkansdk-linux-x86_64-${{env.VulkanSDKVersion}}.tar.gz?u= | ||
tar -zxf ../vulkansdk-linux-x86_64-${{env.VulkanSDKVersion}}.tar.gz -C ../ | ||
- name: Install xvfb for GLFW | ||
run: sudo apt-get install xvfb && Xvfb :99 & | ||
- uses: julia-actions/setup-julia@v1 | ||
with: | ||
version: ${{env.JuliaVersion}} | ||
arch: x64 | ||
- uses: julia-actions/julia-buildpkg@latest | ||
- uses: julia-actions/julia-runtest@latest | ||
env: | ||
DISPLAY: :99 | ||
- uses: julia-actions/julia-uploadcodecov@latest | ||
env: | ||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | ||
|
||
windows-latest-x64: | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set Environment variables | ||
run: echo "::set-env name=VULKAN_SDK::C:\VulkanSDK\${{env.VulkanSDKVersion}}" | ||
- name: Download & Install Vulkan SDK | ||
run: | | ||
Invoke-WebRequest -Uri https://sdk.lunarg.com/sdk/download/${{env.VulkanSDKVersion}}/windows/VulkanSDK-${{env.VulkanSDKVersion}}-Installer.exe?u= -OutFile ../vulkan-sdk-${{env.VulkanSDKVersion}}.exe | ||
$installer = Start-Process -FilePath ../vulkan-sdk-${{env.VulkanSDKVersion}}.exe -Wait -PassThru -ArgumentList @("/S"); | ||
$installer.WaitForExit(); | ||
Invoke-WebRequest -Uri https://sdk.lunarg.com/sdk/download/latest/windows/vulkan-runtime.exe -OutFile ../vulkan-runtime.exe | ||
$installer = Start-Process -FilePath ../vulkan-runtime.exe -Wait -PassThru -ArgumentList @("/S"); | ||
$installer.WaitForExit(); | ||
- uses: julia-actions/setup-julia@v1 | ||
with: | ||
version: ${{env.JuliaVersion}} | ||
arch: x64 | ||
- uses: julia-actions/julia-buildpkg@latest | ||
- uses: julia-actions/julia-runtest@latest | ||
env: | ||
DISPLAY: :99 | ||
- uses: julia-actions/julia-uploadcodecov@latest | ||
env: | ||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | ||
|
||
macos-latest-x64: | ||
runs-on: macos-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set Environment variables | ||
run: | | ||
VULKAN_SDK=$GITHUB_WORKSPACE/../vulkansdk-macos-${{env.VulkanSDKVersion}}/macOS | ||
echo ::set-env name=VULKAN_SDK::$VULKAN_SDK | ||
echo ::set-env name=JULIA_VULKAN_SDK_SEARCH_PATH::$VULKAN_SDK/lib | ||
echo ::set-env name=VK_LAYER_PATH::$VULKAN_SDK/share/vulkan/explicit_layer.d | ||
echo ::set-env name=VK_ICD_FILENAMES::$VULKAN_SDK/share/vulkan/icd.d/MoltenVK_icd.json | ||
- name: Download & Extract Vulkan SDK | ||
run: | | ||
wget --no-cookies -O ../vulkansdk-macos-${{env.VulkanSDKVersion}}.dmg https://sdk.lunarg.com/sdk/download/${{env.VulkanSDKVersion}}/mac/vulkansdk-macos-${{env.VulkanSDKVersion}}.dmg?u= | ||
hdiutil attach ../vulkansdk-macos-${{env.VulkanSDKVersion}}.dmg | ||
cp -r /Volumes/vulkansdk-macos-${{env.VulkanSDKVersion}} ../ | ||
hdiutil detach /Volumes/vulkansdk-macos-${{env.VulkanSDKVersion}} | ||
- uses: julia-actions/setup-julia@v1 | ||
with: | ||
version: ${{env.JuliaVersion}} | ||
arch: x64 | ||
- uses: julia-actions/julia-buildpkg@latest | ||
- uses: julia-actions/julia-runtest@latest | ||
env: | ||
DISPLAY: :99 | ||
- uses: julia-actions/julia-uploadcodecov@latest | ||
env: | ||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,48 @@ | ||
using GLFW | ||
using VulkanCore | ||
using VulkanCore.LibVulkan | ||
|
||
@assert GLFW.VulkanSupported() | ||
|
||
include("vkhelper.jl") | ||
|
||
const WIDTH = 800 | ||
const HEIGHT = 600 | ||
|
||
# fill application info | ||
sType = VK_STRUCTURE_TYPE_APPLICATION_INFO | ||
pApplicationName = pointer(b"Vulkan Instance") | ||
applicationVersion = convert_vk_back(UInt32, v"1.1") | ||
pEngineName = pointer(b"Test") | ||
engineVersion = convert_vk_back(UInt32, v"1.1") | ||
apiVersion = convert_vk_back(UInt32, v"1.1") | ||
appInfoRef = VkApplicationInfo(sType, C_NULL, pApplicationName, applicationVersion, pEngineName, engineVersion, apiVersion) |> Ref | ||
|
||
# fill create info | ||
sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO | ||
flags = UInt32(0) | ||
pApplicationInfo = Base.unsafe_convert(Ptr{VkApplicationInfo}, appInfoRef) | ||
requiredExtensions = GLFW.GetRequiredInstanceExtensions() | ||
@static if Sys.isapple() | ||
@assert ("VK_MVK_macos_surface" in requiredExtensions) || ("VK_EXT_metal_surface" in requiredExtensions) | ||
## init GLFW window | ||
GLFW.WindowHint(GLFW.CLIENT_API, GLFW.NO_API) # not to create an OpenGL context | ||
GLFW.WindowHint(GLFW.RESIZABLE, 0) | ||
window = GLFW.CreateWindow(WIDTH, HEIGHT, "Vulkan") | ||
|
||
## init Vulkan | ||
## creating instance | ||
appInfoRef = VkApplicationInfo( | ||
"Application Name: Create Instance", | ||
v"1.0.0", | ||
"No Engine Name", | ||
v"1.0.0", | ||
VK_API_VERSION_1_2, | ||
) |> Ref | ||
|
||
extensions = GLFW.GetRequiredInstanceExtensions() | ||
@test check_extensions(extensions) | ||
|
||
layers = get(ENV, "JULIA_GITHUB_ACTIONS_CI", "OFF") == "ON" ? String[] : ["VK_LAYER_KHRONOS_validation"] | ||
@test check_layers(layers) | ||
|
||
createInfoRef = VkInstanceCreateInfo(appInfoRef, layers, extensions) |> Ref | ||
|
||
instanceRef = Ref(VkInstance(C_NULL)) | ||
result = GC.@preserve appInfoRef layers extensions vkCreateInstance(createInfoRef, C_NULL, instanceRef) | ||
|
||
@static if get(ENV, "JULIA_GITHUB_ACTIONS_CI", "OFF") == "ON" | ||
@test_broken result == VK_SUCCESS | ||
else | ||
@test result == VK_SUCCESS | ||
end | ||
|
||
## cleaning up | ||
if result == VK_SUCCESS | ||
vkDestroyInstance(instanceRef[], C_NULL) | ||
end | ||
enabledExtensionCount = Ref{Cuint}(0) | ||
ppEnabledExtensionNames = ccall((:glfwGetRequiredInstanceExtensions, GLFW.libglfw), Ptr{Cstring}, (Ref{Cuint},), enabledExtensionCount) | ||
enabledExtensionCount = enabledExtensionCount[] | ||
enabledLayerCount = Cuint(0) | ||
ppEnabledLayerNames = C_NULL | ||
createInfoRef = VkInstanceCreateInfo(sType, C_NULL, flags, pApplicationInfo, enabledLayerCount, ppEnabledLayerNames, enabledExtensionCount, ppEnabledExtensionNames) |> Ref | ||
|
||
# create instance | ||
instanceRef = Ref{VkInstance}(C_NULL) | ||
result = vkCreateInstance(createInfoRef, C_NULL, instanceRef) | ||
result != VK_SUCCESS && error("failed to create instance!") | ||
instance = instanceRef[] | ||
@show instance | ||
vkDestroyInstance(instance, C_NULL) | ||
GLFW.DestroyWindow(window) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
using VulkanCore | ||
using VulkanCore.LibVulkan | ||
using Test | ||
using GLFW | ||
|
||
const api = VulkanCore.vk | ||
|
||
convert_vk_back(::Type{UInt32}, version::VersionNumber) = (version.major << 22) + (version.minor << 12) + version.patch | ||
convert_vk(::Type{VersionNumber}, version::UInt32) = VersionNumber(UInt32(version) >> 22, (UInt32(version) >> 12) & 0x3ff, UInt32(version) & 0xfff) | ||
|
||
err = VkResult(0) | ||
count = Ref{Cuint}(0) | ||
# Scan layers | ||
err = api.vkEnumerateInstanceLayerProperties(count, C_NULL) | ||
@assert err == api.VK_SUCCESS | ||
global_layer_properties = Vector{api.VkLayerProperties}(undef, count[]) | ||
err = api.vkEnumerateInstanceLayerProperties(count, global_layer_properties) | ||
@assert err == api.VK_SUCCESS | ||
|
||
function Base.show(io::IO, lp::api.VkLayerProperties) | ||
println(io, "Layer Properties: ") | ||
println(io, " Layer Name: ", String(filter(x->x!=0, UInt8[lp.layerName...]))) | ||
println(io, " Spec Version: ", convert_vk(VersionNumber, lp.specVersion)) | ||
println(io, " Implementation Version: ", convert_vk(VersionNumber, lp.implementationVersion)) | ||
println(io, " description: ", String(filter(x->x!=0, UInt8[lp.description...]))) | ||
end | ||
for elem in global_layer_properties | ||
println(elem) | ||
end | ||
|
||
appname = b"vulkaninfo" | ||
|
||
app_info = Ref(VkApplicationInfo(VK_STRUCTURE_TYPE_APPLICATION_INFO, | ||
C_NULL, | ||
pointer(appname), | ||
1, | ||
pointer(appname), | ||
1, | ||
convert_vk_back(UInt32, v"1.1"))) | ||
|
||
inst_info = Ref(VkInstanceCreateInfo(VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO, | ||
C_NULL, | ||
UInt32(0), | ||
Base.unsafe_convert(Ptr{VkApplicationInfo}, app_info), | ||
0, | ||
C_NULL, | ||
0, | ||
C_NULL)) | ||
|
||
instance = Ref{VkInstance}(C_NULL) | ||
|
||
err = vkCreateInstance(inst_info, C_NULL, instance) | ||
@test err == VK_SUCCESS | ||
println(instance) | ||
|
||
gpu_count = Ref{Cuint}(0) | ||
err = vkEnumeratePhysicalDevices(instance[], gpu_count, C_NULL) | ||
@test err == VK_SUCCESS | ||
devices = Array{VkPhysicalDevice}(undef, gpu_count[]) | ||
|
||
err = vkEnumeratePhysicalDevices(instance[], gpu_count, devices) | ||
@test err == VK_SUCCESS | ||
|
||
deviceprops = Ref{VkPhysicalDeviceProperties}() | ||
vkGetPhysicalDeviceProperties(devices[], deviceprops) | ||
|
||
|
||
function Base.show(io::IO, pdsp::VkPhysicalDeviceSparseProperties) | ||
println(io, "Physical device Sparse Properties: ") | ||
for name in fieldnames(typeof(pdsp)) | ||
println(io, " ", name, " ", getfield(pdsp, name) == 1) | ||
end | ||
end | ||
function Base.show(io::IO, pdp::VkPhysicalDeviceProperties) | ||
println(io, "Physical Device Properties: ") | ||
println(io, " API Version: ", convert_vk(VersionNumber, pdp.apiVersion)) | ||
println(io, " Driver Version: ", convert_vk(VersionNumber, pdp.driverVersion)) | ||
|
||
println(io, " Vendor ID ", pdp.vendorID) | ||
println(io, " Device ID: ", pdp.deviceID) | ||
println(io, " Device Type: ", pdp.deviceType) | ||
println(io, " Device Name: ", String(filter(x->x!=0, UInt8[pdp.deviceName...]))) | ||
println(io, " Pipeline Cache UUID: ", String(collect(pdp.pipelineCacheUUID))) | ||
println(io, " Limits: ", pdp.limits) | ||
println(io, " Sparse Properties: \n ", pdp.sparseProperties) | ||
end | ||
|
||
limitshow(x::Cuint) = Int(x) | ||
limitshow(x::NTuple) = "<"*join(map(limitshow, x), " ")*">" | ||
limitshow(x) = x | ||
|
||
function Base.show(io::IO, pdl::VkPhysicalDeviceLimits) | ||
println(io, "Physical Device Limits: ") | ||
for name in fieldnames(typeof(pdl)) | ||
println(io, " ", name, " ", limitshow(getfield(pdl, name))) | ||
end | ||
end | ||
|
||
println(deviceprops[]) | ||
|
||
queue_count = Ref{Cuint}(0) | ||
vkGetPhysicalDeviceQueueFamilyProperties(devices[], queue_count, C_NULL) | ||
queueprops = Array{VkQueueFamilyProperties}(undef, queue_count[]) | ||
println(queue_count[]) | ||
vkGetPhysicalDeviceQueueFamilyProperties(devices[], queue_count, queueprops) | ||
println(queueprops) | ||
|
||
memprops = Ref{VkPhysicalDeviceMemoryProperties}() | ||
vkGetPhysicalDeviceMemoryProperties(devices[], memprops) | ||
|
||
println(memprops[]) | ||
devicefeatures = Ref{VkPhysicalDeviceFeatures}() | ||
vkGetPhysicalDeviceFeatures(devices[], devicefeatures) | ||
|
||
function Base.show(io::IO, df::VkPhysicalDeviceFeatures) | ||
println(io, "Physical device features: ") | ||
for name in fieldnames(typeof(df)) | ||
println(io, " ", name, ": ", getfield(df, name) != 1 ? "un" : "", "supported") | ||
end | ||
end | ||
println(devicefeatures[]) |
Oops, something went wrong.