diff --git a/.github/workflows/ulwgl-python.yml b/.github/workflows/ulwgl-python.yml new file mode 100644 index 0000000..c9b45ad --- /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 75fefdc..bbdf279 100644 --- a/ulwgl_test.py +++ b/ulwgl_test.py @@ -64,9 +64,14 @@ class TestGameLauncher(unittest.TestCase): 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 @@ class TestGameLauncher(unittest.TestCase): 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 @@ class TestGameLauncher(unittest.TestCase): "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,