Skip to content
Closed
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
95 changes: 95 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: CI

on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main ]

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8, 3.9, 3.10, 3.11]

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"

- name: Run tests
run: |
pytest tests/ -v --cov=. --cov-report=xml

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
flags: unittests
name: codecov-umbrella

lint:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"

- name: Run linting
run: |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=88 --statistics

- name: Run type checking
run: |
mypy . --ignore-missing-imports

- name: Check code formatting
run: |
black --check --diff .

build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build

- name: Build package
run: python -m build

- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: dist
path: dist/
51 changes: 51 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Release

on:
push:
tags:
- 'v*'

jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for changelog generation

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build twine

- name: Build package
run: python -m build

- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: |
dist/*.tar.gz
dist/*.whl
generate_release_notes: true
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Upload to PyPI
if: startsWith(github.ref, 'refs/tags/v')
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
skip-existing: true
35 changes: 35 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- id: check-merge-conflict
- id: debug-statements

- repo: https://github.com/psf/black
rev: 23.3.0
hooks:
- id: black
language_version: python3

- repo: https://github.com/pycqa/flake8
rev: 6.0.0
hooks:
- id: flake8
args: [--max-line-length=88, --extend-ignore=E203,W503]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.3.0
hooks:
- id: mypy
additional_dependencies: [types-all]
args: [--ignore-missing-imports]

- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
args: [--profile=black]
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.1.0] - 2024-01-01

### Features
- Initial release of Unofficial Retro Patch
- Selective pixelation using mask files
- Configurable pixelation settings
- Debug mode for texture verification
- Support for Stronghold: Definitive Edition
- Unity asset handling with UnityPy
- Memory usage monitoring
- Environment-based configuration

### Technical
- Python 3.8+ compatibility
- Modular architecture with separate pixelation engine
- Comprehensive error handling and logging
- Cross-platform support
64 changes: 64 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
.PHONY: help install test lint format clean build release bump-patch bump-minor bump-major

help: ## Show this help message
@echo "Unofficial Retro Patch - Development Commands"
@echo "============================================="
@echo ""
@echo "Available commands:"
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " %-15s %s\n", $$1, $$2}' $(MAKEFILE_LIST)

install: ## Install the package in development mode
pip install -e ".[dev]"

test: ## Run tests
pytest tests/ -v --cov=. --cov-report=html --cov-report=term

lint: ## Run linting checks
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=88 --statistics
mypy . --ignore-missing-imports

format: ## Format code with black
black .

clean: ## Clean build artifacts
rm -rf build/
rm -rf dist/
rm -rf *.egg-info/
rm -rf .pytest_cache/
rm -rf htmlcov/
rm -rf .coverage

build: ## Build distribution packages
python -m build

release: ## Create a new release (patch version)
python version.py release --type patch

bump-patch: ## Bump patch version
python version.py bump --type patch

bump-minor: ## Bump minor version
python version.py bump --type minor

bump-major: ## Bump major version
python version.py bump --type major

release-patch: ## Create patch release
python version.py release --type patch

release-minor: ## Create minor release
python version.py release --type minor

release-major: ## Create major release
python version.py release --type major

check: ## Run all checks (lint, test, build)
$(MAKE) lint
$(MAKE) test
$(MAKE) build

pre-commit: ## Run pre-commit checks
$(MAKE) format
$(MAKE) lint
$(MAKE) test
70 changes: 70 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ The Unofficial Retro Patch (URP) is a modification tool designed to selectively

## Installation

### For Users

1. Clone this repository:
```
git clone https://github.com/BALOTIAS/urp.git
Expand All @@ -47,6 +49,25 @@ The Unofficial Retro Patch (URP) is a modification tool designed to selectively

4. Configure the `.env` file with your game's file paths and pixelation settings.

### For Developers

1. Clone and install in development mode:
```
git clone https://github.com/BALOTIAS/urp.git
cd urp
make install
```

2. Install pre-commit hooks:
```
pre-commit install
```

3. Run tests:
```
make test
```

## Usage

1. Make sure your game files are in the correct location as specified in your config.ini
Expand Down Expand Up @@ -87,6 +108,55 @@ Masks are grayscale PNG files that control where pixelation is applied:

Place mask files in the `masks` folder with the same folder structure as the original textures, e.g. `masks/Stronghold Definitive Edition/resources.assets/AllTileSprites.png`.

## Development

### Version Management

This project uses semantic versioning and automated release management. To create a new release:

1. **Bump version and create release:**
```bash
make release-patch # For bug fixes
make release-minor # For new features
make release-major # For breaking changes
```

2. **Manual version bumping:**
```bash
python version.py bump --type patch|minor|major
```

3. **Create release with GitHub integration:**
```bash
python version.py release --type patch --create-release
```

### Development Workflow

- **Run all checks:** `make check`
- **Format code:** `make format`
- **Run tests:** `make test`
- **Lint code:** `make lint`
- **Build package:** `make build`
- **Clean artifacts:** `make clean`

### Commit Convention

This project follows [Conventional Commits](https://www.conventionalcommits.org/):

- `feat:` - New features
- `fix:` - Bug fixes
- `docs:` - Documentation changes
- `refactor:` - Code refactoring
- `test:` - Test additions/changes
- `chore:` - Maintenance tasks

### CI/CD

- **CI:** Runs on every push and pull request
- **Releases:** Automatically triggered by version tags
- **PyPI:** Automatic upload on release

## License

See the [LICENSE](LICENSE) file for details.
Expand Down
Loading
Loading