Skip to content

Commit 93526fa

Browse files
committed
run tagstudio in CI
1 parent 3aa71d6 commit 93526fa

5 files changed

Lines changed: 65 additions & 2 deletions

File tree

.github/workflows/apprun.yaml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: PySide App Test
2+
3+
on: [ push, pull_request ]
4+
5+
jobs:
6+
test:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- name: Checkout code
11+
uses: actions/checkout@v4
12+
13+
- name: Set up Python
14+
uses: actions/setup-python@v5
15+
with:
16+
python-version: '3.12'
17+
cache: 'pip'
18+
19+
- name: Install system dependencies
20+
run: |
21+
# dont run update, it is slow
22+
# sudo apt-get update
23+
sudo apt-get install -y --no-install-recommends \
24+
libxkbcommon-x11-0 \
25+
x11-utils \
26+
libyaml-dev \
27+
libegl1-mesa \
28+
libxcb-icccm4 \
29+
libxcb-image0 \
30+
libxcb-keysyms1 \
31+
libxcb-randr0 \
32+
libxcb-render-util0 \
33+
libxcb-xinerama0 \
34+
libopengl0 \
35+
libxcb-cursor0
36+
37+
- name: Install dependencies
38+
run: |
39+
pip install -r requirements.txt
40+
41+
- name: Run TagStudio app and check exit code
42+
run: |
43+
xvfb-run --server-args="-screen 0, 1920x1200x24 -ac +extension GLX +render -noreset" python tagstudio/tag_studio.py --ci -o /tmp/
44+
exit_code=$?
45+
if [ $exit_code -eq 0 ]; then
46+
echo "TagStudio ran successfully"
47+
else
48+
echo "TagStudio failed with exit code $exit_code"
49+
exit 1
50+
fi

requirements-dev.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
ruff==0.4.2
22
pre-commit==3.7.0
3+
Pyinstaller==6.6.0

requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,3 @@ PySide6_Addons>=6.5.1.1,<=6.6.3.1
77
PySide6_Essentials>=6.5.1.1,<=6.6.3.1
88
typing_extensions>=3.10.0.0,<=4.11.0
99
ujson>=5.8.0,<=5.9.0
10-
Pyinstaller==6.6.0

tagstudio/src/qt/ts_qt.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,9 @@ def __init__(self, core, args):
193193
)
194194

195195
max_threads = os.cpu_count()
196+
if args.ci:
197+
# spawn only single worker in CI environment
198+
max_threads = 1
196199
for i in range(max_threads):
197200
# thread = threading.Thread(target=self.consumer, name=f'ThumbRenderer_{i}',args=(), daemon=True)
198201
# thread.start()
@@ -238,6 +241,7 @@ def start(self):
238241

239242
# Handle OS signals
240243
self.setup_signals()
244+
# allow to process input from console, eg. SIGTERM
241245
timer = QTimer()
242246
timer.start(500)
243247
timer.timeout.connect(lambda: None)
@@ -538,7 +542,11 @@ def start(self):
538542
)
539543
self.open_library(lib)
540544

541-
app.exec_()
545+
if self.args.ci:
546+
# gracefully terminate the app in CI environment
547+
self.thumb_job_queue.put((self.SIGTERM.emit, []))
548+
549+
app.exec()
542550

543551
self.shutdown()
544552

tagstudio/tag_studio.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ def main():
4545
type=str,
4646
help="User interface option for TagStudio. Options: qt, cli (Default: qt)",
4747
)
48+
parser.add_argument(
49+
"--ci",
50+
action=argparse.BooleanOptionalAction,
51+
help="Exit the application after checking it starts without any problem. Meant for CI check.",
52+
)
4853
args = parser.parse_args()
4954

5055
core = TagStudioCore() # The TagStudio Core instance. UI agnostic.

0 commit comments

Comments
 (0)