Skip to content

Commit 096f404

Browse files
committed
testing github action
1 parent e577406 commit 096f404

12 files changed

+115
-160
lines changed

src/test/kotlin/main/main.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package main
22

3+
4+
35
fun main() {
46

57

src/test/kotlin/main/util.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package main
2+
3+
val isNotGithubAction: Boolean
4+
get() = System.getenv("GITHUB_ACTIONS") == "true"
Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
11
package samples
22

33
import io.kotlintest.specs.StringSpec
4+
import main.isNotGithubAction
45
import vkk.vk
56

67
class InstanceExtensionProperties : StringSpec() {
78

89
init {
9-
"InstanceExtensionProperties" {
10+
if (isNotGithubAction)
11+
"InstanceExtensionProperties" {
1012

11-
val extensionProperties = vk.enumerateInstanceExtensionProperties()
13+
val extensionProperties = vk.enumerateInstanceExtensionProperties()
1214

13-
// sort the extensions alphabetically
15+
// sort the extensions alphabetically
1416

15-
extensionProperties.sortBy { it.extensionName }
17+
extensionProperties.sortBy { it.extensionName }
1618

17-
println("Instance Extensions:")
18-
for (ep in extensionProperties)
19-
println("${ep.extensionName}:\n\tVersion: ${ep.specVersion}\n")
20-
}
19+
println("Instance Extensions:")
20+
for (ep in extensionProperties)
21+
println("${ep.extensionName}:\n\tVersion: ${ep.specVersion}\n")
22+
}
2123
}
2224
}
Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package samples
22

33
import io.kotlintest.specs.StringSpec
4+
import main.isNotGithubAction
45
import vkk._10.structs.ExtensionProperties
56
import vkk._10.structs.LayerProperties
67
import vkk.vk
@@ -10,34 +11,35 @@ class InstanceLayerExtensionProperties : StringSpec() {
1011
class PropertyData(val layerProperties: LayerProperties, val extensionProperties: Array<ExtensionProperties>)
1112

1213
init {
13-
"InstanceLayerExtensionProperties" {
14+
if (isNotGithubAction)
15+
"InstanceLayerExtensionProperties" {
1416

15-
val layerProperties = vk.enumerateInstanceLayerProperties()
17+
val layerProperties = vk.enumerateInstanceLayerProperties()
1618

17-
/* VULKAN_KEY_START */
19+
/* VULKAN_KEY_START */
1820

19-
val propertyData = Array(layerProperties.size) {
20-
val layerProperty = layerProperties[it]
21-
val extensionProperties = vk.enumerateInstanceExtensionProperties(layerProperty.layerName)
22-
PropertyData(layerProperty, extensionProperties)
23-
}
24-
25-
println("Instance Layers:")
26-
if (propertyData.isEmpty())
27-
println("Set the environment variable VK_LAYER_PATH to point to the location of your layers")
28-
else
29-
for (pd in propertyData) {
30-
println(pd.layerProperties.layerName)
31-
if (pd.extensionProperties.isEmpty())
32-
print("Layer Extension: None")
33-
else
34-
for (it in pd.extensionProperties) {
35-
if (it !== pd.extensionProperties[0])
36-
print(", ")
37-
print("${it.extensionName} Version ${it.specVersion}")
38-
}
39-
print("\n\n")
21+
val propertyData = Array(layerProperties.size) {
22+
val layerProperty = layerProperties[it]
23+
val extensionProperties = vk.enumerateInstanceExtensionProperties(layerProperty.layerName)
24+
PropertyData(layerProperty, extensionProperties)
4025
}
41-
}
26+
27+
println("Instance Layers:")
28+
if (propertyData.isEmpty())
29+
println("Set the environment variable VK_LAYER_PATH to point to the location of your layers")
30+
else
31+
for (pd in propertyData) {
32+
println(pd.layerProperties.layerName)
33+
if (pd.extensionProperties.isEmpty())
34+
print("Layer Extension: None")
35+
else
36+
for (it in pd.extensionProperties) {
37+
if (it !== pd.extensionProperties[0])
38+
print(", ")
39+
print("${it.extensionName} Version ${it.specVersion}")
40+
}
41+
print("\n\n")
42+
}
43+
}
4244
}
4345
}
Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,27 @@
11
package samples
22

33
import io.kotlintest.specs.StringSpec
4+
import main.isNotGithubAction
45
import vkk.vk
56

67
class InstanceLayerProperties : StringSpec() {
78

89
init {
9-
"InstanceLayerProperties" {
10+
if (isNotGithubAction)
11+
"InstanceLayerProperties" {
1012

11-
val layerProperties = vk.enumerateInstanceLayerProperties()
13+
val layerProperties = vk.enumerateInstanceLayerProperties()
1214

13-
println("Instance Layers:")
14-
if (layerProperties.isEmpty())
15-
println("Set the environment variable VK_LAYER_PATH to point to the location of your layers")
16-
for (lp in layerProperties) {
17-
println("${lp.layerName}:")
18-
println("\tVersion: ${lp.implementationVersion}")
19-
println("\tAPI Version: (${lp.specVersion shr 22}.${(lp.specVersion shr 12) and 0x03FF}.${lp.specVersion and 0xFFF})")
20-
println("\tDescription: ${lp.description}")
21-
println()
15+
println("Instance Layers:")
16+
if (layerProperties.isEmpty())
17+
println("Set the environment variable VK_LAYER_PATH to point to the location of your layers")
18+
for (lp in layerProperties) {
19+
println("${lp.layerName}:")
20+
println("\tVersion: ${lp.implementationVersion}")
21+
println("\tAPI Version: (${lp.specVersion shr 22}.${(lp.specVersion shr 12) and 0x03FF}.${lp.specVersion and 0xFFF})")
22+
println("\tDescription: ${lp.description}")
23+
println()
24+
}
2225
}
23-
}
2426
}
2527
}
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package samples
22

33
import io.kotlintest.specs.StringSpec
4+
import main.isNotGithubAction
45
import org.lwjgl.vulkan.VK10
56
import org.lwjgl.vulkan.VK10.VK_VERSION_MINOR
67
import org.lwjgl.vulkan.VK10.VK_VERSION_PATCH
@@ -11,9 +12,10 @@ class InstanceVersion : StringSpec() {
1112
fun decodeAPIVersion(apiVersion: Int) = "${VK10.VK_VERSION_MAJOR(apiVersion)}.${VK_VERSION_MINOR(apiVersion)}.${VK_VERSION_PATCH(apiVersion)}"
1213

1314
init {
14-
"InstanceVersion" {
15-
val apiVersion = vk.enumerateInstanceVersion
16-
println("APIVersion = ${decodeAPIVersion(apiVersion)}")
17-
}
15+
if (isNotGithubAction)
16+
"InstanceVersion" {
17+
val apiVersion = vk.enumerateInstanceVersion
18+
println("APIVersion = ${decodeAPIVersion(apiVersion)}")
19+
}
1820
}
1921
}
Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package tests
22

33
import io.kotlintest.specs.StringSpec
4+
import main.isNotGithubAction
45
import org.lwjgl.vulkan.VK11.VK_API_VERSION_1_1
56
import vkk._10.structs.ApplicationInfo
67
import vkk._10.structs.InstanceCreateInfo
@@ -13,23 +14,20 @@ class `01 initInstance` : StringSpec() {
1314

1415
init {
1516

16-
"01 initInstance" {
17+
if (isNotGithubAction)
18+
"01 initInstance" {
1719

18-
println("entries")
19-
for(e in System.getenv().entries)
20-
println("[${e.key}] = ${e.value}")
20+
// initialize the vk::ApplicationInfo structure
21+
val applicationInfo = ApplicationInfo(appName, 1, engineName, 1, VK_API_VERSION_1_1)
2122

22-
// initialize the vk::ApplicationInfo structure
23-
val applicationInfo = ApplicationInfo (appName, 1, engineName, 1, VK_API_VERSION_1_1)
23+
// initialize the vk::InstanceCreateInfo
24+
val instanceCreateInfo = InstanceCreateInfo(applicationInfo)
2425

25-
// initialize the vk::InstanceCreateInfo
26-
val instanceCreateInfo = InstanceCreateInfo(applicationInfo)
26+
// create a UniqueInstance
27+
val instance = UniqueInstance(instanceCreateInfo)
2728

28-
// create a UniqueInstance
29-
val instance = UniqueInstance(instanceCreateInfo)
30-
31-
// Note: No need to explicitly destroy the instance, as the corresponding destroy function is
32-
// called by the destructor of the UniqueInstance on leaving this scope.
33-
}
29+
// Note: No need to explicitly destroy the instance, as the corresponding destroy function is
30+
// called by the destructor of the UniqueInstance on leaving this scope.
31+
}
3432
}
3533
}
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
package tests
22

33
import io.kotlintest.specs.StringSpec
4-
import org.lwjgl.system.Configuration
5-
import vkk.vk
4+
import main.isNotGithubAction
65
import vkk.vu
76

87
class `02 enumerateDevices` : StringSpec() {
@@ -11,17 +10,18 @@ class `02 enumerateDevices` : StringSpec() {
1110
val engineName = "Vulkan.hpp"
1211

1312
init {
14-
"02 enumerateDevices" {
13+
if (isNotGithubAction)
14+
"02 enumerateDevices" {
1515

16-
val instance = vu.createInstance(appName, engineName)
16+
val instance = vu.createInstance(appName, engineName)
1717
// if(vk.DEBUG)
1818
// vu.createDebugUtilsMessenger(instance)
1919

20-
// enumerate the physicalDevices
21-
val physicalDevice = instance.enumeratePhysicalDevices.first()
20+
// enumerate the physicalDevices
21+
val physicalDevice = instance.enumeratePhysicalDevices.first()
2222

23-
// Note: PhysicalDevices are not created, but just enumerated. Therefore, there is nothing like a UniquePhysicalDevice.
24-
// A PhysicalDevice is unique by definition, and there's no need to destroy it.
25-
}
23+
// Note: PhysicalDevices are not created, but just enumerated. Therefore, there is nothing like a UniquePhysicalDevice.
24+
// A PhysicalDevice is unique by definition, and there's no need to destroy it.
25+
}
2626
}
2727
}

src/test/kotlin/tests/03 initCommandBuffer.kt

Lines changed: 0 additions & 11 deletions
This file was deleted.
Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
package tests
22

33
import io.kotlintest.specs.StringSpec
4+
import main.isNotGithubAction
45
import vkk.VkQueueFlag
56
import vkk._10.structs.DeviceCreateInfo
67
import vkk._10.structs.DeviceQueueCreateInfo
78
import vkk.has
8-
import vkk.vk
99
import vkk.vu
1010

1111
class `03 initDevice` : StringSpec() {
@@ -14,30 +14,31 @@ class `03 initDevice` : StringSpec() {
1414
val engineName = "Vulkan.hpp"
1515

1616
init {
17-
"03 initDevice" {
17+
if (isNotGithubAction)
18+
"03 initDevice" {
1819

19-
val instance = vu.createInstance(appName, engineName)
20+
val instance = vu.createInstance(appName, engineName)
2021
// if(vk.DEBUG)
2122
// vk::UniqueDebugUtilsMessengerEXT debugUtilsMessenger = vk::su::createDebugUtilsMessenger(instance);
2223

23-
val physicalDevice = instance.enumeratePhysicalDevices[0]
24+
val physicalDevice = instance.enumeratePhysicalDevices[0]
2425

25-
/* VULKAN_HPP_KEY_START */
26+
/* VULKAN_HPP_KEY_START */
2627

27-
// get the QueueFamilyProperties of the first PhysicalDevice
28-
val queueFamilyProperties = physicalDevice.queueFamilyProperties
28+
// get the QueueFamilyProperties of the first PhysicalDevice
29+
val queueFamilyProperties = physicalDevice.queueFamilyProperties
2930

30-
// get the first index into queueFamiliyProperties which supports graphics
31-
val graphicsQueueFamilyIndex = queueFamilyProperties.indexOfFirst { it.queueFlags has VkQueueFlag.GRAPHICS_BIT }
32-
assert(graphicsQueueFamilyIndex in queueFamilyProperties.indices)
31+
// get the first index into queueFamiliyProperties which supports graphics
32+
val graphicsQueueFamilyIndex = queueFamilyProperties.indexOfFirst { it.queueFlags has VkQueueFlag.GRAPHICS_BIT }
33+
assert(graphicsQueueFamilyIndex in queueFamilyProperties.indices)
3334

34-
// create a UniqueDevice
35-
val queuePriority = 0f
36-
val deviceQueueCreateInfo = DeviceQueueCreateInfo(0, graphicsQueueFamilyIndex, queuePriority)
37-
val device = physicalDevice.createDeviceUnique(DeviceCreateInfo(0, deviceQueueCreateInfo))
35+
// create a UniqueDevice
36+
val queuePriority = 0f
37+
val deviceQueueCreateInfo = DeviceQueueCreateInfo(0, graphicsQueueFamilyIndex, queuePriority)
38+
val device = physicalDevice.createDeviceUnique(DeviceCreateInfo(0, deviceQueueCreateInfo))
3839

39-
// Note: No need to explicitly destroy the device, as the corresponding destroy function is
40-
// called by the destructor of the UniqueDevice on leaving this scope.
41-
}
40+
// Note: No need to explicitly destroy the device, as the corresponding destroy function is
41+
// called by the destructor of the UniqueDevice on leaving this scope.
42+
}
4243
}
4344
}

0 commit comments

Comments
 (0)