12 Commits

Author SHA1 Message Date
813dafd6b8 fix(updater,ci): headless tests and immediate app shutdown
Some checks failed
Desktop CI / tests (push) Failing after 14s
Desktop Release / release (push) Failing after 15s
- stub PySide6 in test_updater_gui to run on linux runner without libGL

- close main app immediately after launching updater, without blocking OK dialog
2026-02-15 22:01:51 +03:00
965d09d47c feat(installer): add Inno Setup packaging to release
- add installer/AnabasisManager.iss for per-user install without admin rights

- extend build.py to produce setup.exe via ISCC

- publish setup.exe and checksums in release workflow
2026-02-15 22:01:47 +03:00
1b4760167f chore(version): bump to 2.1.0
Some checks failed
Desktop CI / tests (push) Failing after 12s
Desktop Release / release (push) Successful in 2m45s
- set APP_VERSION to 2.1.0 after merging dev into master
2026-02-15 21:56:40 +03:00
039c1fa38a merge: dev into master
- merge updater improvements, update channels, and ci/release workflow updates
2026-02-15 21:56:28 +03:00
147988242f merge: release 2.0.0
All checks were successful
Desktop CI / tests (push) Successful in 12s
Desktop Release / release (push) Successful in 1m57s
2026-02-15 21:18:01 +03:00
cf6d6bcbd0 ci(release): gate by release existence, not tag
All checks were successful
Desktop CI / tests (push) Successful in 13s
Desktop Release / release (push) Successful in 1m55s
- initialize CONTINUE=true at flow start

- keep stop condition only when release with same tag already exists
2026-02-15 21:11:18 +03:00
61948a51c6 ci(release): detect existing releases via list endpoint
All checks were successful
Desktop CI / tests (push) Successful in 12s
Desktop Release / release (push) Successful in 15s
- check /releases list by tag_name instead of /releases/tags

- skip git tag push when tag already exists on origin
2026-02-15 21:10:10 +03:00
97c52c5a51 ci(tests): run full suite in Desktop CI
Some checks failed
Desktop CI / tests (push) Successful in 13s
Desktop Release / release (push) Failing after 1m53s
- switch unittest to discover test_*.py

- include all current test modules in py_compile
2026-02-15 21:02:35 +03:00
862c2c8899 ci(release): run full test suite in workflow
Some checks are pending
Desktop CI / tests (push) Successful in 12s
Desktop Release / release (push) Has started running
- execute unittest discovery for all test_*.py files

- include all current test modules in py_compile check
2026-02-15 21:02:04 +03:00
1013a1ce38 ci(release): fix tag existence check for remote
Some checks are pending
Desktop CI / tests (push) Successful in 12s
Desktop Release / release (push) Has started running
- detect tag by non-empty ls-remote output instead of exit code
2026-02-15 21:00:36 +03:00
f15e71996b ci(release): skip duplicate Gitea release creation
All checks were successful
Desktop CI / tests (push) Successful in 12s
Desktop Release / release (push) Successful in 14s
- check tag existence on origin via ls-remote

- stop workflow when release for tag already exists
2026-02-15 20:57:01 +03:00
34272d01c8 merge: release 1.7.1
Some checks failed
Desktop CI / tests (push) Successful in 13s
Desktop Release / release (push) Failing after 1m48s
Reviewed-on: #1
2026-02-15 20:51:41 +03:00
6 changed files with 243 additions and 27 deletions

View File

@@ -38,6 +38,24 @@ jobs:
python -m pip install --upgrade pip python -m pip install --upgrade pip
pip install -r requirements.txt pyinstaller pip install -r requirements.txt pyinstaller
- name: Ensure Inno Setup 6
shell: powershell
run: |
if (Get-Command iscc.exe -ErrorAction SilentlyContinue) {
iscc.exe /? | Out-Null
Write-Host "Inno Setup compiler found in PATH."
} elseif (Test-Path "C:\Program Files (x86)\Inno Setup 6\ISCC.exe") {
"C:\Program Files (x86)\Inno Setup 6" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
& "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" /? | Out-Null
Write-Host "Inno Setup compiler found in Program Files (x86)."
} elseif (Test-Path "C:\Program Files\Inno Setup 6\ISCC.exe") {
"C:\Program Files\Inno Setup 6" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
& "C:\Program Files\Inno Setup 6\ISCC.exe" /? | Out-Null
Write-Host "Inno Setup compiler found in Program Files."
} else {
throw "Inno Setup 6 is not installed on runner. Install Inno Setup and restart runner service."
}
- name: Extract app version - name: Extract app version
id: extract_version id: extract_version
shell: powershell shell: powershell
@@ -47,24 +65,40 @@ jobs:
[System.IO.File]::AppendAllText($env:GITHUB_OUTPUT, "version=$version`n", $utf8NoBom) [System.IO.File]::AppendAllText($env:GITHUB_OUTPUT, "version=$version`n", $utf8NoBom)
Write-Host "Detected version: $version" Write-Host "Detected version: $version"
- name: Stop if version already released - name: Initialize release flow
id: stop id: flow_init
shell: powershell
run: |
$utf8NoBom = New-Object System.Text.UTF8Encoding($false)
[System.IO.File]::AppendAllText($env:GITHUB_ENV, "CONTINUE=true`n", $utf8NoBom)
exit 0
- name: Stop if release already exists
shell: powershell shell: powershell
run: | run: |
$version = "${{ steps.extract_version.outputs.version }}" $version = "${{ steps.extract_version.outputs.version }}"
$tag = "v$version" $tag = "v$version"
git show-ref --tags --quiet --verify "refs/tags/$tag" $apiUrl = "https://git.daemonlord.ru/api/v1/repos/${{ gitea.repository }}/releases?page=1&limit=100"
$tagExists = ($LASTEXITCODE -eq 0) $headers = @{ Authorization = "token ${{ secrets.API_TOKEN }}" }
$global:LASTEXITCODE = 0
$utf8NoBom = New-Object System.Text.UTF8Encoding($false) $utf8NoBom = New-Object System.Text.UTF8Encoding($false)
if ($tagExists) { try {
Write-Host "Version $tag already released, stopping job." $response = Invoke-RestMethod -Uri $apiUrl -Headers $headers -Method Get
[System.IO.File]::AppendAllText($env:GITHUB_ENV, "CONTINUE=false`n", $utf8NoBom) $found = $false
} else { foreach ($release in $response) {
Write-Host "Version $tag not released yet, continuing workflow..." if ($release.tag_name -eq $tag) {
[System.IO.File]::AppendAllText($env:GITHUB_ENV, "CONTINUE=true`n", $utf8NoBom) $found = $true
break
}
}
if ($found) {
Write-Host "Release $tag already exists, stopping job."
[System.IO.File]::AppendAllText($env:GITHUB_ENV, "CONTINUE=false`n", $utf8NoBom)
} else {
Write-Host "Release $tag not found, continuing workflow..."
}
} catch {
Write-Host "Failed to query releases list, continuing workflow..."
} }
exit 0
- name: Run tests - name: Run tests
if: env.CONTINUE == 'true' if: env.CONTINUE == 'true'
@@ -79,15 +113,19 @@ jobs:
run: | run: |
python build.py python build.py
- name: Ensure archive exists - name: Ensure artifacts exist
if: env.CONTINUE == 'true' if: env.CONTINUE == 'true'
shell: powershell shell: powershell
run: | run: |
$version = "${{ steps.extract_version.outputs.version }}" $version = "${{ steps.extract_version.outputs.version }}"
$archivePath = "dist/AnabasisManager-$version.zip" $archivePath = "dist/AnabasisManager-$version.zip"
$installerPath = "dist/AnabasisManager-setup-$version.exe"
if (-not (Test-Path $archivePath)) { if (-not (Test-Path $archivePath)) {
throw "Archive not found: $archivePath" throw "Archive not found: $archivePath"
} }
if (-not (Test-Path $installerPath)) {
throw "Installer not found: $installerPath"
}
- name: Generate SHA256 checksum - name: Generate SHA256 checksum
if: env.CONTINUE == 'true' if: env.CONTINUE == 'true'
@@ -95,11 +133,14 @@ jobs:
run: | run: |
$version = "${{ steps.extract_version.outputs.version }}" $version = "${{ steps.extract_version.outputs.version }}"
$archiveName = "AnabasisManager-$version.zip" $archiveName = "AnabasisManager-$version.zip"
$archivePath = "dist/$archiveName" $installerName = "AnabasisManager-setup-$version.exe"
$checksumPath = "dist/$archiveName.sha256" foreach ($name in @($archiveName, $installerName)) {
$hash = (Get-FileHash -Path $archivePath -Algorithm SHA256).Hash.ToLower() $path = "dist/$name"
"$hash $archiveName" | Set-Content -Path $checksumPath -Encoding UTF8 $checksumPath = "dist/$name.sha256"
Write-Host "Checksum created: $checksumPath" $hash = (Get-FileHash -Path $path -Algorithm SHA256).Hash.ToLower()
"$hash $name" | Set-Content -Path $checksumPath -Encoding UTF8
Write-Host "Checksum created: $checksumPath"
}
- name: Configure git identity - name: Configure git identity
if: env.CONTINUE == 'true' if: env.CONTINUE == 'true'
@@ -114,8 +155,13 @@ jobs:
run: | run: |
$version = "${{ steps.extract_version.outputs.version }}" $version = "${{ steps.extract_version.outputs.version }}"
$tag = "v$version" $tag = "v$version"
git tag "$tag" $tagLine = (git ls-remote --tags origin "refs/tags/$tag" | Select-Object -First 1)
git push origin "$tag" if ([string]::IsNullOrWhiteSpace($tagLine)) {
git tag "$tag"
git push origin "$tag"
} else {
Write-Host "Tag $tag already exists on origin, skipping tag push."
}
- name: Create Gitea Release - name: Create Gitea Release
if: env.CONTINUE == 'true' if: env.CONTINUE == 'true'
@@ -131,3 +177,5 @@ jobs:
files: | files: |
dist/AnabasisManager-${{ steps.extract_version.outputs.version }}.zip dist/AnabasisManager-${{ steps.extract_version.outputs.version }}.zip
dist/AnabasisManager-${{ steps.extract_version.outputs.version }}.zip.sha256 dist/AnabasisManager-${{ steps.extract_version.outputs.version }}.zip.sha256
dist/AnabasisManager-setup-${{ steps.extract_version.outputs.version }}.exe
dist/AnabasisManager-setup-${{ steps.extract_version.outputs.version }}.exe.sha256

View File

@@ -1 +1 @@
APP_VERSION = "2.0.0" APP_VERSION = "2.1.0"

View File

@@ -11,8 +11,10 @@ VERSION = APP_VERSION # Единая версия приложения
MAIN_SCRIPT = "main.py" MAIN_SCRIPT = "main.py"
UPDATER_SCRIPT = "updater_gui.py" UPDATER_SCRIPT = "updater_gui.py"
ICON_PATH = "icon.ico" ICON_PATH = "icon.ico"
INSTALLER_SCRIPT = os.path.join("installer", "AnabasisManager.iss")
DIST_DIR = os.path.join("dist", APP_NAME) DIST_DIR = os.path.join("dist", APP_NAME)
ARCHIVE_NAME = f"{APP_NAME}-{VERSION}" # Формат Название-Версия ARCHIVE_NAME = f"{APP_NAME}-{VERSION}" # Формат Название-Версия
INSTALLER_NAME = f"{APP_NAME}-setup-{VERSION}.exe"
SAFE_CLEAN_ROOT_FILES = {"main.py", "updater_gui.py", "requirements.txt", "build.py"} SAFE_CLEAN_ROOT_FILES = {"main.py", "updater_gui.py", "requirements.txt", "build.py"}
REMOVE_LIST = [ REMOVE_LIST = [
"Qt6Pdf.dll", "Qt6PdfQuick.dll", "Qt6PdfWidgets.dll", "Qt6Pdf.dll", "Qt6PdfQuick.dll", "Qt6PdfWidgets.dll",
@@ -137,6 +139,59 @@ def create_archive():
print(f"[ERROR] Не удалось создать архив: {e}") print(f"[ERROR] Не удалось создать архив: {e}")
def _find_iscc():
candidates = []
iscc_env = os.getenv("ISCC_PATH", "").strip()
if iscc_env:
candidates.append(iscc_env)
candidates.append(shutil.which("iscc"))
candidates.append(shutil.which("ISCC.exe"))
candidates.append(r"C:\Program Files (x86)\Inno Setup 6\ISCC.exe")
candidates.append(r"C:\Program Files\Inno Setup 6\ISCC.exe")
for candidate in candidates:
if candidate and os.path.exists(candidate):
return candidate
return ""
def build_installer():
print(f"\n--- 4. Создание установщика {INSTALLER_NAME} ---")
if os.name != "nt":
print("[INFO] Установщик Inno Setup создается только на Windows. Шаг пропущен.")
return
if not os.path.exists(INSTALLER_SCRIPT):
print(f"[ERROR] Не найден скрипт установщика: {INSTALLER_SCRIPT}")
sys.exit(1)
if not os.path.exists(DIST_DIR):
print(f"[ERROR] Не найдена папка сборки приложения: {DIST_DIR}")
sys.exit(1)
iscc_path = _find_iscc()
if not iscc_path:
print("[ERROR] Не найден Inno Setup Compiler (ISCC.exe).")
print("[ERROR] Установите Inno Setup 6 или задайте переменную окружения ISCC_PATH.")
sys.exit(1)
icon_abs_path = os.path.abspath(ICON_PATH)
command = [
iscc_path,
f"/DMyAppVersion={VERSION}",
f"/DMySourceDir={os.path.abspath(DIST_DIR)}",
f"/DMyOutputDir={os.path.abspath('dist')}",
f"/DMyIconFile={icon_abs_path}",
os.path.abspath(INSTALLER_SCRIPT),
]
try:
subprocess.check_call(command)
installer_path = os.path.join("dist", INSTALLER_NAME)
if not os.path.exists(installer_path):
print(f"[ERROR] Установщик не создан: {installer_path}")
sys.exit(1)
print(f"[OK] Установщик создан: {installer_path}")
except subprocess.CalledProcessError as e:
print(f"[ERROR] Ошибка при создании установщика: {e}")
sys.exit(1)
if __name__ == "__main__": if __name__ == "__main__":
ensure_project_root() ensure_project_root()
# Предварительная очистка # Предварительная очистка
@@ -149,8 +204,10 @@ if __name__ == "__main__":
run_cleanup() run_cleanup()
write_version_marker() write_version_marker()
create_archive() create_archive()
build_installer()
print("\n" + "=" * 30) print("\n" + "=" * 30)
print("ПРОЦЕСС ЗАВЕРШЕН") print("ПРОЦЕСС ЗАВЕРШЕН")
print(f"Файл для отправки: dist/{ARCHIVE_NAME}.zip") print(f"Файл для отправки: dist/{ARCHIVE_NAME}.zip")
print(f"Установщик: dist/{INSTALLER_NAME}")
print("=" * 30) print("=" * 30)

View File

@@ -0,0 +1,48 @@
#define MyAppName "Anabasis Manager"
#ifndef MyAppVersion
#define MyAppVersion "0.0.0"
#endif
#ifndef MySourceDir
#define MySourceDir "..\\dist\\AnabasisManager"
#endif
#ifndef MyOutputDir
#define MyOutputDir "..\\dist"
#endif
#ifndef MyIconFile
#define MyIconFile "..\\icon.ico"
#endif
[Setup]
AppId={{6CD9D6F2-4B95-4E9C-A8D8-2A9C8F6AA741}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppPublisher=Benya
DefaultDirName={localappdata}\Programs\Anabasis Manager
DefaultGroupName=Anabasis Manager
DisableProgramGroupPage=yes
PrivilegesRequired=lowest
OutputDir={#MyOutputDir}
OutputBaseFilename=AnabasisManager-setup-{#MyAppVersion}
Compression=lzma2
SolidCompression=yes
WizardStyle=modern
ArchitecturesInstallIn64BitMode=x64compatible
UninstallDisplayIcon={app}\AnabasisManager.exe
SetupIconFile={#MyIconFile}
[Languages]
Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl"
Name: "english"; MessagesFile: "compiler:Default.isl"
[Tasks]
Name: "desktopicon"; Description: "Создать ярлык на рабочем столе"; GroupDescription: "Дополнительные задачи:"
[Files]
Source: "{#MySourceDir}\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
[Icons]
Name: "{group}\Anabasis Manager"; Filename: "{app}\AnabasisManager.exe"
Name: "{autodesktop}\Anabasis Manager"; Filename: "{app}\AnabasisManager.exe"; Tasks: desktopicon
[Run]
Filename: "{app}\AnabasisManager.exe"; Description: "Запустить Anabasis Manager"; Flags: nowait postinstall skipifsilent

View File

@@ -1212,12 +1212,9 @@ class VkChatManager(QMainWindow):
version=latest_version, version=latest_version,
) )
self._log_event("auto_update", f"Update {latest_version} started from {download_url}") self._log_event("auto_update", f"Update {latest_version} started from {download_url}")
QMessageBox.information( self.status_label.setText("Статус: обновление запущено, закрываю приложение...")
self, self.close()
"Обновление запущено", QTimer.singleShot(0, QApplication.instance().quit)
"Обновление скачано. Открылось окно обновления.",
)
QApplication.instance().quit()
return True return True
except Exception as e: except Exception as e:
self._log_event("auto_update_failed", str(e), level="ERROR") self._log_event("auto_update_failed", str(e), level="ERROR")

View File

@@ -1,10 +1,76 @@
import importlib.util import importlib.util
import sys
import tempfile import tempfile
import unittest import unittest
from pathlib import Path from pathlib import Path
import types
def _install_pyside6_stubs():
if "PySide6" in sys.modules:
return
pyside6_module = types.ModuleType("PySide6")
qtcore_module = types.ModuleType("PySide6.QtCore")
qtgui_module = types.ModuleType("PySide6.QtGui")
qtwidgets_module = types.ModuleType("PySide6.QtWidgets")
class _Signal:
def __init__(self, *args, **kwargs):
pass
def connect(self, *args, **kwargs):
pass
class _QObject:
pass
class _QThread:
def __init__(self, *args, **kwargs):
pass
class _QTimer:
@staticmethod
def singleShot(*args, **kwargs):
pass
class _QUrl:
@staticmethod
def fromLocalFile(path):
return path
class _QDesktopServices:
@staticmethod
def openUrl(*args, **kwargs):
return True
class _Widget:
def __init__(self, *args, **kwargs):
pass
qtcore_module.QObject = _QObject
qtcore_module.Qt = type("Qt", (), {})
qtcore_module.QThread = _QThread
qtcore_module.Signal = _Signal
qtcore_module.QTimer = _QTimer
qtcore_module.QUrl = _QUrl
qtgui_module.QDesktopServices = _QDesktopServices
qtwidgets_module.QApplication = _Widget
qtwidgets_module.QLabel = _Widget
qtwidgets_module.QProgressBar = _Widget
qtwidgets_module.QVBoxLayout = _Widget
qtwidgets_module.QWidget = _Widget
qtwidgets_module.QPushButton = _Widget
qtwidgets_module.QHBoxLayout = _Widget
sys.modules["PySide6"] = pyside6_module
sys.modules["PySide6.QtCore"] = qtcore_module
sys.modules["PySide6.QtGui"] = qtgui_module
sys.modules["PySide6.QtWidgets"] = qtwidgets_module
MODULE_PATH = Path("updater_gui.py") MODULE_PATH = Path("updater_gui.py")
_install_pyside6_stubs()
SPEC = importlib.util.spec_from_file_location("updater_gui_under_test", MODULE_PATH) SPEC = importlib.util.spec_from_file_location("updater_gui_under_test", MODULE_PATH)
updater_gui = importlib.util.module_from_spec(SPEC) updater_gui = importlib.util.module_from_spec(SPEC)
SPEC.loader.exec_module(updater_gui) SPEC.loader.exec_module(updater_gui)