-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathaction.yml
149 lines (139 loc) · 5.17 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
name: 'Setup Vulkan SDK'
description: 'Automatically builds Vulkan SDK components from source.'
branding:
icon: 'play'
color: 'red'
inputs:
vulkan-config-file:
description: 'Vulkan SDK configuration path (prefer this to relying on vulkan-query-version lookup)'
default: ''
required: false
vulkan-query-version:
description: 'Vulkan SDK release version (download configuration file from LunarG web services)'
default: ''
required: false
vulkan-components:
description: 'specify which Vulkan SDK components to install, e.g. Vulkan-Headers, Vulkan-Loader, Glslang'
default: Vulkan-Headers, Vulkan-Loader
required: true
vulkan-use-cache:
description: 'specify whether to cache VULKAN_SDK/ results between runs (using github actions/cache)'
default: false
required: false
runs:
using: "composite"
steps:
- uses: humbletim/vsdevenv-shell@e87fcf2359929606ba32db358baef5ede4737aed
- name: Resolve Vulkan SDK Configuration
shell: bash
run: |
# resolve_vulkan_sdk_environment
. $GITHUB_ACTION_PATH/action_helpers.sh
resolve_vulkan_sdk_environment \
"${{ inputs.vulkan-query-version }}" \
"${{ inputs.vulkan-config-file }}" \
"${{ inputs.vulkan-components }}" \
|| { echo "could not resolve SDK version / JSON configuration $?" ; exit 42 ; }
- name: Configure Development Environment Prerequisites
shell: bash
run: |
# dev prerequisites
case `uname -s` in
Darwin) ;;
Linux)
sudo apt-get -qq update
sudo apt-get -qq install -y libwayland-dev libxrandr-dev
;;
MINGW*) ;;
esac
- name: Generate cache key
if: inputs.vulkan-use-cache != 'false'
shell: bash
run: |
# cache-key.txt
. $PWD/_vulkan_build/env
(
echo VULKAN_SDK_CONFIG_FILE=$(sha256sum $VULKAN_SDK_CONFIG_FILE || openssl sha256 $VULKAN_SDK_CONFIG_FILE)
echo VULKAN_SDK_CONFIG_VERSION=$VULKAN_SDK_CONFIG_VERSION
echo VULKAN_SDK_COMPONENTS=\"$VULKAN_SDK_COMPONENTS\"
echo vulkan-use-cache=${{ inputs.vulkan-use-cache }}
) | tee _vulkan_build/cache-key.txt >&2
- name: Check Vulkan SDK Cache
id: vulkan-cached-sdk
if: inputs.vulkan-use-cache != 'false'
uses: actions/cache@v4
with:
path: VULKAN_SDK
key: ${{ runner.os }}-vulkan-cached-sdk-${{ hashFiles('_vulkan_build/cache-key.txt') }}
- name: Configure Vulkan SDK Build Prerequisites
if: steps.vulkan-cached-sdk.outputs.cache-hit != 'true'
shell: bash
run: |
# vulkan tools prereq
. $GITHUB_ACTION_PATH/action_helpers.sh
. $PWD/_vulkan_build/env
configure_sdk_prereqs $PWD/_vulkan_build/tools
echo PATH=$PWD/_vulkan_build/tools/bin:\$PATH >> $PWD/_vulkan_build/env
echo "$VULKAN_SDK_BUILD_DIR/env:"
echo "--------------------------------------------------------------"
cat $VULKAN_SDK_BUILD_DIR/env
echo "--------------------------------------------------------------"
- name: Configure Vulkan SDK Components
if: steps.vulkan-cached-sdk.outputs.cache-hit != 'true'
shell: vsdevenv x64 bash {0}
run: |
# cmake configure
set -a
. $PWD/_vulkan_build/env
if [[ $RUNNER_OS == 'Windows' ]] ; then
CC=cl.exe
CXX=cl.exe
fi
cmake -S $GITHUB_ACTION_PATH -B ${VULKAN_SDK_BUILD_DIR} \
-DCMAKE_BUILD_TYPE=Release \
-DVULKAN_SDK=${VULKAN_SDK} \
-DVULKAN_SDK_CONFIG="${VULKAN_SDK_CONFIG_FILE}" \
-DVULKAN_SDK_COMPONENTS="${VULKAN_SDK_COMPONENTS}" \
|| { echo "cmake configure failed" >&2 ; cat _vulkan_build/CMakeFiles/*.log ; exit 4 ; }
- name: Build Vulkan SDK Components
if: steps.vulkan-cached-sdk.outputs.cache-hit != 'true'
shell: vsdevenv x64 bash {0}
run: |
# cmake build
set -a
. $PWD/_vulkan_build/env
cmake --build ${VULKAN_SDK_BUILD_DIR} --config Release
- name: Install Vulkan SDK Components
if: steps.vulkan-cached-sdk.outputs.cache-hit != 'true'
shell: bash
run: |
# cmake install
set -a
. $PWD/_vulkan_build/env
cmake --install ${VULKAN_SDK_BUILD_DIR}
- name: Verify Vulkan SDK Installation
shell: bash
run: |
# verify VULKAN_SDK
. $PWD/_vulkan_build/env
test -s ${VULKAN_SDK}/sdk.env
. ${VULKAN_SDK}/sdk.env
if [[ -d "${VULKAN_SDK}" && -n "${VULKAN_SDK_VERSION}" ]] ; then
echo "Vulkan SDK v${VULKAN_SDK_VERSION} successfully installed into ${VULKAN_SDK}."
else
echo "Could not verify Vulkan SDK installation"
exit 3
fi
- name: Export VULKAN_SDK and bin/ PATH to environment
shell: bash
run: |
# export vulkan env vars
. $PWD/_vulkan_build/env
. ${VULKAN_SDK}/sdk.env
(
echo VULKAN_SDK=${VULKAN_SDK}
echo VULKAN_SDK_VERSION=${VULKAN_SDK_VERSION}
) | tee -a $GITHUB_ENV
echo ${VULKAN_SDK}/bin | tee -a $GITHUB_PATH
rm -rf $PWD/_vulkan_build
du -hs ${VULKAN_SDK}