Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: update github action workflows #121

Merged
merged 7 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.