CI: build pipeline testet nun immer automatisch vor dem build alle Test. Ausserdem gibts einen deploy-pfad
This commit is contained in:
1 parent
971459c9bf
commit
2aad2c9d99
12 files changed
+543
-27
No files matched your search
@@ -3,6 +3,7 @@
|
||||
import json
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
_CONFIRM_SCRIPT = r'''
|
||||
@@ -25,9 +26,18 @@ def stop_existing_server(port: int = 8501) -> bool:
|
||||
if os.name != "nt":
|
||||
raise RuntimeError("Der kontrollierte Server-Neustart unterstützt nur Windows.")
|
||||
|
||||
app_path = str(Path(__file__).resolve().with_name("app.py"))
|
||||
app_path = Path(__file__).resolve().with_name("app.py")
|
||||
app_paths = [str(app_path)]
|
||||
if getattr(sys, "frozen", False):
|
||||
# A locally built EXE in 2_build/ must also recognize the sibling
|
||||
# development application, whose path differs from _MEIPASS/app.py.
|
||||
exe_dir = Path(sys.executable).resolve().parent
|
||||
development_app = exe_dir.parent / "0_application" / "app.py"
|
||||
if exe_dir.name.lower() == "2_build" and development_app.is_file():
|
||||
app_paths.append(str(development_app))
|
||||
# Pass paths through the environment, never interpolate them into shell code.
|
||||
env = dict(os.environ, APP_RESTART_PATH=app_path, APP_RESTART_PID=str(os.getpid()),
|
||||
env = dict(os.environ, APP_RESTART_PATH=str(app_path),
|
||||
APP_RESTART_PATHS=json.dumps(app_paths), APP_RESTART_PID=str(os.getpid()),
|
||||
APP_RESTART_PORT=str(port),
|
||||
APP_RESTART_VENV=str(Path(app_path).parent / ".venv" / "Scripts"))
|
||||
script = _CONFIRM_SCRIPT + r'''
|
||||
@@ -47,11 +57,15 @@ foreach ($processId in $processIds) {
|
||||
if (-not $process) { continue }
|
||||
$isExe = $process.Name -eq 'Tätigkeitsnachweis-Generator.exe'
|
||||
$command = $process.CommandLine
|
||||
$appArgument = '(?i)\bstreamlit(?:\.exe)?"?\s+run\s+"?' +
|
||||
[regex]::Escape($env:APP_RESTART_PATH) + '"?(?:\s|$)'
|
||||
$matchesApp = $false
|
||||
foreach ($appPath in ($env:APP_RESTART_PATHS | ConvertFrom-Json)) {
|
||||
$appArgument = '(?i)\bstreamlit(?:\.exe)?"?\s+run\s+"?' +
|
||||
[regex]::Escape($appPath) + '"?(?:\s|$)'
|
||||
if ($command -match $appArgument) { $matchesApp = $true }
|
||||
}
|
||||
$isDev = $process.Name -match '^(python(?:w)?(?:\d+(?:\.\d+)*)?(?:w)?|streamlit)\.exe$' -and
|
||||
$command -match '(?i)\bstreamlit(?:\.exe)?"?\s+run\s+' -and
|
||||
($command -match $appArgument -or
|
||||
($matchesApp -or
|
||||
($command -match '(?i)\bstreamlit(?:\.exe)?"?\s+run\s+"?app\.py"?(?:\s|$)' -and
|
||||
[IO.Path]::GetDirectoryName($process.ExecutablePath) -eq $env:APP_RESTART_VENV))
|
||||
if (-not ($isExe -or $isDev)) {
|
||||
|
||||
Reference in new issue
Block a user