diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index 0af6cb3..4b84d6c 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -53,7 +53,7 @@ jobs: run: python tests.py build_and_test_linux: - runs-on: ubuntu-latest # Use an Ubuntu runner + runs-on: ubuntu-latest # As of June 2024 Github actions uses platform: Linux-6.5.0-1021-azure-x86_64 steps: - name: Checkout repository @@ -74,5 +74,4 @@ jobs: pyinstaller --onefile --noconsole --icon=assets/view_earth.ico --distpath=. Heroes3MapLiker.py - name: Run Linux Tests - run: | - xvfb-run --auto-servernum python tests.py # Use xvfb to run the tests + run: python tests.py diff --git a/README.md b/README.md index e6744eb..b21bb25 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,11 @@ # Description -Alternative name: Heroes 3 Map Journal - -Free Heroes of Might and Magic 3 journal, Rate, like and share your favourite maps, record maps -won and make notes on maps. Search maps by image instead of text. - -If you see a missing feature please suggest by contacting author: Sumeet Singh @ sumeet-singh.com/contactus - - -# Features - -* Search maps by images, as well as names with different scenario filters -* Like, filter and export favourite maps -* Record won, and unplayed maps and add journal annotations and notes +A Heroes of Magic and Might franchise Map Journal and standalone Mod to +* Like/Filter/Record/Make notes/Share/Export on won, unfinished and unplayed maps +* Search maps by images with various scenario filters (as well as name) and search within map images * Launch your Heroes of Might and Magic game launcher directly to the map picked for a new way to play +If you see a missing feature please suggest by contacting author Sumeet Singh @ sumeet-singh.com/contactus # Setup guide diff --git a/tests.py b/tests.py index 70c6680..eb25683 100644 --- a/tests.py +++ b/tests.py @@ -7,29 +7,23 @@ # Check if running in a headless environment e.g. running in Githubs CI/CD headless platform running_headless = False -if 'DISPLAY' not in os.environ: - running_headless = True + +# Check for Linux headless environment +if sys.platform.startswith('linux'): + # Check if the display manager service is running + display_manager_status = subprocess.run(['systemctl', 'status', 'display-manager'], capture_output=True, text=True) + if 'Active: active' not in display_manager_status.stdout: + running_headless = True class TestGUI(unittest.TestCase): def test_binary_execution(self): """ CI/CD workflow triggers on pushing this repo to upstream on Github. - Github actions will build binaries for Windows, MacOS, and Linux and run below command - - pyinstaller --onefile --noconsole --icon=assets/view_earth.ico --distpath=. Heroes3MapLiker.py - - (explanation: create one binary which wont start terminal on binary start e.g. like -mwindows, and embed the icon file - and place binary in dist folder online so that below tests.py relative filepaths can find them) - - You can test locally by running command above to generate bin in root ./ then run this test to confirm working. - - This test then runs to determine if each binary for each OS closes with exit code 0. + Github actions will build binaries for Windows, MacOS, and Linux and run below command which + checks for GUI and runs auto close tk window then returns result of pass 0 or fail 0. - Because program runs in a loop awaiting a Tk window event close, the pyautogui library will simulate - manually closing app to see results of test. - - As CI/CD pipeline runs jobs to build all OS, it will test to see which binary exists then run that executable test + Bin built with: pyinstaller --onefile --noconsole --icon=assets/view_earth.ico --distpath=. Heroes3MapLiker.py Returns: Return code. 0 = test passed. 1 = test failed. @@ -44,7 +38,6 @@ def test_binary_execution(self): self.skipTest("Skipping test in headless environment") return - # Start the binary process = subprocess.Popen([binary_path])