Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 55 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ jobs:
install -d "${stage}/skills" "${stage}/skill-data" "${stage}/office-skills" "${stage}/ocr-skills" "${stage}/dashboard"
install -m 0755 "target/${{ matrix.target }}/release/a3s-use" "${stage}/a3s-use"
install -m 0755 "target/${{ matrix.target }}/release/a3s-use-browser-driver" "${stage}/a3s-use-browser-driver"
A3S_USE_OCR_HOME="${stage}/ocr-models" \
"${stage}/a3s-use" component install ocr --json > "${RUNNER_TEMP}/ocr-model-install.json"
rm -f "${stage}/ocr-models/.install.lock"
cp -R crates/browser-driver/skills/. "${stage}/skills/"
cp -R crates/browser-driver/skill-data/. "${stage}/skill-data/"
cp -R crates/office/skills/. "${stage}/office-skills/"
Expand All @@ -108,6 +111,11 @@ jobs:
New-Item -ItemType Directory -Force -Path $stage | Out-Null
Copy-Item "target/${{ matrix.target }}/release/a3s-use.exe" "$stage/a3s-use.exe"
Copy-Item "target/${{ matrix.target }}/release/a3s-use-browser-driver.exe" "$stage/a3s-use-browser-driver.exe"
$env:A3S_USE_OCR_HOME = "$stage/ocr-models"
& "$stage/a3s-use.exe" component install ocr --json | Out-File "$env:RUNNER_TEMP/ocr-model-install.json"
if ($LASTEXITCODE -ne 0) { throw "Failed to install the pinned PP-OCRv6 release assets" }
Remove-Item Env:A3S_USE_OCR_HOME
Remove-Item "$stage/ocr-models/.install.lock" -ErrorAction SilentlyContinue
Copy-Item -Recurse "crates/browser-driver/skills" "$stage/skills"
Copy-Item -Recurse "crates/browser-driver/skill-data" "$stage/skill-data"
Copy-Item -Recurse "crates/office/skills" "$stage/office-skills"
Expand All @@ -131,6 +139,10 @@ jobs:
test -f "${install_root}/skill-data/core/SKILL.md"
test -f "${install_root}/office-skills/a3s-use-office/SKILL.md"
test -f "${install_root}/ocr-skills/a3s-use-ocr/SKILL.md"
test -f "${install_root}/ocr-models/PP-OCRv6_small/det/inference.onnx"
test -f "${install_root}/ocr-models/PP-OCRv6_small/det/inference.yml"
test -f "${install_root}/ocr-models/PP-OCRv6_small/rec/inference.onnx"
test -f "${install_root}/ocr-models/PP-OCRv6_small/rec/inference.yml"
test -f "${install_root}/dashboard/index.html"
test -f "${install_root}/LICENSE-APACHE-2.0"
test -f "${install_root}/UPSTREAM.md"
Expand All @@ -151,7 +163,27 @@ jobs:
import json, pathlib, sys
value = json.loads(pathlib.Path(sys.argv[1]).read_text())
assert value["ok"] is True
assert value["data"]["readiness"] in {"ready", "missing", "broken", "unknown"}
assert value["data"]["readiness"] == "ready"
assert value["data"]["provider"] == "pp-ocr-v6"
assert value["data"]["engine"] == "onnx-runtime"
assert value["data"]["model"] == "PP-OCRv6_small"
assert value["data"]["sendsSourceOffDevice"] is False
PY
python3 - "${RUNNER_TEMP}/ocr-white.bmp" <<'PY'
import base64, pathlib, sys
pathlib.Path(sys.argv[1]).write_bytes(base64.b64decode(
"Qk06AAAAAAAAADYAAAAoAAAAAQAAAAEAAAABABgAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAA////AA=="
))
PY
"${install_root}/a3s-use" ocr extract "${RUNNER_TEMP}/ocr-white.bmp" --json > "${RUNNER_TEMP}/ocr-extract.json"
python3 - "${RUNNER_TEMP}/ocr-extract.json" <<'PY'
import json, pathlib, sys
value = json.loads(pathlib.Path(sys.argv[1]).read_text())
assert value["ok"] is True
assert value["data"]["provider"] == "pp-ocr-v6"
assert value["data"]["engine"] == "onnx-runtime"
assert value["data"]["model"] == "PP-OCRv6_small"
assert value["data"]["source"]["mediaType"] == "image/bmp"
PY
"${install_root}/a3s-use" capability snapshot --json > "${RUNNER_TEMP}/capabilities.json"
python3 - "${RUNNER_TEMP}/capabilities.json" "${install_root}" <<'PY'
Expand Down Expand Up @@ -206,6 +238,10 @@ jobs:
"$root/skill-data/core/SKILL.md",
"$root/office-skills/a3s-use-office/SKILL.md",
"$root/ocr-skills/a3s-use-ocr/SKILL.md",
"$root/ocr-models/PP-OCRv6_small/det/inference.onnx",
"$root/ocr-models/PP-OCRv6_small/det/inference.yml",
"$root/ocr-models/PP-OCRv6_small/rec/inference.onnx",
"$root/ocr-models/PP-OCRv6_small/rec/inference.yml",
"$root/dashboard/index.html",
"$root/LICENSE-APACHE-2.0",
"$root/UPSTREAM.md",
Expand All @@ -222,7 +258,24 @@ jobs:
throw "Packaged Office Skill smoke failed"
}
$ocr = (& "$root/a3s-use.exe" ocr doctor --json | ConvertFrom-Json)
if (-not $ocr.ok -or -not $ocr.data.readiness) { throw "Built-in OCR doctor smoke failed" }
if (
-not $ocr.ok -or
$ocr.data.readiness -ne "ready" -or
$ocr.data.provider -ne "pp-ocr-v6" -or
$ocr.data.engine -ne "onnx-runtime" -or
$ocr.data.model -ne "PP-OCRv6_small" -or
$ocr.data.sendsSourceOffDevice
) { throw "Packaged PP-OCRv6 doctor smoke failed" }
$whiteBmp = [Convert]::FromBase64String("Qk06AAAAAAAAADYAAAAoAAAAAQAAAAEAAAABABgAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAA////AA==")
[IO.File]::WriteAllBytes("$env:RUNNER_TEMP/ocr-white.bmp", $whiteBmp)
$ocrExtract = (& "$root/a3s-use.exe" ocr extract "$env:RUNNER_TEMP/ocr-white.bmp" --json | ConvertFrom-Json)
if (
-not $ocrExtract.ok -or
$ocrExtract.data.provider -ne "pp-ocr-v6" -or
$ocrExtract.data.engine -ne "onnx-runtime" -or
$ocrExtract.data.model -ne "PP-OCRv6_small" -or
$ocrExtract.data.source.mediaType -ne "image/bmp"
) { throw "Packaged PP-OCRv6 extraction smoke failed" }
$capabilities = (& "$root/a3s-use.exe" capability snapshot --json | ConvertFrom-Json)
$ocrCapability = $capabilities.data.registry.capabilities |
Where-Object id -eq "use/ocr"
Expand Down
Loading
Loading