run tagstudio in CI

This commit is contained in:
yedpodtrzitko
2024-05-12 21:58:05 +08:00
parent 3aa71d6f8a
commit 93526fa73f
5 changed files with 65 additions and 2 deletions

50
.github/workflows/apprun.yaml vendored Normal file
View File

@@ -0,0 +1,50 @@
name: PySide App Test
on: [ push, pull_request ]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'
- name: Install system dependencies
run: |
# dont run update, it is slow
# sudo apt-get update
sudo apt-get install -y --no-install-recommends \
libxkbcommon-x11-0 \
x11-utils \
libyaml-dev \
libegl1-mesa \
libxcb-icccm4 \
libxcb-image0 \
libxcb-keysyms1 \
libxcb-randr0 \
libxcb-render-util0 \
libxcb-xinerama0 \
libopengl0 \
libxcb-cursor0
- name: Install dependencies
run: |
pip install -r requirements.txt
- name: Run TagStudio app and check exit code
run: |
xvfb-run --server-args="-screen 0, 1920x1200x24 -ac +extension GLX +render -noreset" python tagstudio/tag_studio.py --ci -o /tmp/
exit_code=$?
if [ $exit_code -eq 0 ]; then
echo "TagStudio ran successfully"
else
echo "TagStudio failed with exit code $exit_code"
exit 1
fi

View File

@@ -1,2 +1,3 @@
ruff==0.4.2
pre-commit==3.7.0
Pyinstaller==6.6.0

View File

@@ -7,4 +7,3 @@ PySide6_Addons>=6.5.1.1,<=6.6.3.1
PySide6_Essentials>=6.5.1.1,<=6.6.3.1
typing_extensions>=3.10.0.0,<=4.11.0
ujson>=5.8.0,<=5.9.0
Pyinstaller==6.6.0

View File

@@ -193,6 +193,9 @@ class QtDriver(QObject):
)
max_threads = os.cpu_count()
if args.ci:
# spawn only single worker in CI environment
max_threads = 1
for i in range(max_threads):
# thread = threading.Thread(target=self.consumer, name=f'ThumbRenderer_{i}',args=(), daemon=True)
# thread.start()
@@ -238,6 +241,7 @@ class QtDriver(QObject):
# Handle OS signals
self.setup_signals()
# allow to process input from console, eg. SIGTERM
timer = QTimer()
timer.start(500)
timer.timeout.connect(lambda: None)
@@ -538,7 +542,11 @@ class QtDriver(QObject):
)
self.open_library(lib)
app.exec_()
if self.args.ci:
# gracefully terminate the app in CI environment
self.thumb_job_queue.put((self.SIGTERM.emit, []))
app.exec()
self.shutdown()

View File

@@ -45,6 +45,11 @@ def main():
type=str,
help="User interface option for TagStudio. Options: qt, cli (Default: qt)",
)
parser.add_argument(
"--ci",
action=argparse.BooleanOptionalAction,
help="Exit the application after checking it starts without any problem. Meant for CI check.",
)
args = parser.parse_args()
core = TagStudioCore() # The TagStudio Core instance. UI agnostic.