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