Skip to content

Commit e5fc03f

Browse files
authored
Merge pull request #3127 from stride3d/feature/ci-gpu-linux
Linux build and CI
2 parents 2b8b8d7 + ad4f580 commit e5fc03f

222 files changed

Lines changed: 4471 additions & 380 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/dep-freetype.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -262,13 +262,12 @@ jobs:
262262
263263
# Version info
264264
COMMIT=$(git -C freetype-src rev-parse HEAD)
265-
cat > $OUT/VERSION.txt <<EOF
266-
FreeType ${{ github.event.inputs.freetype-version }}
267-
Repository: https://github.com/freetype/freetype
268-
Commit: $COMMIT
269-
Built: $(date -u +%Y-%m-%d)
270-
Workflow: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
271-
EOF
265+
printf 'FreeType %s\nRepository: https://github.com/freetype/freetype\nCommit: %s\nBuilt: %s\nWorkflow: %s\n' \
266+
"${{ github.event.inputs.freetype-version }}" \
267+
"$COMMIT" \
268+
"$(date -u +%Y-%m-%d)" \
269+
"${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" \
270+
> $OUT/VERSION.txt
272271
273272
- name: List contents
274273
run: find freetype-out -type f | sort

.github/workflows/dep-swiftshader.yml

Lines changed: 132 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
required: false
99

1010
jobs:
11-
build:
11+
build-windows:
1212
name: Build SwiftShader (Windows x64)
1313
runs-on: windows-2025-vs2026
1414
env:
@@ -28,17 +28,140 @@ jobs:
2828
shell: pwsh
2929
run: |
3030
cmake -S swiftshader-src -B swiftshader-build -Thost=x64 -DSWIFTSHADER_BUILD_TESTS=OFF -DSWIFTSHADER_BUILD_BENCHMARKS=OFF
31-
cmake --build swiftshader-build --config RelWithDebInfo --target vk_swiftshader
31+
cmake --build swiftshader-build --config Release --target vk_swiftshader
32+
33+
- name: Upload build output
34+
uses: actions/upload-artifact@v4
35+
with:
36+
name: swiftshader-win-x64
37+
path: |
38+
swiftshader-build/**/vk_swiftshader.dll
39+
swiftshader-build/**/vk_swiftshader_icd.json
40+
41+
build-linux:
42+
name: Build SwiftShader (Linux x64)
43+
runs-on: ubuntu-24.04
44+
env:
45+
CMAKE_POLICY_VERSION_MINIMUM: "3.5"
46+
steps:
47+
- name: Checkout
48+
uses: actions/checkout@v4
49+
50+
- name: Checkout SwiftShader
51+
uses: actions/checkout@v4
52+
with:
53+
repository: google/swiftshader
54+
submodules: recursive
55+
path: swiftshader-src
56+
57+
- name: Build
58+
run: |
59+
cmake -S swiftshader-src -B swiftshader-build -DCMAKE_BUILD_TYPE=Release -DSWIFTSHADER_BUILD_TESTS=OFF -DSWIFTSHADER_BUILD_BENCHMARKS=OFF
60+
cmake --build swiftshader-build --target vk_swiftshader -- -j$(nproc)
61+
62+
- name: Collect build output
63+
run: |
64+
mkdir -p swiftshader-out
65+
find swiftshader-build -maxdepth 2 -name "libvk_swiftshader.so" -exec cp {} swiftshader-out/ \;
66+
find swiftshader-build -maxdepth 2 -name "vk_swiftshader_icd.json" -exec cp {} swiftshader-out/ \;
67+
68+
- name: Upload build output
69+
uses: actions/upload-artifact@v4
70+
with:
71+
name: swiftshader-linux-x64
72+
path: swiftshader-out/
73+
74+
build-macos:
75+
name: Build SwiftShader (macOS ARM64)
76+
runs-on: macos-15
77+
env:
78+
CMAKE_POLICY_VERSION_MINIMUM: "3.5"
79+
steps:
80+
- name: Checkout
81+
uses: actions/checkout@v4
82+
83+
- name: Checkout SwiftShader
84+
uses: actions/checkout@v4
85+
with:
86+
repository: google/swiftshader
87+
submodules: recursive
88+
path: swiftshader-src
89+
90+
- name: Build
91+
run: |
92+
cmake -S swiftshader-src -B swiftshader-build -DCMAKE_BUILD_TYPE=Release -DSWIFTSHADER_BUILD_TESTS=OFF -DSWIFTSHADER_BUILD_BENCHMARKS=OFF
93+
cmake --build swiftshader-build --target vk_swiftshader -- -j$(sysctl -n hw.ncpu)
94+
95+
- name: Collect build output
96+
run: |
97+
mkdir -p swiftshader-out
98+
find swiftshader-build -maxdepth 2 -name "libvk_swiftshader.dylib" -exec cp {} swiftshader-out/ \;
99+
find swiftshader-build -maxdepth 2 -name "vk_swiftshader_icd.json" -exec cp {} swiftshader-out/ \;
100+
101+
- name: Upload build output
102+
uses: actions/upload-artifact@v4
103+
with:
104+
name: swiftshader-osx-arm64
105+
path: swiftshader-out/
106+
107+
pack:
108+
name: Pack & Publish NuGet
109+
needs: [build-windows, build-linux, build-macos]
110+
runs-on: windows-2025-vs2026
111+
steps:
112+
- name: Checkout
113+
uses: actions/checkout@v4
114+
115+
- name: Checkout SwiftShader (for commit hash)
116+
uses: actions/checkout@v4
117+
with:
118+
repository: google/swiftshader
119+
path: swiftshader-src
120+
fetch-depth: 1
121+
122+
- name: Download Windows artifact
123+
uses: actions/download-artifact@v4
124+
with:
125+
name: swiftshader-win-x64
126+
path: artifacts/win-x64
127+
128+
- name: Download Linux artifact
129+
uses: actions/download-artifact@v4
130+
with:
131+
name: swiftshader-linux-x64
132+
path: artifacts/linux-x64
133+
134+
- name: Download macOS artifact
135+
uses: actions/download-artifact@v4
136+
with:
137+
name: swiftshader-osx-arm64
138+
path: artifacts/osx-arm64
32139

33140
- name: Prepare package contents
34141
shell: pwsh
35142
run: |
36143
$destDir = "build/deps/swiftshader"
37-
Copy-Item swiftshader-build/RelWithDebInfo/vk_swiftshader.dll $destDir/
38-
# ICD JSON is generated in a platform-specific directory by cmake
39-
$icdJson = Get-ChildItem -Recurse -Path swiftshader-build -Filter vk_swiftshader_icd.json | Select-Object -First 1
40-
if (-not $icdJson) { throw "vk_swiftshader_icd.json not found in build output" }
41-
Copy-Item $icdJson.FullName $destDir/
144+
145+
# Windows
146+
New-Item -Path "$destDir/win-x64" -ItemType Directory -Force | Out-Null
147+
$winDll = Get-ChildItem -Recurse -Path artifacts/win-x64 -Filter vk_swiftshader.dll | Select-Object -First 1
148+
Copy-Item $winDll.FullName "$destDir/win-x64/"
149+
$winIcd = Get-ChildItem -Recurse -Path artifacts/win-x64 -Filter vk_swiftshader_icd.json | Select-Object -First 1
150+
Copy-Item $winIcd.FullName "$destDir/win-x64/"
151+
152+
# Linux
153+
New-Item -Path "$destDir/linux-x64" -ItemType Directory -Force | Out-Null
154+
$linuxSo = Get-ChildItem -Recurse -Path artifacts/linux-x64 -Filter libvk_swiftshader.so | Select-Object -First 1
155+
Copy-Item $linuxSo.FullName "$destDir/linux-x64/"
156+
$linuxIcd = Get-ChildItem -Recurse -Path artifacts/linux-x64 -Filter vk_swiftshader_icd.json | Select-Object -First 1
157+
Copy-Item $linuxIcd.FullName "$destDir/linux-x64/"
158+
159+
# macOS
160+
New-Item -Path "$destDir/osx-arm64" -ItemType Directory -Force | Out-Null
161+
$macDylib = Get-ChildItem -Recurse -Path artifacts/osx-arm64 -Filter libvk_swiftshader.dylib | Select-Object -First 1
162+
Copy-Item $macDylib.FullName "$destDir/osx-arm64/"
163+
$macIcd = Get-ChildItem -Recurse -Path artifacts/osx-arm64 -Filter vk_swiftshader_icd.json | Select-Object -First 1
164+
Copy-Item $macIcd.FullName "$destDir/osx-arm64/"
42165
43166
- name: Pack NuGet
44167
shell: pwsh
@@ -52,15 +175,15 @@ jobs:
52175
-OutputDirectory nupkg
53176
echo "PACKAGE_VERSION=$version" >> $env:GITHUB_ENV
54177
55-
- name: Upload artifact
178+
- name: Upload package artifact
56179
uses: actions/upload-artifact@v4
57180
with:
58181
name: Stride.Dependencies.SwiftShader.nupkg
59182
path: nupkg/*.nupkg
60183

61184
publish:
62185
name: Sign & Publish to NuGet.org
63-
needs: build
186+
needs: pack
64187
runs-on: windows-2025-vs2026
65188
environment: production
66189
steps:

.github/workflows/main.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ on:
2828
types: [opened, synchronize, reopened, ready_for_review]
2929
workflow_dispatch:
3030

31+
permissions:
32+
checks: write
33+
contents: read
34+
3135
concurrency:
3236
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
3337
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
@@ -105,3 +109,17 @@ jobs:
105109
secrets: inherit
106110
with:
107111
build-type: Debug
112+
113+
Linux-Tests-Simple:
114+
needs: Linux-Runtime
115+
uses: ./.github/workflows/test-linux-simple.yml
116+
secrets: inherit
117+
with:
118+
build-type: Debug
119+
120+
Linux-Tests-Game:
121+
needs: Linux-Runtime
122+
uses: ./.github/workflows/test-linux-game.yml
123+
secrets: inherit
124+
with:
125+
build-type: Debug

0 commit comments

Comments
 (0)