forked from FULU-Foundation/OrcaSlicer-bambulab
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_windows_bridge.yml
More file actions
237 lines (197 loc) · 8.29 KB
/
Copy pathbuild_windows_bridge.yml
File metadata and controls
237 lines (197 loc) · 8.29 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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
name: Build Windows with Linux bridge runtime
on:
workflow_call:
workflow_dispatch:
jobs:
prepare_linux_bridge_runtime:
name: Prepare Linux bridge runtime
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v6
with:
lfs: 'false'
- uses: lukka/get-cmake@latest
with:
cmakeVersion: "~4.3.0"
useLocalCache: true
useCloudCache: true
- name: Apt-Install Dependencies
uses: ./.github/actions/apt-install-deps
- name: Build Linux deps
shell: bash
run: |
set -euo pipefail
for attempt in 1 2 3; do
echo "Build Linux deps attempt $attempt"
if ./build_linux.sh -drlL; then
exit 0
fi
if [ "$attempt" -lt 3 ]; then
echo "Transient dependency download/build failure, retrying after backoff"
sleep $((attempt * 20))
fi
done
exit 1
- name: Configure linux bridge host build
shell: bash
run: |
cmake -S . -B build -G "Ninja Multi-Config" -DORCA_TOOLS=ON
- name: Build linux host runtime and WSL rootfs
shell: bash
run: |
cmake --build build --config Release --target pjarczak_bambu_linux_host
bash tools/pjarczak_bambu_linux_host/package_linux_host_runtime.sh build
bash tools/pjarczak_bambu_runtime/rootfs/build_windows_wsl_rootfs.sh tools/pjarczak_bambu_runtime/rootfs/windows-wsl2-rootfs.tar
tar -czvf linux_host_runtime_${{ github.sha }}.tar.gz -C tools/pjarczak_bambu_linux_host/runtime linux-x86_64
tar -czvf wsl_rootfs_${{ github.sha }}.tar.gz -C tools/pjarczak_bambu_runtime/rootfs windows-wsl2-rootfs.tar
- name: Show packaged linux bridge runtime files
shell: bash
run: |
find tools/pjarczak_bambu_linux_host/runtime/linux-x86_64 -maxdepth 1 -type f | sort
- name: Upload linux host runtime artifact
uses: actions/upload-artifact@v7
with:
name: linux_host_runtime_windows_${{ github.sha }}
path: ./linux_host_runtime_${{ github.sha }}.tar.gz
if-no-files-found: error
- name: Upload WSL rootfs artifact
uses: actions/upload-artifact@v7
with:
name: wsl_rootfs_${{ github.sha }}
path: ./wsl_rootfs_${{ github.sha }}.tar.gz
if-no-files-found: error
build_windows:
name: Build Windows
runs-on: windows-latest
needs: prepare_linux_bridge_runtime
env:
ORCA_UPDATER_SIG_KEY: ${{ secrets.ORCA_UPDATER_SIG_KEY }}
steps:
- name: Checkout
uses: actions/checkout@v6
with:
lfs: 'false'
- uses: lukka/get-cmake@latest
with:
cmakeVersion: "~4.3.0"
useLocalCache: true
useCloudCache: true
- name: Get the version and date on Windows
shell: pwsh
run: |
$date = Get-Date -Format 'yyyyMMdd'
$eventName = "${{ github.event_name }}"
$prNumber = "${{ github.event.number }}"
if ($eventName -eq 'pull_request') {
$ver = "PR" + $prNumber
} else {
$versionContent = Get-Content version.inc -Raw
if ($versionContent -match 'set\(SoftFever_VERSION "(.*?)"\)') {
$ver = $matches[1]
}
$ver = "V$ver"
}
echo "ver=$ver" | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8
echo "date=$date" | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8
- name: Download linux host runtime artifact
uses: actions/download-artifact@v8
with:
name: linux_host_runtime_windows_${{ github.sha }}
path: ${{ github.workspace }}/linux_host_runtime_artifact
- name: Extract linux host runtime artifact on Windows
working-directory: ${{ github.workspace }}
shell: pwsh
run: |
New-Item -ItemType Directory -Force -Path "$env:GITHUB_WORKSPACE\tools\pjarczak_bambu_linux_host\runtime" | Out-Null
tar -xzf "$env:GITHUB_WORKSPACE\linux_host_runtime_artifact\linux_host_runtime_${{ github.sha }}.tar.gz" -C "$env:GITHUB_WORKSPACE\tools\pjarczak_bambu_linux_host\runtime"
- name: Download WSL rootfs artifact
uses: actions/download-artifact@v8
with:
name: wsl_rootfs_${{ github.sha }}
path: ${{ github.workspace }}/wsl_rootfs_artifact
- name: Extract WSL rootfs artifact on Windows
working-directory: ${{ github.workspace }}
shell: pwsh
run: |
New-Item -ItemType Directory -Force -Path "$env:GITHUB_WORKSPACE\tools\pjarczak_bambu_runtime\rootfs" | Out-Null
tar -xzf "$env:GITHUB_WORKSPACE\wsl_rootfs_artifact\wsl_rootfs_${{ github.sha }}.tar.gz" -C "$env:GITHUB_WORKSPACE\tools\pjarczak_bambu_runtime\rootfs"
- name: setup MSVC
uses: microsoft/setup-msbuild@v2
- name: Install nsis
shell: pwsh
run: |
choco install nsis -y
- name: Build Windows deps
working-directory: ${{ github.workspace }}
env:
WindowsSdkDir: 'C:\Program Files (x86)\Windows Kits\10\'
WindowsSDKVersion: '10.0.26100.0\'
shell: pwsh
run: .\build_release_vs.bat deps
- name: Build slicer Win
working-directory: ${{ github.workspace }}
env:
WindowsSdkDir: 'C:\Program Files (x86)\Windows Kits\10\'
WindowsSDKVersion: '10.0.26100.0\'
shell: pwsh
run: .\build_release_vs.bat slicer
- name: Ensure WSL is available for runtime validation
shell: pwsh
run: |
$wsl = Join-Path $env:WINDIR 'System32\wsl.exe'
if (!(Test-Path $wsl)) { throw 'wsl.exe not found' }
$ready = $false
try {
& $wsl --status
if ($LASTEXITCODE -eq 0) { $ready = $true }
} catch {}
if (-not $ready) {
& $wsl --install --no-distribution
if ($LASTEXITCODE -ne 0) { throw 'wsl --install --no-distribution failed' }
}
& $wsl --update
if ($LASTEXITCODE -ne 0) { throw 'wsl --update failed' }
& $wsl --status
if ($LASTEXITCODE -ne 0) { throw 'WSL is still not ready after install/update' }
- name: Show packaged Orca runtime files
shell: pwsh
run: |
Get-ChildItem -Force "$env:GITHUB_WORKSPACE\build\OrcaSlicer" | Format-Table Name, Length -AutoSize
- name: Install bundled WSL2 Orca runtime into live plugins dir
shell: pwsh
run: |
& "$env:GITHUB_WORKSPACE\build\OrcaSlicer\install_runtime.ps1" -ReplaceExisting
- name: Show live Orca plugin dir after installer
shell: pwsh
run: |
Get-ChildItem -Force "$env:APPDATA\OrcaSlicer\plugins" | Format-Table Name, Length -AutoSize
Write-Host "--- cache dir ---"
if (Test-Path "$env:APPDATA\OrcaSlicer\ota\plugins") {
Get-ChildItem -Force "$env:APPDATA\OrcaSlicer\ota\plugins" | Format-Table Name, Length -AutoSize
}
- name: Validate live Orca plugin dir bootstrap package
shell: pwsh
run: |
& "$env:APPDATA\OrcaSlicer\plugins\verify_runtime.ps1" -PackageDir "$env:APPDATA\OrcaSlicer\plugins" -PluginCacheDir "$env:APPDATA\OrcaSlicer\ota\plugins" -AllowMissingLinuxPlugin
- name: Create installer Win
working-directory: ${{ github.workspace }}/build
shell: pwsh
run: |
cpack -G NSIS
- name: Pack app
working-directory: ${{ github.workspace }}/build
shell: cmd
run: '"C:/Program Files/7-Zip/7z.exe" a -tzip OrcaSlicer_Windows_${{ env.ver }}_portable.zip ${{ github.workspace }}/build/OrcaSlicer'
- name: Upload artifacts Win portable
uses: actions/upload-artifact@v7
with:
name: OrcaSlicer_Windows_${{ env.ver }}_portable
path: ${{ github.workspace }}/build/OrcaSlicer_Windows_${{ env.ver }}_portable.zip
if-no-files-found: error
- name: Upload artifacts Win installer
uses: actions/upload-artifact@v7
with:
name: OrcaSlicer_Windows_${{ env.ver }}_installer
path: ${{ github.workspace }}/build/OrcaSlicer*.exe
if-no-files-found: error