Skip to content

Commit 81d014d

Browse files
fix: github workflows
1 parent 8630ea8 commit 81d014d

File tree

3 files changed

+93
-15
lines changed

3 files changed

+93
-15
lines changed

.github/workflows/release.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,12 @@ jobs:
8787
curl -LsSf https://astral.sh/uv/install.sh | sh
8888
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
8989
90+
- name: Install system dependencies (Linux)
91+
if: matrix.os == 'ubuntu-latest'
92+
run: |
93+
sudo apt-get update
94+
sudo apt-get install -y libegl1-mesa libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 xvfb
95+
9096
- name: Install dependencies
9197
run: |
9298
uv pip install --system pyinstaller pyside6
@@ -96,7 +102,13 @@ jobs:
96102
run: |
97103
echo "VERSION = '${{ needs.semantic-release.outputs.new-release-version }}'" > src/version.py
98104
99-
- name: Build executable
105+
- name: Build executable (Linux with virtual display)
106+
if: matrix.os == 'ubuntu-latest'
107+
run: |
108+
xvfb-run -a pyinstaller glimpse.spec
109+
110+
- name: Build executable (Windows/macOS)
111+
if: matrix.os != 'ubuntu-latest'
100112
run: |
101113
pyinstaller glimpse.spec
102114

.github/workflows/test.yml

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,27 +36,36 @@ jobs:
3636
curl -LsSf https://astral.sh/uv/install.sh | sh
3737
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
3838
39+
- name: Install system dependencies (Linux)
40+
if: matrix.os == 'ubuntu-latest'
41+
run: |
42+
sudo apt-get update
43+
sudo apt-get install -y libegl1-mesa libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 xvfb
44+
3945
- name: Install dependencies
4046
run: |
4147
uv pip install --system pyside6
4248
43-
- name: Test import
49+
- name: Test core functionality
4450
run: |
45-
python -c "
46-
import sys
47-
sys.path.insert(0, 'src')
48-
from ui.main_window import GlimpseViewer
49-
from version import get_version
50-
print(f'Glimpse v{get_version()} - Import successful')
51+
python test_imports.py
52+
53+
- name: Test GUI imports (Linux with virtual display)
54+
if: matrix.os == 'ubuntu-latest'
55+
run: |
56+
xvfb-run -a python -c "
57+
from src.ui.main_window import GlimpseViewer
58+
from src.version import get_version
59+
print(f'✅ GUI imports successful on Linux with virtual display')
60+
print(f'✅ Glimpse v{get_version()} - Full GUI test passed')
5161
"
5262
53-
- name: Test version
63+
- name: Test GUI imports (Windows/macOS)
64+
if: matrix.os != 'ubuntu-latest'
5465
run: |
5566
python -c "
56-
import sys
57-
sys.path.insert(0, 'src')
58-
from version import get_version
59-
version = get_version()
60-
print(f'Version: {version}')
61-
assert version.count('.') >= 2, 'Version should be semantic (x.y.z)'
67+
from src.ui.main_window import GlimpseViewer
68+
from src.version import get_version
69+
print(f'✅ GUI imports successful on ${{ matrix.os }}')
70+
print(f'✅ Glimpse v{get_version()} - Full GUI test passed')
6271
"

test_imports.py

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#!/usr/bin/env python3
2+
"""
3+
Simple import test for CI environments.
4+
Tests core functionality without requiring a GUI display.
5+
"""
6+
7+
import sys
8+
import os
9+
10+
# Add src to path
11+
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'src'))
12+
13+
def test_version():
14+
"""Test version module."""
15+
from version import get_version
16+
version = get_version()
17+
print(f"Version: {version}")
18+
assert version.count('.') >= 2, 'Version should be semantic (x.y.z)'
19+
print("✅ Version test passed")
20+
return version
21+
22+
def test_core_imports():
23+
"""Test core module imports."""
24+
from version import get_version
25+
from core.image_utils import IMAGE_EXTENSIONS
26+
from core.collections import Collection, CollectionManager
27+
28+
print("✅ Core modules imported successfully")
29+
print(f"✅ Glimpse v{get_version()} - Core functionality verified")
30+
print(f"✅ Supported image formats: {len(IMAGE_EXTENSIONS)}")
31+
32+
def test_gui_imports():
33+
"""Test GUI imports (requires display)."""
34+
try:
35+
from ui.main_window import GlimpseViewer
36+
from version import get_version
37+
print(f"✅ GUI imports successful")
38+
print(f"✅ Glimpse v{get_version()} - Full GUI test passed")
39+
except ImportError as e:
40+
print(f"❌ GUI import failed: {e}")
41+
raise
42+
43+
if __name__ == "__main__":
44+
print("🧪 Running Glimpse import tests...")
45+
46+
# Always test these
47+
version = test_version()
48+
test_core_imports()
49+
50+
# Test GUI only if requested
51+
if "--gui" in sys.argv or os.environ.get("TEST_GUI", "").lower() == "true":
52+
print("🖥️ Testing GUI imports...")
53+
test_gui_imports()
54+
else:
55+
print("⏩ Skipping GUI tests (use --gui flag to enable)")
56+
57+
print(f"🎉 All tests passed for Glimpse v{version}!")

0 commit comments

Comments
 (0)