Repository navigation
128 lines (123 loc) · 4.99 KB
/
Copy pathci.yml
File metadata and controls
128 lines (123 loc) · 4.99 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
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)" }