From cdd148030aec95ff6a4973e042cafc4278be16e1 Mon Sep 17 00:00:00 2001 From: Shmuel Max Date: Sun, 3 May 2026 17:50:53 +0300 Subject: [PATCH 1/2] ci: add lint, test matrix, and build workflow --- .github/workflows/ci.yml | 80 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 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..226774a --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,80 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +permissions: + contents: read + +jobs: + # ── Job 1: Lint ──────────────────────────────────────────────────── + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 + + - uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Cache pip + uses: actions/cache@v4 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }} + restore-keys: ${{ runner.os }}-pip- + + - name: Install linter + run: pip install ruff + + - name: Run lint + run: ruff check src/ + + # ── Job 2: Test ──────────────────────────────────────────────────── + test: + name: Test + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.10", "3.11", "3.12"] + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 + + - uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + + - name: Install dependencies + run: pip install -r requirements.txt + + - name: Run tests + run: pytest src/ --junitxml=test-results.xml + + - uses: actions/upload-artifact@v4 + if: always() # runs even if previous steps failed + with: + name: debug-logs + path: '*.log' + # ── Job 3: Build ─────────────────────────────────────────────────── + build: + name: Build + needs: [lint, test] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 + + - name: Build distribution + run: | + pip install build + python -m build + + - name: Upload dist artifact + uses: actions/upload-artifact@v4 + with: + name: dist + path: dist/ \ No newline at end of file From eb556871f4407bbee4e801edd4bac8933e17f7f2 Mon Sep 17 00:00:00 2001 From: Shmuel Max Date: Sun, 3 May 2026 17:59:18 +0300 Subject: [PATCH 2/2] ci(build): run python -m build from src/ where pyproject.toml lives --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 226774a..879562e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -71,7 +71,8 @@ jobs: - name: Build distribution run: | pip install build - python -m build + cd src + python -m build --outdir ../dist - name: Upload dist artifact uses: actions/upload-artifact@v4