Skip to content

Commit

Permalink
v0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
sumeet-chand committed Jun 3, 2024
1 parent 5563693 commit 868e481
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 33 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
17 changes: 4 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
27 changes: 10 additions & 17 deletions tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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])

Expand Down

0 comments on commit 868e481

Please sign in to comment.