Skip to content

Commit f35d9c1

Browse files
authored
Merge pull request #165 from yedpodtrzitko/yed/ci-run
ci: try to run the app
2 parents 6a2199d + 93526fa commit f35d9c1

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
@@ -191,6 +191,9 @@ def __init__(self, core, args):
191191
)
192192

193193
max_threads = os.cpu_count()
194+
if args.ci:
195+
# spawn only single worker in CI environment
196+
max_threads = 1
194197
for i in range(max_threads):
195198
# thread = threading.Thread(target=self.consumer, name=f'ThumbRenderer_{i}',args=(), daemon=True)
196199
# thread.start()
@@ -234,6 +237,7 @@ def start(self):
234237

235238
# Handle OS signals
236239
self.setup_signals()
240+
# allow to process input from console, eg. SIGTERM
237241
timer = QTimer()
238242
timer.start(500)
239243
timer.timeout.connect(lambda: None)
@@ -524,7 +528,11 @@ def start(self):
524528
)
525529
self.open_library(lib)
526530

527-
app.exec_()
531+
if self.args.ci:
532+
# gracefully terminate the app in CI environment
533+
self.thumb_job_queue.put((self.SIGTERM.emit, []))
534+
535+
app.exec()
528536

529537
self.shutdown()
530538

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)