From c53a93c32d1e9dea9b8717ce79b6b2028b64554f Mon Sep 17 00:00:00 2001 From: vikashgraja Date: Sun, 13 Sep 2026 22:04:27 +0530 Subject: [PATCH] ci: add GitHub Actions workflows for CI testing and PyPI publishing --- .github/workflows/ci.yml | 68 +++++++++++++++++++++++++++++++++++ .github/workflows/publish.yml | 41 +++++++++++++++++++++ 2 files changed, 109 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..1ade5dd --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,68 @@ +name: CI Test Suite & Linting + +on: + push: + branches: [main, dev] + pull_request: + branches: [main, dev] + +jobs: + lint-and-security: + name: Code Quality & Security Audit + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v4 + + - name: Install uv + uses: astral-sh/setup-uv@v5 + with: + version: "latest" + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version-file: ".python-version" + + - name: Install Dependencies + run: uv sync --all-groups + + - name: Lint Check (Ruff) + run: uv run ruff check . + + - name: Format Check (Ruff) + run: uv run ruff format --check . + + - name: Security Audit (Bandit) + run: uv run bandit -r src/ + + test-suite: + name: Unit & Integration Tests (Python ${{ matrix.python-version }}) + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ["3.13"] + + steps: + - name: Checkout Code + uses: actions/checkout@v4 + + - name: Install uv + uses: astral-sh/setup-uv@v5 + with: + version: "latest" + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install Dependencies + run: uv sync --all-groups + + - name: Install Playwright Browsers & OS Dependencies + run: uv run playwright install --with-deps chromium + + - name: Run Pytest Test Suite + run: uv run pytest -v diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..b524b20 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,41 @@ +name: Publish to PyPI + +on: + release: + types: [published] + push: + tags: + - "v*" + workflow_dispatch: + +jobs: + pypi-publish: + name: Build and publish distribution to PyPI + runs-on: ubuntu-latest + permissions: + id-token: write + contents: read + + environment: + name: pypi + url: https://pypi.org/p/dataman + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install uv + uses: astral-sh/setup-uv@v5 + with: + version: "latest" + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version-file: ".python-version" + + - name: Build distribution artifacts + run: uv build + + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1