Add Github Action for ulwgl_*.py files (#26)

workflows: add Github Action for ulwgl_*.py files
This commit is contained in:
R1kaB3rN 2024-02-15 09:09:26 -08:00 committed by GitHub
parent e23ed300ee
commit f2ddf93d33
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 54 additions and 2 deletions

36
.github/workflows/ulwgl-python.yml vendored Normal file
View File

@ -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

View File

@ -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,