mirror of
https://github.com/D-Ogi/WatermarkRemover-AI.git
synced 2026-10-22 06:32:38 -05:00
Use a local Qt desktop interface on Windows, verify and prepare model downloads with progress and retry, and build versioned portable executables with release checks. Preserve configured model mirrors and validate application-only refreshes. Closes #51.
129 lines
5.0 KiB
YAML
129 lines
5.0 KiB
YAML
name: CI
|
|
|
|
on:
|
|
pull_request:
|
|
push:
|
|
branches: [main]
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
cpu-tests:
|
|
name: CPU tests (${{ matrix.os }})
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
runs-on: ${{ matrix.os }}
|
|
timeout-minutes: 15
|
|
env:
|
|
MPLBACKEND: Agg
|
|
HF_HUB_OFFLINE: "1"
|
|
TRANSFORMERS_OFFLINE: "1"
|
|
steps:
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
persist-credentials: false
|
|
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
|
|
with:
|
|
python-version: "3.12"
|
|
- name: Install lightweight test dependencies
|
|
run: python -m pip install -r requirements-test.txt
|
|
- name: Check test environment dependencies
|
|
run: python -m pip check
|
|
- name: Check Python correctness
|
|
run: python -m ruff check .
|
|
- name: Compile application and tests without importing models
|
|
run: python -m compileall -q remwm.py remwmgui.py desktop_main.py desktop_runtime.py desktop_models.py model_assets.py utils.py lama_inpaint scripts tests
|
|
- name: Run CPU tests
|
|
run: python -m pytest
|
|
- name: Check Bash syntax
|
|
if: runner.os != 'Windows'
|
|
run: |
|
|
bash -n setup.sh
|
|
bash -n run.sh
|
|
- name: Check PowerShell syntax
|
|
if: runner.os == 'Windows'
|
|
shell: pwsh
|
|
run: |
|
|
$tokens = $null
|
|
$parseErrors = $null
|
|
[System.Management.Automation.Language.Parser]::ParseFile(
|
|
(Join-Path $PWD 'setup.ps1'), [ref]$tokens, [ref]$parseErrors
|
|
) | Out-Null
|
|
if ($parseErrors.Count) {
|
|
$parseErrors | ForEach-Object { Write-Error $_ }
|
|
exit 1
|
|
}
|
|
|
|
application-tests:
|
|
name: Application runtime (${{ matrix.os }})
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
runs-on: ${{ matrix.os }}
|
|
timeout-minutes: 25
|
|
env:
|
|
MPLBACKEND: Agg
|
|
HF_HUB_OFFLINE: "1"
|
|
TRANSFORMERS_OFFLINE: "1"
|
|
steps:
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
persist-credentials: false
|
|
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
|
|
with:
|
|
python-version: "3.12"
|
|
- name: Install CPU PyTorch (Linux/Windows)
|
|
if: runner.os != 'macOS'
|
|
run: python -m pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
|
|
- name: Install PyTorch (macOS)
|
|
if: runner.os == 'macOS'
|
|
run: python -m pip install torch torchvision
|
|
- name: Install full application with the normal resolver
|
|
run: python -m pip install -r requirements.txt pytest matplotlib
|
|
- name: Verify full application environment
|
|
run: |
|
|
python -m pip check
|
|
python -c "import remwm, webview, yaml, psutil; import importlib.util; assert importlib.util.find_spec('iopaint') is None"
|
|
python remwm.py --help
|
|
- name: Exercise application and TorchScript adapter without model downloads
|
|
run: python -m pytest
|
|
- name: Install Linux desktop system libraries
|
|
if: runner.os == 'Linux'
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y libegl1 libgl1 libxkbcommon-x11-0 libxcb-cursor0 libxcb-icccm4 libxcb-keysyms1 libxcb-shape0 libxcb-xinerama0 libxcb-randr0 libnss3 libasound2t64
|
|
- name: Check installed desktop backend (Linux)
|
|
if: runner.os == 'Linux'
|
|
run: xvfb-run -a python scripts/check_desktop.py
|
|
- name: Check installed desktop backend (Windows/macOS)
|
|
if: runner.os != 'Linux'
|
|
run: python scripts/check_desktop.py
|
|
|
|
windows-portable:
|
|
name: Windows portable executable
|
|
runs-on: windows-latest
|
|
timeout-minutes: 25
|
|
steps:
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
persist-credentials: false
|
|
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
|
|
with:
|
|
python-version: "3.12"
|
|
- name: Build independent embedded runtime and executable
|
|
run: python scripts/build_windows.py --output "${{ runner.temp }}/portable" --cache "${{ runner.temp }}/downloads" --backend cpu --skip-archive
|
|
- name: Exercise the executable and real offline desktop page
|
|
shell: pwsh
|
|
run: |
|
|
$version = (Get-Content VERSION -Raw).Trim()
|
|
$bundle = Join-Path '${{ runner.temp }}/portable' "WatermarkRemover-AI-$version-windows-x64-cpu"
|
|
$process = Start-Process -FilePath (Join-Path $bundle 'WatermarkRemover-AI.exe') -ArgumentList '--check' -WindowStyle Hidden -PassThru
|
|
$handle = $process.Handle
|
|
if (-not $process.WaitForExit(120000)) { $process.Kill(); throw 'Portable check timed out' }
|
|
if ($process.ExitCode -ne 0) { throw "Portable check failed: $($process.ExitCode)" }
|