Skip to content

Commit

Permalink
Add Github Action for ulwgl_*.py files (#26)
Browse files Browse the repository at this point in the history
workflows: add Github Action for ulwgl_*.py files
  • Loading branch information
R1kaB3rN authored Feb 15, 2024
1 parent e23ed30 commit f2ddf93
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 2 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/ulwgl-python.yml
Original file line number Diff line number Diff line change
@@ -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
20 changes: 18 additions & 2 deletions ulwgl_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand All @@ -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,
Expand Down

0 comments on commit f2ddf93

Please sign in to comment.