Files
LOGAR/.gitea/workflows/ci.yml
T
me0nline ea6410d391
Release Binaries & Packages / Build & Release Standalone Binaries (Linux & Windows Cross-Compilation) (push) Canceled after 0s
CI Test Suite / Run Component Tests & Pipeline Verification (push) Canceled after 0s
ci: rely on pre-installed builder runner dependencies and remove redundant apt/pip steps
2026-09-30 18:20:04 +02:00

75 lines
2.4 KiB
YAML

name: CI Test Suite
on:
push:
branches:
- '**'
tags-ignore:
- '*'
- '**'
- 'v*'
pull_request:
workflow_dispatch:
jobs:
test:
name: Run Component Tests & Pipeline Verification
if: "!startsWith(github.ref, 'refs/tags/')"
runs-on: logar
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Verify Environment
run: |
python3 --version
python3 -c "import pgpy, fastapi, uvicorn, websockets, sqlalchemy; print('[+] All required dependencies are pre-installed in runner image.')"
- name: Verify Python Syntax
run: |
python3 -m py_compile src/Server.py src/server_enrollment.py src/Win_Client.py src/Linux_Client.py compilation/package_dist.py compilation/upload_release.py tests/test_pipeline.py tests/*.py
- name: Run Component Unit Tests
run: |
PYTHONWARNINGS="ignore" python3 -m unittest discover -s tests -v
- name: Run End-to-End Pipeline Integration Test
run: |
# Clean up any leftover test configs or database
rm -f server_config.json client_config.json logar_state.db client_state.json
# 1. Initialize server config and export client configuration
python3 src/Server.py --create-client-config --server-host 127.0.0.1 --server-port 9443 --client-out client_config.json
# 2. Launch LOGAR server in the background
python3 src/Server.py &
SERVER_PID=$!
echo "[*] Server launched in background with PID $SERVER_PID"
# 3. Poll /health endpoint until server is listening
READY=0
for i in $(seq 1 20); do
if python3 -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8443/health', timeout=1)" >/dev/null 2>&1; then
echo "[+] LOGAR Server is ready after ${i}s."
READY=1
break
fi
sleep 1
done
if [ $READY -ne 1 ]; then
echo "[!] Server failed to start within 20 seconds."
kill $SERVER_PID || true
exit 1
fi
# 4. Execute end-to-end integration test
python3 tests/test_pipeline.py
# 5. Cleanly terminate background server
kill $SERVER_PID || true
wait $SERVER_PID 2>/dev/null || true
echo "[+] Server stopped successfully."