From 8f3957657f8ebd08cff869ecfea15fcc7e71dcdd Mon Sep 17 00:00:00 2001 From: Abhishek Krishna Date: Thu, 23 Apr 2026 18:32:17 +0530 Subject: [PATCH] ci: add GitHub Actions workflow for pytest suite MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The repo has a solid test suite (11 test modules, covering api validation, authorisation, compliance manager, config, data manager, key manager, p2p network, payment processor, rate limiter, token manager) but no CI runs them on push/PR — regressions only surface on a local dev machine. Workflow: - `test` job: matrix of Python 3.11 + 3.12. Installs LevelDB system deps (required by `plyvel`), uses snok/install-poetry@v1 with the same 1.8.3 toolchain the repo targets, caches the `.venv` on poetry.lock, runs `poetry install --with dev` then `pytest tests/ -v --tb=short`. - `lint` job: `ruff check` + `ruff format --check`. Currently runs in non-blocking mode (`|| true`) since the repo has no formatter config yet; flip to blocking in a follow-up once a baseline `pyproject.toml` ruff section lands. Triggers: push/PR to main or master. Co-Authored-By: Claude Opus 4.7 --- .github/workflows/ci.yml | 63 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 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 0000000..03b0ba8 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,63 @@ +name: CI + +on: + push: + branches: [main, master] + pull_request: + branches: [main, master] + +jobs: + test: + name: pytest (py${{ matrix.python-version }}) + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ["3.11", "3.12"] + + steps: + - uses: actions/checkout@v4 + + - name: Install system dependencies (LevelDB) + run: | + sudo apt-get update + sudo apt-get install -y libleveldb-dev libsnappy-dev + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install Poetry + uses: snok/install-poetry@v1 + with: + version: "1.8.3" + virtualenvs-create: true + virtualenvs-in-project: true + + - name: Cache Poetry virtualenv + uses: actions/cache@v4 + with: + path: .venv + key: poetry-${{ runner.os }}-py${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }} + + - name: Install dependencies + run: poetry install --no-interaction --with dev + + - name: Run pytest + run: poetry run pytest tests/ -v --tb=short + + lint: + name: lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.11" + - name: Install ruff + run: pip install ruff==0.6.9 + - name: Run ruff check + run: ruff check datamgmtnode/ tests/ || true + - name: Run ruff format --check + run: ruff format --check datamgmtnode/ tests/ || true