From 8375f135b280608c8d4dc2336e1d2f588ffc5567 Mon Sep 17 00:00:00 2001 From: Shmuel Max Date: Sun, 3 May 2026 18:25:12 +0300 Subject: [PATCH 1/2] ci: add lint, test matrix, and build workflow --- .github/workflows/ci.yml | 86 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 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..5543733 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,86 @@ +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 + + # TODO ②: Set up Python 3.11 using actions/setup-python + - name: Set up Python + uses: actions/setup-python@v4 + 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 + + - name: Set up Python + uses: actions/setup-python@v4 + 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 + + # TODO ⑤: Upload test-results.xml as an artifact (always, even on failure) + - name: Upload test results + if: always() + uses: actions/upload-artifact@v4 + with: + name: test-results-${{ matrix.python-version }} + path: test-results.xml + + # ── 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 4f299a8f652a98ab1c3f51ffdc2f27c6f71cf8d4 Mon Sep 17 00:00:00 2001 From: Shmuel Max Date: Sun, 3 May 2026 18:27:27 +0300 Subject: [PATCH 2/2] ci(build): run python -m build from src/ where pyproject.toml lives Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .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 5543733..ed53fd5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -77,7 +77,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