Files
SharedWorkflows/.gitea/workflows/python-checks.yml
dresber 1434f75112 fix: fetch commit subject via Gitea API instead of git log
Notification job had no checkout step so git log always failed,
producing "Commit info unavailable". Now uses the existing
API_GITEA_TOKEN and gitea.sha context to fetch the commit message
from the Gitea API directly.

Also raises default coverage threshold in python-checks to 80%.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-27 22:01:55 +02:00

75 lines
1.9 KiB
YAML

name: Reusable Python Checks
on:
workflow_call:
inputs:
python_version:
type: string
default: "3.14"
source_path:
type: string
default: "app"
tests_path:
type: string
default: "tests"
test_command:
type: string
default: "coverage run -m pytest"
coverage_fail_under:
type: string
default: "80"
run_security_scan:
type: boolean
default: true
jobs:
check:
runs-on: docker
container:
image: gitea.tech-buddy.at/bitbuddydev/gitea_runner_python314:dev-bda315b82bb23d83065b77d91fedf0e20d9accf1
credentials:
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Tools & Deps
run: |
python -m pip install --upgrade pip setuptools wheel
pip install -e ".[dev]" || pip install -e ".[test]" || pip install -e .
pip install ruff coverage pip-audit bandit
- name: Linting
run: ruff check ${{ inputs.source_path }} ${{ inputs.tests_path }}
- name: Tests
run: |
${{ inputs.test_command }}
coverage report --fail-under=${{ inputs.coverage_fail_under }}
coverage xml
coverage html
- name: Security Scan
if: ${{ inputs.run_security_scan }}
run: |
pip freeze | grep -v "git+" > req.txt
pip-audit -r req.txt
bandit -r ${{ inputs.source_path }}
- name: Upload Coverage HTML
if: always()
uses: actions/upload-artifact@v3
with:
name: coverage-html
path: htmlcov/
if-no-files-found: warn
- name: Upload Coverage XML
if: always()
uses: actions/upload-artifact@v3
with:
name: coverage-xml
path: coverage.xml
if-no-files-found: warn