Skip to content

Enhance test_api_smoke.py with method docstrings #206

Enhance test_api_smoke.py with method docstrings

Enhance test_api_smoke.py with method docstrings #206

Workflow file for this run

name: CI — ML Service
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}/ml
jobs:
lint:
name: Lint & Import Check (ML)
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: "pip"
- name: Install lint dependencies
run: |
pip install flake8 black isort
[ -f ml/requirements-lint.txt ] && pip install -r ml/requirements-lint.txt || true
[ -f ml/requirements.txt ] && pip install -r ml/requirements.txt --no-deps || true
- name: Black formatting check
run: black --check ml/ || echo "::warning::Black check failed — ml/ may be incomplete"
- name: isort import order check
run: isort --check-only ml/ || echo "::warning::isort check failed — ml/ may be incomplete"
- name: Flake8 lint
run: flake8 ml/ --max-line-length=100 --ignore=E203,W503 || echo "::warning::Flake8 issues in ml/ — work in progress"
- name: Python syntax check (hard fail on syntax errors only)
run: |
cd ml
python -c "import ast, sys, pathlib
errors = []
for f in pathlib.Path('.').rglob('*.py'):
try:
ast.parse(f.read_text())
except SyntaxError as e:
errors.append(f'{f}: {e}')
if errors:
print('\n'.join(errors)); sys.exit(1)
print('All Python files parsed OK')"
build-and-push:
name: Build & Push ML Image
runs-on: ubuntu-latest
needs: lint
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=sha,prefix=sha-
type=raw,value=latest,enable={{is_default_branch}}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push ML Docker image
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile.ml
push: ${{ github.ref == 'refs/heads/main' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max