Skip to content

Commit

Permalink
ci: update github action workflows (#121)
Browse files Browse the repository at this point in the history
* workflows: refactor build steps

* workflows: unify validation checks

* tools: remove obsolete vcrunfix

* workflows: update ci workflow

* workflows: fix missing file

* check_gamefixes: fix logic

* check_gamefixes: log relative paths to gamefix modules
  • Loading branch information
R1kaB3rN authored Sep 4, 2024
1 parent 490f513 commit 0301db4
Show file tree
Hide file tree
Showing 8 changed files with 102 additions and 127 deletions.
41 changes: 40 additions & 1 deletion tools/check_gamefixes.py → .github/scripts/check_gamefixes.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,47 @@ def _batch_generator(gamefix: Path, size: int = 50) -> Generator[set[str], Any,
yield appids


def check_links(root: Path) -> None:
"""Check for broken symbolic links"""
gamefixes = [
file
for file in root.glob('gamefixes-*/*.py')
if not file.name.startswith(('__init__.py', 'default.py', 'winetricks-gui.py'))
]

print('Checking for broken symbolic links...', file=sys.stderr)
for module in gamefixes:
print(f'{module.parent.name}/{module.name}', file=sys.stderr)
if module.is_symlink() and not module.exists():
err = f'The following file is not a valid symbolic link: {module}'
raise FileNotFoundError(err)


def check_filenames(root: Path) -> None:
"""Check for expected file names.
All files in non-steam gamefixes are expected to start with 'umu-'
"""
gamefixes = [
file
for file in root.glob('gamefixes-*/*.py')
if not file.name.startswith(('__init__.py', 'default.py', 'winetricks-gui.py'))
and not file.parent.name.startswith('gamefixes-steam')
]

print('Checking for expected file names...', file=sys.stderr)
for module in gamefixes:
print(f'{module.parent.name}/{module.name}', file=sys.stderr)
if module.exists() and not module.name.startswith('umu-'):
err = f'The following file does not start with "umu-": {module}'
raise FileNotFoundError(err)


def main() -> None:
"""Validate gamefixes modules."""
# Top-level project directory that is expected to contain gamefix directories
project = Path(__file__).parent.parent
project = Path(__file__).parent.parent.parent
print(project)

# Steam API to acquire a single id. Used as fallback in case some IDs could
# not be validated. Unforutnately, this endpoint does not accept a comma
Expand All @@ -192,6 +229,8 @@ def main() -> None:
# See https://gogapidocs.readthedocs.io/en/latest/galaxy.html#get--products
gogapi = 'https://api.gog.com/products?ids='

check_links(project)
check_filenames(project)
check_steamfixes(project, steampowered, steamapi)
check_gogfixes(project, gogapi, umudb_gog)

Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: make

on:
push:
branches: ["master"]
pull_request:
branches: ["master"]

permissions:
contents: read

jobs:
container-test-job:
runs-on: ubuntu-latest
container: registry.gitlab.steamos.cloud/steamrt/sniper/sdk:beta
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Build umu-protonfixes
run: |
make
39 changes: 39 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: ci

on:
push:
branches: ["master"]
pull_request:
branches: ["master"]

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
# The Steam Runtime platform (sniper) uses Python 3.9
python-version: "3.9"
- name: Install dependencies
run: |
sudo apt-get install shellcheck
python3 -m pip install --upgrade pip
pip install ruff
pip install ijson
- name: Lint with Shellcheck
run: |
shellcheck winetricks
- name: Lint with Ruff
run: |
ruff check .
- name: Validate gamefix modules
run: |
python3 .github/scripts/check_gamefixes.py
- name: Test with unittest
run: |
python3 protonfixes_test.py
30 changes: 0 additions & 30 deletions .github/workflows/make.yml

This file was deleted.

43 changes: 0 additions & 43 deletions .github/workflows/umu-protonfixes.yml

This file was deleted.

14 changes: 0 additions & 14 deletions tools/check-links.sh

This file was deleted.

29 changes: 0 additions & 29 deletions tools/symlinkfix.sh

This file was deleted.

10 changes: 0 additions & 10 deletions tools/vcrunfix

This file was deleted.

0 comments on commit 0301db4

Please sign in to comment.