125 lines
3.2 KiB
YAML
125 lines
3.2 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main, stable]
|
|
pull_request:
|
|
branches: [main, stable]
|
|
|
|
# Cancel in-progress runs on new push
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
install-and-test:
|
|
name: Install & Test (Windows)
|
|
runs-on: windows-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.10"
|
|
cache: "pip"
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install -r requirements-win11.txt
|
|
shell: bash
|
|
|
|
- name: Python version
|
|
run: python -c "import sys; print(sys.version)"
|
|
|
|
- name: Syntax check
|
|
env:
|
|
PYTHONPATH: ./src
|
|
run: python -m compileall -q src tools test scripts
|
|
|
|
- name: Verify core imports
|
|
env:
|
|
PYTHONPATH: ./src
|
|
run: |
|
|
python -c "
|
|
import sys
|
|
sys.path.insert(0, 'src')
|
|
modules = [
|
|
'config',
|
|
'logger',
|
|
'screen',
|
|
'pather',
|
|
'template_finder',
|
|
'game_stats',
|
|
'health_manager',
|
|
'death_manager',
|
|
'd2r_image',
|
|
'item',
|
|
'item.pickit',
|
|
'transmute',
|
|
'shop',
|
|
'char',
|
|
'utils',
|
|
'utils.os_detect',
|
|
'messages',
|
|
]
|
|
for mod in modules:
|
|
try:
|
|
__import__(mod)
|
|
print(f' {mod}: OK')
|
|
except ImportError as e:
|
|
print(f' {mod}: FAILED - {e}')
|
|
sys.exit(1)
|
|
print('All core imports successful.')
|
|
"
|
|
|
|
- name: Verify botty runs (import main module)
|
|
env:
|
|
PYTHONPATH: ./src
|
|
run: |
|
|
python -c "
|
|
import sys, os
|
|
sys.path.insert(0, 'src')
|
|
# Same SSL patch as main.py
|
|
import ssl
|
|
ssl.SSLContext.load_default_certs = lambda *a, **k: None
|
|
|
|
# Import the main entry point modules to verify they load
|
|
from version import __version__
|
|
print(f' Version: {__version__}')
|
|
|
|
from config import Config
|
|
print(' Config: OK')
|
|
|
|
from game_controller import GameController
|
|
print(' GameController: OK')
|
|
|
|
from bot import Bot
|
|
print(' Bot: OK')
|
|
|
|
from run.run_diablo import RunDiablo
|
|
print(' RunDiablo: OK')
|
|
|
|
from run.run_pindle import RunPindle
|
|
print(' RunPindle: OK')
|
|
|
|
print('All botty entry modules import successfully.')
|
|
"
|
|
|
|
- name: Tests with coverage
|
|
env:
|
|
PYTHONPATH: ./src
|
|
RUN_ENV: test
|
|
run: |
|
|
python -m coverage run -m pytest -v --tb=short
|
|
python -m coverage xml --ignore-errors || true
|
|
|
|
- name: Upload coverage
|
|
uses: actions/upload-artifact@v4
|
|
if: always()
|
|
with:
|
|
name: coverage-report
|
|
path: coverage.xml
|
|
retention-days: 7 |