Skip to content

Commit 74a3881

Browse files
committed
fix: 修复 ci 补充打包内容
1 parent 2a18ce9 commit 74a3881

2 files changed

Lines changed: 37 additions & 13 deletions

File tree

.github/workflows/cpp-cmake-ci.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -163,20 +163,26 @@ jobs:
163163
run: |
164164
package_dir="dist/${{ matrix.artifact_name }}"
165165
mkdir -p "${package_dir}"
166-
cp "build/bin/${APP_NAME}" "${package_dir}/"
166+
cp "build/Release/bin/${APP_NAME}" "${package_dir}/"
167167
cp README.md "${package_dir}/"
168-
if [ -f "models/cat_vs_dog/best.onnx" ]; then
169-
mkdir -p "${package_dir}/models/cat_vs_dog"
170-
cp "models/cat_vs_dog/best.onnx" "${package_dir}/models/cat_vs_dog/"
171-
fi
168+
for model_dir in "models/cat_vs_dog" "models/WellColumnClassification"; do
169+
if [ -d "${model_dir}" ]; then
170+
mkdir -p "${package_dir}/${model_dir}"
171+
for file_name in "best.onnx" "labels.txt" "dataset_summary.json"; do
172+
if [ -f "${model_dir}/${file_name}" ]; then
173+
cp "${model_dir}/${file_name}" "${package_dir}/${model_dir}/"
174+
fi
175+
done
176+
fi
177+
done
172178
tar -C dist -czf "dist/${{ matrix.artifact_name }}.tar.gz" "${{ matrix.artifact_name }}"
173179
174180
- name: Upload Windows artifact
175181
if: runner.os == 'Windows'
176182
uses: actions/upload-artifact@v6
177183
with:
178184
name: ${{ matrix.artifact_name }}
179-
path: dist/${{ matrix.artifact_name }}.zip
185+
path: dist/${{ matrix.artifact_name }}
180186
if-no-files-found: error
181187

182188
- name: Upload Linux artifact

scripts/package-windows.ps1

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ if ([string]::IsNullOrWhiteSpace($vcpkgTriplet)) {
2727
}
2828

2929
$workspaceRoot = Get-Location
30-
$exePath = Join-Path $buildDir "bin\$appName.exe"
30+
$exePath = Join-Path $buildDir "Release\bin\$appName.exe"
3131
$packageName = "$appName-windows-x64"
3232
$packageRoot = Join-Path $distDir $packageName
3333
$zipPath = Join-Path $distDir "$packageName.zip"
@@ -38,7 +38,6 @@ $requiredRuntimeDlls = @(
3838
"libprotobuf-lite.dll",
3939
"libprotobuf.dll"
4040
)
41-
4241
if (-not (Test-Path -LiteralPath $exePath)) {
4342
throw "Built executable not found: $exePath"
4443
}
@@ -56,11 +55,30 @@ if (Test-Path -LiteralPath $readmePath) {
5655
Copy-Item -LiteralPath $readmePath -Destination $packageRoot
5756
}
5857

59-
$modelPath = Join-Path $workspaceRoot "models\cat_vs_dog\best.onnx"
60-
if (Test-Path -LiteralPath $modelPath) {
61-
$modelDir = Join-Path $packageRoot "models\cat_vs_dog"
62-
New-Item -ItemType Directory -Path $modelDir -Force | Out-Null
63-
Copy-Item -LiteralPath $modelPath -Destination $modelDir
58+
$catDogModelDir = Join-Path $workspaceRoot "models\cat_vs_dog"
59+
if (Test-Path -LiteralPath $catDogModelDir) {
60+
$targetDir = Join-Path $packageRoot "models\cat_vs_dog"
61+
New-Item -ItemType Directory -Path $targetDir -Force | Out-Null
62+
63+
foreach ($fileName in @("best.onnx", "labels.txt", "dataset_summary.json")) {
64+
$sourcePath = Join-Path $catDogModelDir $fileName
65+
if (Test-Path -LiteralPath $sourcePath) {
66+
Copy-Item -LiteralPath $sourcePath -Destination $targetDir
67+
}
68+
}
69+
}
70+
71+
$wellColumnModelDir = Join-Path $workspaceRoot "models\WellColumnClassification"
72+
if (Test-Path -LiteralPath $wellColumnModelDir) {
73+
$targetDir = Join-Path $packageRoot "models\WellColumnClassification"
74+
New-Item -ItemType Directory -Path $targetDir -Force | Out-Null
75+
76+
foreach ($fileName in @("best.onnx", "labels.txt", "dataset_summary.json")) {
77+
$sourcePath = Join-Path $wellColumnModelDir $fileName
78+
if (Test-Path -LiteralPath $sourcePath) {
79+
Copy-Item -LiteralPath $sourcePath -Destination $targetDir
80+
}
81+
}
6482
}
6583

6684
$runtimeBinDir = Join-Path $vcpkgRoot "installed\$vcpkgTriplet\bin"

0 commit comments

Comments
 (0)