-
Notifications
You must be signed in to change notification settings - Fork 1
/
action.yml
113 lines (104 loc) · 4.89 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
name: 'VulkanCI'
description: 'Set up CI environment for testing Vulkan apps'
branding:
icon: 'box'
color: 'red'
inputs:
sdkVersion:
description: 'Requested VulkanSDK version'
required: false
default: 1.3.283.0
installPath:
description: 'Directory to install to'
required: false
default: ${{ github.workspace }}
outputs:
vulkan-install-path:
description: 'Path VulkanSDK was install to'
value: ${{ steps.setup-environment.outputs.vk-ci-vulkan-install-path }}
swiftshader-install-path:
description: 'Path SwiftShader was installed to'
value: ${{ steps.setup-environment.outputs.vk-ci-swiftshader-install-path }}
runs:
using: "composite"
steps:
- name: Set Up Artifact Names
id: artifacts
shell: bash
env:
ACTION_TAG: ${{ github.action_ref }}
run: |
if [[ "${{ runner.os }}" == "Windows" ]]; then
echo "vk-ci-sdk-artifact-name=vulkanSDK-${{ inputs.sdkVersion }}-windows-2022-x64.zip" >> "$GITHUB_OUTPUT"
echo "vk-ci-swiftshader-artifact-name=swiftshader-windows-2022-x64.zip" >> "$GITHUB_OUTPUT"
echo "vk-ci-swiftshader-lib-name=vk_swiftshader.dll" >> "$GITHUB_OUTPUT"
elif [[ "${{ runner.os }}" == "Linux" ]]; then
echo "vk-ci-sdk-artifact-name=vulkanSDK-${{ inputs.sdkVersion }}-ubuntu-20.04-x64.zip" >> "$GITHUB_OUTPUT"
echo "vk-ci-swiftshader-artifact-name=swiftshader-ubuntu-20.04-x64.zip" >> "$GITHUB_OUTPUT"
echo "vk-ci-swiftshader-lib-name=libvk_swiftshader.so" >> "$GITHUB_OUTPUT"
elif [[ "${{ runner.os }}" == "macOS" ]]; then
echo "vk-ci-sdk-artifact-name=vulkanSDK-${{ inputs.sdkVersion }}-macOS-12-x64.zip" >> "$GITHUB_OUTPUT"
echo "vk-ci-swiftshader-artifact-name=swiftshader-macOS-12-x64.zip" >> "$GITHUB_OUTPUT"
echo "vk-ci-swiftshader-lib-name=libvk_swiftshader.dylib" >> "$GITHUB_OUTPUT"
else
echo "Unsupported OS: ${{ runner.os }}"
exit 1
fi
if [ -n "${{ env.VK_CI_TEST_TAG_OVERRIDE }}" ]; then
echo "Test run detected. Using artifacts from release: ${{ env.VK_CI_TEST_TAG_OVERRIDE }}"
echo "vk-ci-action-tag=${{ env.VK_CI_TEST_TAG_OVERRIDE }}" >> "$GITHUB_OUTPUT"
else
echo "Using artifacts from release: $ACTION_TAG"
echo "vk-ci-action-tag=$ACTION_TAG" >> "$GITHUB_OUTPUT"
fi
- name: Download VulkanSDK Artifact
uses: robinraju/release-downloader@v1.10
with:
repository: 'NcStudios/VulkanCI'
tag: '${{ steps.artifacts.outputs.vk-ci-action-tag }}'
filename: '${{ steps.artifacts.outputs.vk-ci-sdk-artifact-name}}'
out-file-path: '${{ inputs.installPath }}/VulkanSDK'
extract: true
- name: Download Swiftshader Artifact
uses: robinraju/release-downloader@v1.10
with:
repository: 'NcStudios/VulkanCI'
tag: '${{ steps.artifacts.outputs.vk-ci-action-tag }}'
filename: '${{ steps.artifacts.outputs.vk-ci-swiftshader-artifact-name}}'
out-file-path: '${{ inputs.installPath }}/swiftshader'
extract: true
- name: Setup Environment
id: setup-environment
shell: bash
run: |
INSTALL_PATH="${{ inputs.installPath }}"
INSTALL_PATH="${INSTALL_PATH//\\//}"
SDK_INSTALL_PATH="$INSTALL_PATH/VulkanSDK/${{ inputs.sdkVersion }}"
SWIFTSHADER_INSTALL_PATH="$INSTALL_PATH/swiftshader"
echo "VULKAN_SDK=$SDK_INSTALL_PATH" >> "$GITHUB_ENV"
echo "VULKAN_SDK_VERSION=${{ inputs.sdkVersion }}" >> "$GITHUB_ENV"
cat <<EOF > "$SWIFTSHADER_INSTALL_PATH/vk_swiftshader_icd.json"
{
"file_format_version": "1.0.0",
"ICD": {
"library_path": "$SWIFTSHADER_INSTALL_PATH/${{ steps.artifacts.outputs.vk-ci-swiftshader-lib-name }}",
"api_version": "1.0.5"
}
}
EOF
echo "VK_DRIVER_FILES=$SWIFTSHADER_INSTALL_PATH/vk_swiftshader_icd.json" >> "$GITHUB_ENV"
if [[ "${{ runner.os }}" == "Windows" ]]; then
echo "VK_LAYER_PATH=$SDK_INSTALL_PATH/bin" >> "$GITHUB_ENV"
echo "$SDK_INSTALL_PATH/bin" >> "$GITHUB_PATH"
elif [[ "${{ runner.os }}" == "Linux" ]]; then
echo "VK_LAYER_PATH=$SDK_INSTALL_PATH/share/vulkan/explicit_layer.d" >> "$GITHUB_ENV"
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$SDK_INSTALL_PATH/lib:$SWIFTSHADER_INSTALL_PATH" >> "$GITHUB_ENV"
elif [[ "${{ runner.os }}" == "macOS" ]]; then
echo "VK_LAYER_PATH=$SDK_INSTALL_PATH/share/vulkan/explicit_layer.d" >> "$GITHUB_ENV"
echo "DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$SDK_INSTALL_PATH/lib:$SWIFTSHADER_INSTALL_PATH" >> "$GITHUB_ENV"
else
echo "Unsupported OS: ${{ runner.os }}"
exit 1
fi
echo "vk-ci-vulkan-install-path=$SDK_INSTALL_PATH" >> "$GITHUB_OUTPUT"
echo "vk-ci-swiftshader-install-path=$SWIFTSHADER_INSTALL_PATH" >> "$GITHUB_OUTPUT"