Files
lutris/.github/workflows/static.yml
ItsAllAboutTheCode 80e6c46ee8 Fixed Lutris UnitTest when run on github
The primary causes of the issue is the manipulation of how the gog_cloud.py and gog_cloud_hooks.py was getting imported in UnitTest via the importlib mechanism. That seemed to have broken the resolution of paths to `lutris.services.*`.
As the GTK issues that it was trying to side step has been fixed at the `tests` root level, the workaround is no longer needed.

Additional changes have been added to help harden any potentially UnitTest environment and  circular import issues.
* Updated the github unit test run to use a virtual env to install the package dependencies and run the test
* Moved the imports of `lutris.services` subpackage to the method calls inside of the `__init__.py` script which will defer any potential circular imports until after the `lutris/services/__init__.py` script is fully imported.
2026-04-11 09:47:37 -05:00

118 lines
3.4 KiB
YAML

on: [push, pull_request]
name: Static Analysis
jobs:
syntax-compat:
name: Syntax Compatibility (Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Check syntax compatibility
run: python -m compileall -q lutris/
mypy-checker:
name: Mypy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Print current dir
run: pwd
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install Ubuntu dependencies
run: |
sudo apt update
sudo apt-get install libdbus-1-dev pkg-config libgirepository-2.0-dev python3-gi-cairo libcairo2-dev
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
make req-python
make dev
- name: Run mypy analysis
run: |
mypy --version
mypy . --python-version 3.10
po-checker:
name: Translation files
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install gettext
run: sudo apt-get install -y gettext
- name: Validate .po files
run: |
for f in po/*.po; do
msgfmt --check "$f" -o /dev/null
done
annotation-compat:
name: Annotation Compatibility
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Check for unquoted TYPE_CHECKING annotations
run: python utils/check_annotations.py
ruff-checker:
name: Ruff
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install Ubuntu dependencies
run: |
sudo apt update
sudo apt-get install libdbus-1-dev pkg-config libgirepository-2.0-dev python3-gi-cairo libcairo2-dev
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
make dev
- name: Ruff version
run: ruff --version
- name: Check code style
run: ruff check .
- name: Check format
run: ruff format . --check
unit-test:
name: UnitTest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install Ubuntu dependencies
run: |
sudo apt update
sudo apt-get install libdbus-1-dev pkg-config libgirepository-2.0-dev python3-gi-cairo libcairo2-dev libgtk-3-dev libgdk-pixbuf-2.0-dev libgnome-desktop-3-dev libwebkit2gtk-4.1-dev
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
python -m venv .venv
. .venv/bin/activate
make req-python
make dev
- name: Run Unit Test
run: |
. .venv/bin/activate
nose2 --exclude-ci