Initial release: - Complete async API client (45+ endpoints) - Pydantic models for all responses - Two-step authentication - Comprehensive error handling - 92% test coverage - Gitea Actions CI/CD - Semantic release configured
87 lines
2.3 KiB
YAML
87 lines
2.3 KiB
YAML
name: PR Checks
|
|
|
|
on:
|
|
pull_request:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Use system Python
|
|
run: |
|
|
echo "Python $(python3 --version)"
|
|
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
|
|
|
- name: Install dependencies (with dev)
|
|
run: uv sync --group dev
|
|
|
|
- name: Run tests with coverage
|
|
run: |
|
|
uv run pytest tests/unit/ \
|
|
-v \
|
|
--tb=short \
|
|
--cov=src/kwork_api \
|
|
--cov-report=term-missing \
|
|
--cov-report=html:coverage-html \
|
|
--html=test-results/report.html \
|
|
--self-contained-html
|
|
|
|
- name: Check coverage threshold (90%)
|
|
run: |
|
|
COVERAGE=$(uv run coverage report | grep TOTAL | awk '{print $NF}' | tr -d '%')
|
|
echo "Coverage: ${COVERAGE}%"
|
|
if (( $(echo "$COVERAGE < 90" | bc -l) )); then
|
|
echo "❌ Coverage ${COVERAGE}% is below 90% threshold"
|
|
exit 1
|
|
fi
|
|
echo "✅ Coverage ${COVERAGE}% meets 90% threshold"
|
|
|
|
- name: Upload test results
|
|
uses: actions/upload-artifact@v3
|
|
if: always()
|
|
with:
|
|
name: test-results
|
|
path: test-results/
|
|
retention-days: 7
|
|
|
|
- name: Upload coverage report
|
|
uses: actions/upload-artifact@v3
|
|
if: always()
|
|
with:
|
|
name: coverage-report
|
|
path: coverage-html/
|
|
retention-days: 7
|
|
|
|
- name: Run linting
|
|
run: uv run ruff check src/kwork_api tests/
|
|
|
|
- name: Run formatter check
|
|
run: uv run ruff format --check src/kwork_api tests/
|
|
|
|
security:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Use system Python
|
|
run: |
|
|
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
|
|
|
- name: Install dependencies
|
|
run: uv sync --group dev
|
|
|
|
- name: Run safety check
|
|
run: uv run pip-audit || true
|
|
|
|
- name: Check for secrets
|
|
run: |
|
|
! grep -r "password\s*=" --include="*.py" src/ || true
|
|
! grep -r "token\s*=" --include="*.py" src/ || true
|