-
Notifications
You must be signed in to change notification settings - Fork 7
258 lines (229 loc) Β· 10.5 KB
/
ci.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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
# Copyright (c) 2024 Carsten Rudolph
name: Run Tests
on:
issue_comment:
types:
- created
- edited
workflow_dispatch:
inputs:
pullRequest:
description: 'Pull Request ID'
required: true
env:
vulkanSdkVersion: '1.3.283.0'
mesaDriverVersion: '24.1.1'
jobs:
verify:
name: verify-permissions
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
if: "${{ (github.event_name == 'workflow_dispatch') || ( github.event_name == 'issue_comment' && github.event.issue.pull_request && contains(github.event.comment.body, 'Run: Tests') ) }}"
steps:
- name: Check persmission
uses: actions-cool/check-user-permission@v2
id: check-permission
if: ${{ github.event_name == 'issue_comment' }}
with:
username: ${{ github.event.comment.user.login }}
check-contributor: true
- name: Validate permission
if: ${{ github.event_name == 'issue_comment' && steps.check.outputs.require-result }}
run: |
echo "::error Insufficient permission. Only existing contributers may trigger CI runs."
exit 1
- name: Confirm run
uses: peter-evans/create-or-update-comment@v4
if: ${{ github.event_name == 'issue_comment' }}
with:
comment-id: ${{ github.event.comment.id }}
reactions: 'rocket'
test:
name: run-tests
needs: verify
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
name: [ windows-latest-msvc, windows-latest-clang ]
include:
- name: windows-latest-msvc
os: windows-latest
compiler: msvc
triplet: x64-windows
configuration: windows-msvc-x64-test
architecture: x64
- name: windows-latest-clang
os: windows-latest
compiler: clang
triplet: x64-windows
configuration: windows-clang-x64-test
architecture: x64
steps:
- name: Retrieve PR info
id: retrieve-pr-from-issue-comment
uses: actions/github-script@v3
if: ${{ github.event_name == 'issue_comment' }}
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
console.log('Retrieving HEAD REF for PR #${{ github.event.issue.number }}')
const pull_request = await github.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: ${{ github.event.issue.number }}
})
console.log('HEAD SHA = ' + pull_request.data.head.sha + ', REF = ' + pull_request.data.head.ref)
core.exportVariable('HEAD_SHA', pull_request.data.head.sha)
core.exportVariable('HEAD_REF', pull_request.data.head.ref)
- name: Retrieve PR info
id: retrieve-pr-from-workflow-dispatch
uses: actions/github-script@v3
if: ${{ github.event_name == 'workflow_dispatch' }}
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
console.log('Retrieving HEAD REF for PR #${{ github.event.inputs.pullRequest }}')
const pull_request = await github.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: ${{ github.event.inputs.pullRequest }}
})
console.log('HEAD SHA = ' + pull_request.data.head.sha + ', REF = ' + pull_request.data.head.ref)
core.exportVariable('HEAD_SHA', pull_request.data.head.sha)
core.exportVariable('HEAD_REF', pull_request.data.head.ref)
- name: Create checks
uses: LouisBrunner/[email protected]
id: create-checks
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: run-tests (${{ matrix.name }})
sha: ${{ env.HEAD_SHA }}
status: in_progress
- name: Checking out sources
uses: actions/checkout@master
with:
ref: ${{ env.HEAD_SHA }}
submodules: true
- name: Setup Vulkan SDK
uses: jakoch/[email protected]
with:
vulkan_version: ${{ env.vulkanSdkVersion }}
install_runtime: true
cache: true
stripdown: false
- name: Install OpenCppCoverage
id: install-opencppcoverage
shell: bash
run: |
choco install opencppcoverage
echo "C:\Program Files\OpenCppCoverage" >> $GITHUB_PATH
- name: Install LLVM and Clang
if: ${{ matrix.compiler == 'clang' }}
uses: KyleMayes/install-llvm-action@v2
with:
version: "18"
- name: Setup build and test environment
id: setup-environment
shell: bash
run: |
echo "VCPKG_FEATURE_FLAGS=manifests" >> $env:GITHUB_ENV
#echo "C:\VulkanSDK\${{ env.vulkanSdkVersion }}\runtime" >> $GITHUB_PATH # Somehow does not get picked up by the MSVC development environment.
cp "C:\VulkanSDK\${{ env.vulkanSdkVersion }}\runtime\x64\vulkan-1.dll" "C:\Windows\System32\vulkan-1.dll"
cp "C:\VulkanSDK\${{ env.vulkanSdkVersion }}\runtime\x86\vulkan-1.dll" "C:\Windows\SysWOW64\vulkan-1.dll"
- name: Download Mesa3D driver
uses: robinraju/[email protected]
with:
repository: 'pal1000/mesa-dist-win'
tag: '${{ env.mesaDriverVersion }}'
fileName: 'mesa3d-${{ env.mesaDriverVersion }}-release-msvc.7z'
out-file-path: 'dep/mesa/' # ${{ github.workspace }} is prefixed automatically.
extract: false # 7zip is not supported by this extension, so we have to do it on our own later.
- name: Decompress Mesa3D driver
working-directory: '${{ github.workspace }}/dep/mesa/'
run: |
7z x '${{ github.workspace }}/dep/mesa/mesa3d-${{ env.mesaDriverVersion }}-release-msvc.7z'
- name: Install and Test Mesa3D driver
working-directory: '${{ github.workspace }}/dep/mesa/'
run: |
reg add "HKLM\SOFTWARE\Khronos\Vulkan\Drivers" /v '${{ github.workspace }}\dep\mesa\x64\lvp_icd.x86_64.json' /t REG_DWORD /d 0 /f /reg:64
reg add "HKLM\SOFTWARE\Khronos\Vulkan\ExplicitLayers" /v 'C:\VulkanSDK\${{ env.vulkanSdkVersion }}\Bin\VkLayer_khronos_synchronization2.json' /t REG_DWORD /d 0 /f /reg:64
reg add "HKLM\SOFTWARE\Khronos\Vulkan\ExplicitLayers" /v 'C:\VulkanSDK\${{ env.vulkanSdkVersion }}\Bin\VkLayer_khronos_validation.json' /t REG_DWORD /d 0 /f /reg:64
reg add "HKLM\SOFTWARE\WOW6432Node\Khronos\Vulkan\Drivers" /v '${{ github.workspace }}\dep\mesa\x86\lvp_icd.x86.json' /t REG_DWORD /d 0 /f /reg:64
reg add "HKLM\SOFTWARE\WOW6432Node\Khronos\Vulkan\ExplicitLayers" /v 'C:\VulkanSDK\${{ env.vulkanSdkVersion }}\Bin32\VkLayer_khronos_synchronization2.json' /t REG_DWORD /d 0 /f /reg:64
reg add "HKLM\SOFTWARE\WOW6432Node\Khronos\Vulkan\ExplicitLayers" /v 'C:\VulkanSDK\${{ env.vulkanSdkVersion }}\Bin32\VkLayer_khronos_validation.json' /t REG_DWORD /d 0 /f /reg:64
C:\VulkanSDK\${{ env.vulkanSdkVersion }}\runtime\x64\vulkaninfo.exe --summary
- name: Retrieve latest CMake build
uses: lukka/get-cmake@latest
- name: Restore or build vcpkg
uses: lukka/run-vcpkg@v10
with:
vcpkgDirectory: '${{ github.workspace }}/src/Modules/vcpkg'
vcpkgJsonGlob: '${{ github.workspace }}/src/vcpkg.json'
- name: Build Runtime and Tests
id: build-with-cmake
uses: lukka/run-cmake@v10
with:
cmakeListsTxtPath: '${{ github.workspace }}/src/CMakeLists.txt'
configurePreset: '${{ matrix.configuration }}'
configurePresetAdditionalArgs: "['-DLITEFX_BUILD_EXAMPLES=ON']"
buildPreset: '${{ matrix.configuration }}'
#testPreset: '${{ matrix.configuration }}'
#testPresetAdditionalArgs: "[ '--output-on-failure', '--timeout', '10' ]"
- name: Run tests
working-directory: "${{ github.workspace }}/out/build/${{ matrix.configuration }}"
shell: pwsh
run: |
OpenCppCoverage.exe --quiet --export_type=html:__coverage\html --export_type=binary:__coverage\bin --cover_children --sources='${{ github.workspace }}\src\' --modules=binaries\ -- ctest.exe ${{ matrix.configuration }} --output-on-failure --timeout 10
- name: Collect test results
id: collect-test-results
if: always()
shell: bash
working-directory: "${{ github.workspace }}/out/build/${{ matrix.configuration }}"
run: |
test_results=$(cat Testing/Temporary/LastTest.log)
echo "summary<<EOF"$'\n'"# Test Results π§ͺ"$'\n```\n'"$test_results"$'\n```'$'\n'EOF >> "$GITHUB_OUTPUT"
- name: Upload test results
if: success() || failure()
uses: actions/upload-artifact@v4
with:
name: LiteFX-${{ matrix.triplet }}-test-results
path: '${{ github.workspace }}/out/build/${{ matrix.configuration }}/Testing/Temporary/LastTest.log'
- name: Upload coverage results
if: success() || failure()
uses: actions/upload-artifact@v4
with:
name: LiteFX-${{ matrix.triplet }}-coverage-results
path: '${{ github.workspace }}/out/build/${{ matrix.configuration }}/__coverage/'
- name: Install with CMake
working-directory: '${{ github.workspace }}/out/build/${{ matrix.configuration }}'
run: cmake --install .
- name: Sign binaries
if: ${{ github.event.inputs.signArtifacts == 'true' }}
uses: dlemstra/code-sign-action@v1
with:
certificate: '${{ secrets.SIGN_CERTIFICATE_BASE64 }}'
password: '${{ secrets.SIGN_CERTIFICATE_PASSWORD }}'
folder: '${{ github.workspace }}/out/install/'
recursive: true
- name: Upload install artifacts
if: ${{ github.event.inputs.uploadArtifacts == 'true' }}
uses: actions/upload-artifact@v4
with:
name: LiteFX-${{ matrix.triplet }}-install
path: '${{ github.workspace }}/out/install/${{ matrix.configuration }}'
- name: Update checks
uses: LouisBrunner/[email protected]
if: always()
env:
SUMMARY: ${{ steps.collect-test-results.outputs.summary }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
check_id: ${{ steps.create-checks.outputs.check_id }}
sha: ${{ env.HEAD_SHA }}
conclusion: ${{ job.status }}
output: |
{ "summary": ${{ toJSON(env.SUMMARY) }} }