From f2ddf93d33e11a98602026799cdc833ee2c460cb Mon Sep 17 00:00:00 2001 From: R1kaB3rN <100738684+R1kaB3rN@users.noreply.github.com> Date: Thu, 15 Feb 2024 09:09:26 -0800 Subject: [PATCH] Add Github Action for ulwgl_*.py files (#26) workflows: add Github Action for ulwgl_*.py files --- .github/workflows/ulwgl-python.yml | 36 ++++++++++++++++++++++++++++++ ulwgl_test.py | 20 +++++++++++++++-- 2 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/ulwgl-python.yml diff --git a/.github/workflows/ulwgl-python.yml b/.github/workflows/ulwgl-python.yml new file mode 100644 index 00000000..c9b45ade --- /dev/null +++ b/.github/workflows/ulwgl-python.yml @@ -0,0 +1,36 @@ +name: ULWGL-launcher workflow + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +permissions: + contents: read + +jobs: + build: + strategy: + matrix: + # tomllib requires Python 3.11 + version: ["3.11", "3.12"] + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Set up Python 3.11 + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.version }} + - name: Install dependencies + run: | + python3 -m pip install --upgrade pip + - name: Lint ulwgl_*.py files with Ruff + run: | + pip install ruff + ruff --output-format github ulwgl_*.py + - name: Test with unittest + run: | + python3 ulwgl_test.py \ No newline at end of file diff --git a/ulwgl_test.py b/ulwgl_test.py index 75fefdc8..bbdf279e 100644 --- a/ulwgl_test.py +++ b/ulwgl_test.py @@ -64,9 +64,14 @@ def tearDown(self): def test_game_drive_empty(self): """Test enable_steam_game_drive. - Empty WINE prefixes can be created by passing an empty string to --exe + WINE prefixes can be created by passing an empty string + Example: + WINEPREFIX= PROTONPATH= GAMEID= ulwgl-run "" + During this process, we attempt to prepare setting up game drive and set the values for STEAM_RUNTIME_LIBRARY_PATH and STEAM_COMPAT_INSTALL_PATHS The resulting value of those variables should be colon delimited string with no leading colons and contain only /usr/lib or /usr/lib32 + + Ignores LD_LIBRARY_PATH, relevant to Game Drive, which is sourced in Ubuntu and maybe its derivatives """ args = None result_gamedrive = None @@ -86,9 +91,20 @@ def test_game_drive_empty(self): ulwgl_run.setup_pfx(self.env["WINEPREFIX"]) # Env ulwgl_run.set_env(self.env, args) + + # Some distributions source this variable (e.g. Ubuntu) and will be added to the result of STEAM_RUNTIME_LIBRARY_PATH + # Only test the case without it set + if "LD_LIBRARY_PATH" in os.environ: + os.environ.pop("LD_LIBRARY_PATH") + # Game drive result_gamedrive = ulwgl_plugins.enable_steam_game_drive(self.env) + # Ubuntu sources this variable and will be added once Game Drive is enabled + # Just test the case without it + if "LD_LIBRARY_PATH" in os.environ: + os.environ.pop("LD_LIBRARY_PATH") + for key, val in self.env.items(): os.environ[key] = val @@ -99,7 +115,7 @@ def test_game_drive_empty(self): "Expected two elements in STEAM_RUNTIME_LIBRARY_PATHS", ) - # We just expect /usr/lib and /usr/lib32 + # We just expect /usr/lib and /usr/lib32 since LD_LIBRARY_PATH is unset self.assertEqual( len(self.env["STEAM_RUNTIME_LIBRARY_PATH"].split(":")), 2,