-
Notifications
You must be signed in to change notification settings - Fork 0
ci: add GitHub Actions workflows for CI testing and PyPI publishing #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| name: Publish to PyPI | ||
|
|
||
| on: | ||
| release: | ||
| types: [published] | ||
| push: | ||
| tags: | ||
| - "v*" | ||
|
Comment on lines
+4
to
+8
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win Use one publish trigger per package version. When a matching Remove the tag-push trigger: Proposed fix on:
release:
types: [published]
- push:
- tags:
- - "v*"
workflow_dispatch:🤖 Prompt for AI Agents |
||
| 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 | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win Pin the PyPI publish action to a reviewed commit SHA.
🤖 Prompt for AI Agents |
||
| - name: Publish to PyPI | ||
| uses: pypa/gh-action-pypi-publish@release/v1 | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
Set explicit read-only token permissions.
.github/workflows/ci.ymldefines nopermissionsblock. Thelint-and-securityandtest-suitejobs inherit the repository or organization defaultGITHUB_TOKENpermissions. If that default includes write access, the jobs expose unnecessary write authority toactions/checkoutand workflow code.Proposed fix
on: push: branches: [main, dev] pull_request: branches: [main, dev] +permissions: + contents: read + jobs:🧰 Tools
🪛 zizmor (1.29.0)
[warning] 1-69: overly broad permissions (excessive-permissions): default permissions used due to no permissions: block
(excessive-permissions)
🤖 Prompt for AI Agents