-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
214 lines (184 loc) · 7.65 KB
/
Copy pathdep-swiftshader.yml
File metadata and controls
214 lines (184 loc) · 7.65 KB
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
name: "Dep: Build & Deploy SwiftShader"
on:
workflow_dispatch:
inputs:
version:
description: NuGet package version (leave empty for date-based)
required: false
jobs:
build-windows:
name: Build SwiftShader (Windows x64)
runs-on: windows-2025-vs2026
env:
CMAKE_POLICY_VERSION_MINIMUM: "3.5"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Checkout SwiftShader
uses: actions/checkout@v4
with:
repository: google/swiftshader
submodules: recursive
path: swiftshader-src
- name: Build
shell: pwsh
run: |
cmake -S swiftshader-src -B swiftshader-build -Thost=x64 -DSWIFTSHADER_BUILD_TESTS=OFF -DSWIFTSHADER_BUILD_BENCHMARKS=OFF
cmake --build swiftshader-build --config Release --target vk_swiftshader
- name: Upload build output
uses: actions/upload-artifact@v4
with:
name: swiftshader-win-x64
path: |
swiftshader-build/**/vk_swiftshader.dll
swiftshader-build/**/vk_swiftshader_icd.json
build-linux:
name: Build SwiftShader (Linux x64)
runs-on: ubuntu-24.04
env:
CMAKE_POLICY_VERSION_MINIMUM: "3.5"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Checkout SwiftShader
uses: actions/checkout@v4
with:
repository: google/swiftshader
submodules: recursive
path: swiftshader-src
- name: Build
run: |
cmake -S swiftshader-src -B swiftshader-build -DCMAKE_BUILD_TYPE=Release -DSWIFTSHADER_BUILD_TESTS=OFF -DSWIFTSHADER_BUILD_BENCHMARKS=OFF
cmake --build swiftshader-build --target vk_swiftshader -- -j$(nproc)
- name: Collect build output
run: |
mkdir -p swiftshader-out
find swiftshader-build -maxdepth 2 -name "libvk_swiftshader.so" -exec cp {} swiftshader-out/ \;
find swiftshader-build -maxdepth 2 -name "vk_swiftshader_icd.json" -exec cp {} swiftshader-out/ \;
- name: Upload build output
uses: actions/upload-artifact@v4
with:
name: swiftshader-linux-x64
path: swiftshader-out/
build-macos:
name: Build SwiftShader (macOS ARM64)
runs-on: macos-15
env:
CMAKE_POLICY_VERSION_MINIMUM: "3.5"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Checkout SwiftShader
uses: actions/checkout@v4
with:
repository: google/swiftshader
submodules: recursive
path: swiftshader-src
- name: Build
run: |
cmake -S swiftshader-src -B swiftshader-build -DCMAKE_BUILD_TYPE=Release -DSWIFTSHADER_BUILD_TESTS=OFF -DSWIFTSHADER_BUILD_BENCHMARKS=OFF
cmake --build swiftshader-build --target vk_swiftshader -- -j$(sysctl -n hw.ncpu)
- name: Collect build output
run: |
mkdir -p swiftshader-out
find swiftshader-build -maxdepth 2 -name "libvk_swiftshader.dylib" -exec cp {} swiftshader-out/ \;
find swiftshader-build -maxdepth 2 -name "vk_swiftshader_icd.json" -exec cp {} swiftshader-out/ \;
- name: Upload build output
uses: actions/upload-artifact@v4
with:
name: swiftshader-osx-arm64
path: swiftshader-out/
pack:
name: Pack & Publish NuGet
needs: [build-windows, build-linux, build-macos]
runs-on: windows-2025-vs2026
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Checkout SwiftShader (for commit hash)
uses: actions/checkout@v4
with:
repository: google/swiftshader
path: swiftshader-src
fetch-depth: 1
- name: Download Windows artifact
uses: actions/download-artifact@v4
with:
name: swiftshader-win-x64
path: artifacts/win-x64
- name: Download Linux artifact
uses: actions/download-artifact@v4
with:
name: swiftshader-linux-x64
path: artifacts/linux-x64
- name: Download macOS artifact
uses: actions/download-artifact@v4
with:
name: swiftshader-osx-arm64
path: artifacts/osx-arm64
- name: Prepare package contents
shell: pwsh
run: |
$destDir = "build/deps/swiftshader"
# Windows
New-Item -Path "$destDir/win-x64" -ItemType Directory -Force | Out-Null
$winDll = Get-ChildItem -Recurse -Path artifacts/win-x64 -Filter vk_swiftshader.dll | Select-Object -First 1
Copy-Item $winDll.FullName "$destDir/win-x64/"
$winIcd = Get-ChildItem -Recurse -Path artifacts/win-x64 -Filter vk_swiftshader_icd.json | Select-Object -First 1
Copy-Item $winIcd.FullName "$destDir/win-x64/"
# Linux
New-Item -Path "$destDir/linux-x64" -ItemType Directory -Force | Out-Null
$linuxSo = Get-ChildItem -Recurse -Path artifacts/linux-x64 -Filter libvk_swiftshader.so | Select-Object -First 1
Copy-Item $linuxSo.FullName "$destDir/linux-x64/"
$linuxIcd = Get-ChildItem -Recurse -Path artifacts/linux-x64 -Filter vk_swiftshader_icd.json | Select-Object -First 1
Copy-Item $linuxIcd.FullName "$destDir/linux-x64/"
# macOS
New-Item -Path "$destDir/osx-arm64" -ItemType Directory -Force | Out-Null
$macDylib = Get-ChildItem -Recurse -Path artifacts/osx-arm64 -Filter libvk_swiftshader.dylib | Select-Object -First 1
Copy-Item $macDylib.FullName "$destDir/osx-arm64/"
$macIcd = Get-ChildItem -Recurse -Path artifacts/osx-arm64 -Filter vk_swiftshader_icd.json | Select-Object -First 1
Copy-Item $macIcd.FullName "$destDir/osx-arm64/"
- name: Pack NuGet
shell: pwsh
run: |
$commitHash = git -C swiftshader-src rev-parse --short HEAD
$version = "${{ github.event.inputs.version }}"
if (-not $version) { $version = (Get-Date -Format "yyyy.M.d") }
nuget pack build/deps/swiftshader/Stride.Dependencies.SwiftShader.nuspec `
-Version $version `
-Properties "commit=$commitHash" `
-OutputDirectory nupkg
echo "PACKAGE_VERSION=$version" >> $env:GITHUB_ENV
- name: Upload package artifact
uses: actions/upload-artifact@v4
with:
name: Stride.Dependencies.SwiftShader.nupkg
path: nupkg/*.nupkg
publish:
name: Sign & Publish to NuGet.org
needs: pack
runs-on: windows-2025-vs2026
environment: production
steps:
- name: Install signing tool
run: dotnet tool install sign --tool-path ./sign-tool --version 0.9.0-beta.23127.3
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: Stride.Dependencies.SwiftShader.nupkg
- name: Sign NuGet package
shell: pwsh
run: |
./sign-tool/sign code azure-key-vault *.nupkg `
--description "Stride" `
--description-url "https://stride3d.net" `
--publisher-name "Stride" `
--azure-key-vault-tenant-id "${{ secrets.STRIDE_SIGN_TENANT_ID }}" `
--azure-key-vault-client-id "${{ secrets.STRIDE_SIGN_CLIENT_ID }}" `
--azure-key-vault-client-secret "${{ secrets.STRIDE_SIGN_CLIENT_SECRET }}" `
--azure-key-vault-certificate "${{ secrets.STRIDE_SIGN_KEYVAULT_CERTIFICATE }}" `
--azure-key-vault-url "https://${{ secrets.STRIDE_SIGN_KEYVAULT_NAME }}.vault.azure.net/" `
-v Information
- name: Publish
run: |
dotnet nuget push *.nupkg --api-key "${{ secrets.STRIDE_NUGET_API_KEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate