From a7217e0c45451bd878c694cfd628877a3d51d504 Mon Sep 17 00:00:00 2001 From: HKPA Date: Sat, 16 May 2026 01:31:52 +0200 Subject: [PATCH] ci: add GitHub Actions CI pipeline for backend and frontend tests - Backend job: Python 3.12, installs deps excluding cloakbrowser (custom binary), runs pytest with conftest.py mocking cloakbrowser via sys.modules - Frontend job: Node 20, npm ci, build, and vitest - Triggers on push to main and PRs to main --- .github/workflows/ci.yml | 57 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..ae98b897 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,57 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + backend: + name: Backend Tests + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python 3.12 + uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install dependencies + run: | + # Install backend deps EXCEPT cloakbrowser (custom binary not available in CI). + # The conftest.py mocks cloakbrowser via sys.modules before any import. + grep -v '^cloakbrowser' backend/requirements.txt > /tmp/ci-requirements.txt + pip install -r /tmp/ci-requirements.txt + pip install pytest pytest-asyncio starlette + + - name: Run tests + run: python -m pytest backend/tests/ -v + + frontend: + name: Frontend Tests + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up Node 20 + uses: actions/setup-node@v4 + with: + node-version: "20" + cache: npm + cache-dependency-path: frontend/package-lock.json + + - name: Install dependencies + working-directory: frontend + run: npm ci + + - name: Build + working-directory: frontend + run: npm run build + + - name: Run tests + working-directory: frontend + run: npm test