From 32d4d9ec56b7581bd112d594495c16b037676d52 Mon Sep 17 00:00:00 2001 From: Frank Dana Date: Sun, 6 Dec 2020 17:35:43 -0500 Subject: [PATCH] Github Actions CI building - Add .github/workflows/ci.yml - Delete .travis.yml (to disable) - Adjust exit code and query_tests.py setup to reduce crashes on exit --- .github/workflows/ci.yml | 33 ++++++++++++++++ .travis.yml | 76 ------------------------------------ src/tests/query_tests.py | 4 +- src/windows/main_window.py | 1 + src/windows/views/webview.py | 1 + 5 files changed, 38 insertions(+), 77 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000000..47f82fb3c0 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,33 @@ +name: CI Build +on: [push, pull_request] +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-18.04, ubuntu-20.04] + steps: + - uses: actions/checkout@v2 + + - name: Install dependencies + # Some projects don't allow in-source building, so create a separate build directory + # We'll use this as our working directory for all subsequent commands + shell: bash + run: | + sudo add-apt-repository ppa:openshot.developers/libopenshot-daily + sudo apt update + sudo apt install libopenshot-audio-dev libopenshot-dev python3-openshot + sudo apt install qttranslations5-l10n libssl-dev xvfb + sudo apt install python3-pyqt5 python3-pyqt5.qtsvg python3-pyqt5.qtwebengine python3-pyqt5.qtopengl python3-zmq python3-xdg + pip3 install setuptools wheel + pip3 install cx_Freeze==6.1 distro defusedxml requests certifi chardet urllib3 + + - name: Build Python package + # Use a bash shell so we can use the same syntax for environment variable + # access regardless of the host operating system + shell: bash + run: python3 freeze.py build + + - name: Test + shell: bash + run: xvfb-run --auto-servernum --server-num=1 --server-args "-screen 0 1920x1080x24" python3 ./src/tests/query_tests.py diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index e1f6e992b3..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,76 +0,0 @@ -# Run in default virtualenv, but with access to Python packages -# installed by apt -language: python -virtualenv: - system_site_packages: true -addons: - apt: - sources: - - sourceline: 'ppa:openshot.developers/libopenshot-daily' - packages: &p_common - - libopenshot-audio-dev - - libopenshot-dev - - libssl-dev - - python3-openshot - - python3-pip - - python3-setuptools - - python3-pyqt5 - - python3-pyqt5.qtsvg - - python3-requests - - python3-xdg - - python3-zmq - - qttranslations5-l10n - - xvfb - -jobs: - include: - - name: "Python 3.5 (Ubuntu 16.04 Xenial)" - os: linux - dist: xenial - python: 3.5 - addons: - apt: - sources: - - sourceline: 'ppa:openshot.developers/libopenshot-daily' - packages: - - *p_common - - python3-pyqt5.qtwebkit - - name: "Python 3.6 (Ubuntu 18.04 Bionic)" - os: linux - dist: bionic - python: 3.6 - addons: - apt: - sources: - - sourceline: 'ppa:openshot.developers/libopenshot-daily' - packages: - - *p_common - - python3-pyqt5.qtwebengine - - python3-pyqt5.qtopengl - - name: "Python 3.8 (Ubuntu 20.04 Focal)" - os: linux - dist: focal - python: 3.8 - addons: - apt: - sources: - - sourceline: 'ppa:openshot.developers/libopenshot-daily' - packages: - - *p_common - - python3-pyqt5.qtwebengine - - python3-pyqt5.qtopengl - -install: - - pip3 install 'cx-freeze==6.1' - -script: - - python3 freeze.py build - - xvfb-run --auto-servernum --server-num=1 --server-args "-screen 0 1920x1080x24" python3 src/tests/query_tests.py - -notifications: - email: true - -env: - global: - - TRAVIS_LIBOPENSHOT=TEST - - LANG="en_US.UTF-8" diff --git a/src/tests/query_tests.py b/src/tests/query_tests.py index 05327e6cbe..5faa4aec8b 100644 --- a/src/tests/query_tests.py +++ b/src/tests/query_tests.py @@ -34,6 +34,7 @@ import random import unittest import uuid +from PyQt5.QtGui import QGuiApplication from classes.app import OpenShotApp from classes import info import openshot # Python module for libopenshot (required video editing module installed separately) @@ -46,7 +47,7 @@ class TestQueryClass(unittest.TestCase): def setUpClass(TestQueryClass): """ Init unit test data """ # Create Qt application - TestQueryClass.app = OpenShotApp(sys.argv, mode="unittest") + TestQueryClass.app = OpenShotApp([], mode="unittest") TestQueryClass.clip_ids = [] TestQueryClass.file_ids = [] TestQueryClass.transition_ids = [] @@ -318,4 +319,5 @@ def test_add_file(self): if __name__ == '__main__': + app = QGuiApplication(sys.argv) unittest.main() diff --git a/src/windows/main_window.py b/src/windows/main_window.py index 02ce07d887..243e669054 100644 --- a/src/windows/main_window.py +++ b/src/windows/main_window.py @@ -2882,6 +2882,7 @@ def __init__(self, *args, mode=None): # Connect signals if self.mode != "unittest": self.RecoverBackup.connect(self.recover_backup) + app.aboutToQuit.connect(self.close) # Initialize and start the thumbnail HTTP server self.http_server_thread = httpThumbnailServerThread() diff --git a/src/windows/views/webview.py b/src/windows/views/webview.py index d28f2bc519..d00a9c12a5 100644 --- a/src/windows/views/webview.py +++ b/src/windows/views/webview.py @@ -3168,6 +3168,7 @@ def __init__(self, window): # Connect shutdown signals app.aboutToQuit.connect(self.redraw_audio_timer.stop) app.aboutToQuit.connect(self.cache_renderer.stop) + app.aboutToQuit.connect(self.deleteLater) # Delay the start of cache rendering QTimer.singleShot(1500, self.cache_renderer.start)