diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index d84559d..a643e96 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -20,25 +20,25 @@ jobs: - name: Checkout Code uses: actions/checkout@v4 - - name: Install System Dependencies & Python + - name: Install Dependencies run: | - if command -v apt-get >/dev/null 2>&1; then - export DEBIAN_FRONTEND=noninteractive - if [ -f /etc/apt/sources.list ]; then - sed -i 's|deb.debian.org/debian-security bullseye-security|security.debian.org/debian-security bullseye-security|g' /etc/apt/sources.list 2>/dev/null || true - fi - rm -rf /var/lib/apt/lists/* - apt-get update -y || apt-get update --fix-missing -y || true - apt-get install -y --no-install-recommends python3 python3-pip python3-venv curl || apt-get install -y --fix-missing python3 python3-pip python3-venv curl || true - fi - if ! command -v pip3 >/dev/null 2>&1 && ! python3 -m pip --version >/dev/null 2>&1; then - if command -v curl >/dev/null 2>&1; then - curl -sS https://bootstrap.pypa.io/get-pip.py | python3 || true + # 1. Ensure Python3 is present; try apt-get only if missing + if ! command -v python3 >/dev/null 2>&1; then + if command -v apt-get >/dev/null 2>&1; then + export DEBIAN_FRONTEND=noninteractive + apt-get update -y || true + apt-get install -y --no-install-recommends python3 || true fi fi - python3 -m pip install --upgrade pip --break-system-packages || python3 -m pip install --upgrade pip || true - python3 -m pip install -r compilation/requirements.txt --break-system-packages || python3 -m pip install -r compilation/requirements.txt || pip3 install -r compilation/requirements.txt + # 2. Bootstrap pip via ensurepip or get-pip.py + if ! python3 -m pip --version >/dev/null 2>&1; then + python3 -m ensurepip --default-pip 2>/dev/null || (python3 -c "import urllib.request; urllib.request.urlretrieve('https://bootstrap.pypa.io/get-pip.py', '/tmp/get-pip.py')" && python3 /tmp/get-pip.py --break-system-packages 2>/dev/null || python3 /tmp/get-pip.py 2>/dev/null || true) + fi + + # 3. Upgrade pip and install project dependencies + python3 -m pip install --upgrade pip --break-system-packages 2>/dev/null || python3 -m pip install --upgrade pip 2>/dev/null || true + python3 -m pip install -r compilation/requirements.txt --break-system-packages 2>/dev/null || python3 -m pip install -r compilation/requirements.txt - name: Verify Python Syntax run: | @@ -64,7 +64,7 @@ jobs: # 3. Poll Hermes health / report endpoint until server is listening READY=0 for i in $(seq 1 20); do - if curl -s http://127.0.0.1:8443/api/hermes/report >/dev/null 2>&1; then + if python3 -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8443/api/hermes/report', timeout=1)" >/dev/null 2>&1; then echo "[+] LOGAR Server is ready after ${i}s." READY=1 break diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index fefe93a..ce7c416 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -21,22 +21,24 @@ jobs: - name: Install Python and Build Dependencies run: | - if command -v apt-get >/dev/null 2>&1; then - export DEBIAN_FRONTEND=noninteractive - if [ -f /etc/apt/sources.list ]; then - sed -i 's|deb.debian.org/debian-security bullseye-security|security.debian.org/debian-security bullseye-security|g' /etc/apt/sources.list 2>/dev/null || true - fi - rm -rf /var/lib/apt/lists/* - apt-get update -y || apt-get update --fix-missing -y || true - apt-get install -y --no-install-recommends python3 python3-pip python3-venv binutils zip curl || apt-get install -y --fix-missing python3 python3-pip python3-venv binutils zip curl || true - fi - if ! command -v pip3 >/dev/null 2>&1 && ! python3 -m pip --version >/dev/null 2>&1; then - if command -v curl >/dev/null 2>&1; then - curl -sS https://bootstrap.pypa.io/get-pip.py | python3 || true + # 1. Ensure Python3 is present; try apt-get only if missing + if ! command -v python3 >/dev/null 2>&1; then + if command -v apt-get >/dev/null 2>&1; then + export DEBIAN_FRONTEND=noninteractive + apt-get update -y || true + apt-get install -y --no-install-recommends python3 || true fi fi - python3 -m pip install --upgrade pip --break-system-packages || python3 -m pip install --upgrade pip || true - python3 -m pip install pyinstaller -r compilation/requirements.txt --break-system-packages || python3 -m pip install pyinstaller -r compilation/requirements.txt || pip3 install pyinstaller -r compilation/requirements.txt + + # 2. Bootstrap pip via ensurepip or get-pip.py + if ! python3 -m pip --version >/dev/null 2>&1; then + python3 -m ensurepip --default-pip 2>/dev/null || (python3 -c "import urllib.request; urllib.request.urlretrieve('https://bootstrap.pypa.io/get-pip.py', '/tmp/get-pip.py')" && python3 /tmp/get-pip.py --break-system-packages 2>/dev/null || python3 /tmp/get-pip.py 2>/dev/null || true) + fi + + # 3. Upgrade pip and install pyinstaller + dependencies + python3 -m pip install --upgrade pip --break-system-packages 2>/dev/null || python3 -m pip install --upgrade pip 2>/dev/null || true + python3 -m pip install pyinstaller -r compilation/requirements.txt --break-system-packages 2>/dev/null || python3 -m pip install pyinstaller -r compilation/requirements.txt + - name: Compile Standalone Linux Binaries