Skip to content

Update docstrings in test_api_smoke.py #204

Update docstrings in test_api_smoke.py

Update docstrings in test_api_smoke.py #204

Workflow file for this run

name: CI — API Service
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}/api
jobs:
lint:
name: Lint & Import Check (API)
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref || github.ref_name }}
fetch-depth: 0
- 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 api/requirements.txt ] && pip install -r api/requirements.txt || true
- name: Black auto-format
run: black api/
- name: isort auto-fix import order
run: isort api/
- name: Commit formatting fixes (if any)
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "style: auto-format api/ with black & isort [skip ci]"
file_pattern: "api/**/*.py"
- name: Flake8 lint
run: flake8 api/ --max-line-length=100 --ignore=E203,W503
- name: Python import check (catch broken imports)
run: |
cd api
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 API 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 API Docker image
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile.api
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