Build Windows portable / build (push) Canceled after 0s
User yeu cau: khach hang khong co font chuan san — phan mem phai tu chuan bi
font, khong duoc thay bang font "gan giong". Truoc do font nhung cua PDF da
dung cho o sua (build 35), nhung con 3 khe ho roi ve font he thong: font
khong nhung trong PDF, font CFF khong va duoc, va KY TU MOI GO VAO khong co
trong subset (subset chi chua glyph da dung).
- scripts/fetch-fonts.ps1: tai 10 file Noto hinted static (Sans/Serif/Mono,
du Regular/Bold/Italic/BoldItalic, phu tieng Viet, ~6.7MB) + OFL license
vao fonts/ (gitignore; CI cache theo hash script).
- CI: fetch fonts + dong fonts/ vao zip portable (canh exe).
- Tauri: main() dat FOFREEXIT_FONTS_PATH (fonts/ canh exe, dev thi goc
workspace); command app_font_data(kind) tra base64 (whitelist 10 kind).
- UI: FontFace "ff-app-{sans|serif|mono}" dang ky theo weight/style, dung
GIUA stack: font nhung cua PDF -> Noto dong goi -> stack he thong (luoi
cuoi). Phan loai serif/sans/mono tu cssFontStack. Nap truoc cung font
nhung khi vao trang sua.
- Engine find_font_bytes (duong ghi file/reflow can font coverage): uu tien
tuyet doi fonts/ dong goi qua env — ket qua LUU ra giong nhau tren moi may
(truoc: lay Arial/Segoe cua Windows, may khach thieu font la khac ket qua).
E2E ke tiep (build 36): go ky tu ngoai subset trong o sua -> 100% glyph phai
tu font custom (nhung/dong goi), 0 glyph he thong.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
114 lines
4.2 KiB
YAML
114 lines
4.2 KiB
YAML
name: Build Windows portable
|
|
|
|
on:
|
|
workflow_dispatch: {}
|
|
push:
|
|
branches: [main]
|
|
paths:
|
|
- "app/**"
|
|
- "crates/**"
|
|
- "Cargo.lock"
|
|
- "scripts/fetch-pdfium.ps1"
|
|
- "scripts/fetch-qpdf.ps1"
|
|
- ".github/workflows/build-windows.yml"
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: windows-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
|
|
- name: Cache cargo
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.cargo/registry
|
|
~/.cargo/git
|
|
target
|
|
app/src-tauri/target
|
|
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
- name: Fetch PDFium (Windows x64)
|
|
shell: pwsh
|
|
run: powershell -ExecutionPolicy Bypass -File scripts/fetch-pdfium.ps1
|
|
|
|
- name: Fetch QPDF (Windows x64)
|
|
shell: pwsh
|
|
run: powershell -ExecutionPolicy Bypass -File scripts/fetch-qpdf.ps1
|
|
|
|
# Bộ font Noto đóng gói theo app (phủ tiếng Việt) — hiển thị/ghi file
|
|
# giống nhau trên mọi máy khách, không phụ thuộc font hệ điều hành.
|
|
- name: Cache bundled fonts
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: fonts
|
|
key: noto-fonts-${{ hashFiles('scripts/fetch-fonts.ps1') }}
|
|
|
|
- name: Fetch bundled fonts (Noto)
|
|
shell: pwsh
|
|
run: powershell -ExecutionPolicy Bypass -File scripts/fetch-fonts.ps1
|
|
|
|
# Test OCR cần tesseract thật (eng + vie). Chocolatey có sẵn trên runner.
|
|
- name: Install Tesseract OCR (eng + vie)
|
|
shell: pwsh
|
|
run: |
|
|
choco install tesseract -y --no-progress
|
|
$tessdata = "C:\Program Files\Tesseract-OCR\tessdata"
|
|
Invoke-WebRequest "https://github.com/tesseract-ocr/tessdata_fast/raw/main/vie.traineddata" -OutFile "$tessdata\vie.traineddata"
|
|
echo "FOFREEXIT_TESSERACT_PATH=C:\Program Files\Tesseract-OCR\tesseract.exe" >> $env:GITHUB_ENV
|
|
|
|
# Máy dev không có Rust — CI là nơi duy nhất chạy test engine.
|
|
# Fail test = fail build, không publish bản hỏng.
|
|
# --test-threads=1: PDFium serialize qua 1 mutex toàn cục; 1 test panic
|
|
# khi đang giữ lock sẽ poison mutex làm mọi test song song chết oan.
|
|
# FOFREEXIT_QPDF_PATH: test chạy với cwd = thư mục crate nên không tự
|
|
# thấy qpdf/ ở root repo (test form/qpdf cần).
|
|
- name: Run engine tests
|
|
run: cargo test -p ff-engine -- --test-threads=1
|
|
env:
|
|
FOFREEXIT_QPDF_PATH: ${{ github.workspace }}\qpdf\bin\qpdf.exe
|
|
|
|
- name: Build release
|
|
working-directory: app/src-tauri
|
|
run: cargo build --release
|
|
|
|
- name: Assemble portable folder
|
|
shell: pwsh
|
|
run: |
|
|
$dist = "dist/FoFreeXit"
|
|
New-Item -ItemType Directory -Force -Path $dist | Out-Null
|
|
Copy-Item "app/src-tauri/target/release/fofreexit-app.exe" "$dist/FoFreeXit.exe"
|
|
Copy-Item "pdfium.dll" "$dist/pdfium.dll"
|
|
Copy-Item "qpdf/bin/*.exe" "$dist/"
|
|
Copy-Item "qpdf/bin/*.dll" "$dist/"
|
|
Copy-Item "scripts/portable-readme.txt" "$dist/DOC-doc-truoc-khi-chay.txt"
|
|
New-Item -ItemType Directory -Force -Path "$dist/fonts" | Out-Null
|
|
Copy-Item "fonts/*" "$dist/fonts/"
|
|
Compress-Archive -Path "$dist/*" -DestinationPath "FoFreeXit-portable-win64.zip" -Force
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: FoFreeXit-portable-win64
|
|
path: FoFreeXit-portable-win64.zip
|
|
retention-days: 30
|
|
|
|
- name: Publish GitHub Release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
tag_name: win-build-${{ github.run_number }}
|
|
name: "FoFreeXit Windows portable (build ${{ github.run_number }})"
|
|
body: |
|
|
Ban build Windows portable tu dong (khong can cai Rust/Visual Studio).
|
|
Giai nen `FoFreeXit-portable-win64.zip` roi chay `FoFreeXit.exe`.
|
|
Commit: ${{ github.sha }}
|
|
files: FoFreeXit-portable-win64.zip
|
|
prerelease: true
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|