chore: import upstream snapshot with attribution
Tests / Import Check (Python 3.13) (push) Has been cancelled
Tests / Import Check (Python 3.14) (push) Has been cancelled
Tests / Python Tests (Python 3.11) (push) Has been cancelled
Tests / Python Tests (Python 3.12) (push) Has been cancelled
Tests / Python Tests (Python 3.14) (push) Has been cancelled
Tests / Test Summary (push) Has been cancelled
Tests / Lint and Format (push) Has been cancelled
Tests / Web Node Tests (push) Has been cancelled
Tests / Import Check (Python 3.11) (push) Has been cancelled
Tests / Import Check (Python 3.12) (push) Has been cancelled
Tests / Python Tests (Python 3.13) (push) Has been cancelled
Tests / Import Check (Python 3.13) (push) Has been cancelled
Tests / Import Check (Python 3.14) (push) Has been cancelled
Tests / Python Tests (Python 3.11) (push) Has been cancelled
Tests / Python Tests (Python 3.12) (push) Has been cancelled
Tests / Python Tests (Python 3.14) (push) Has been cancelled
Tests / Test Summary (push) Has been cancelled
Tests / Lint and Format (push) Has been cancelled
Tests / Web Node Tests (push) Has been cancelled
Tests / Import Check (Python 3.11) (push) Has been cancelled
Tests / Import Check (Python 3.12) (push) Has been cancelled
Tests / Python Tests (Python 3.13) (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
name: Docker Release
|
||||
|
||||
# Triggered when a GitHub Release is published.
|
||||
# Builds a multi-platform Docker image and pushes it to GitHub Container Registry (GHCR).
|
||||
#
|
||||
# Image: ghcr.io/hkuds/deeptutor
|
||||
# Tags:
|
||||
# - Version tag stripped of 'v' prefix (e.g. release v1.2.3 → image tag 1.2.3)
|
||||
# - latest (always points to the most recently published release)
|
||||
#
|
||||
# Platforms: linux/amd64, linux/arm64
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
name: Build and Push Multi-Platform Docker Image
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# Required for linux/arm64 cross-compilation on GitHub-hosted ubuntu runners
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
# Enable BuildKit with multi-platform build support
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to GitHub Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
# Extract tags from the release:
|
||||
# type=semver strips the leading 'v' (v1.2.3 → 1.2.3)
|
||||
# type=raw adds a 'latest' tag on every published release
|
||||
- name: Extract Docker metadata
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ghcr.io/hkuds/deeptutor
|
||||
tags: |
|
||||
type=semver,pattern={{version}}
|
||||
type=raw,value=latest
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile
|
||||
target: production
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
# Use GitHub Actions cache to speed up repeated builds
|
||||
# mode=max caches all intermediate layers (frontend-builder and python-base are expensive)
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
@@ -0,0 +1,154 @@
|
||||
name: PyPI Release
|
||||
|
||||
# Triggered when a GitHub Release is published.
|
||||
# Publishes the full app package with the version derived from the release tag:
|
||||
# - deeptutor (Python backend/CLI + packaged Next.js standalone assets)
|
||||
#
|
||||
# The CLI-only package is intentionally not published to PyPI; install it from
|
||||
# a local checkout with `python -m pip install -e ./packaging/deeptutor-cli`.
|
||||
#
|
||||
# Expected tag format: vMAJOR.MINOR.PATCH, with PEP 440-compatible suffixes allowed.
|
||||
# Example: GitHub release tag v1.3.10 -> PyPI version 1.3.10.
|
||||
#
|
||||
# PyPI authentication uses Trusted Publishing. Configure the `deeptutor` PyPI
|
||||
# project to trust this workflow file, then no API token secret is needed.
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
id-token: write
|
||||
|
||||
concurrency:
|
||||
group: pypi-release-${{ github.event.release.tag_name }}
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
build-and-publish:
|
||||
name: Build and Publish PyPI Package
|
||||
runs-on: ubuntu-latest
|
||||
environment:
|
||||
name: pypi
|
||||
url: https://pypi.org/project/deeptutor/
|
||||
|
||||
steps:
|
||||
- name: Checkout release tag
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.release.tag_name }}
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Verify release tag is on main
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
git fetch origin main:refs/remotes/origin/main --no-tags
|
||||
tag="${{ github.event.release.tag_name }}"
|
||||
tag_commit="$(git rev-list -n 1 "$tag")"
|
||||
if ! git merge-base --is-ancestor "$tag_commit" origin/main; then
|
||||
echo "Release tag $tag ($tag_commit) is not on origin/main; refusing to publish to PyPI." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.11"
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "22"
|
||||
cache: npm
|
||||
cache-dependency-path: web/package-lock.json
|
||||
|
||||
- name: Install build tools
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install --upgrade build packaging twine
|
||||
|
||||
- name: Verify release tag matches deeptutor/__version__.py
|
||||
id: version
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
python - <<'PY'
|
||||
import os
|
||||
import re
|
||||
from pathlib import Path
|
||||
from packaging.version import Version
|
||||
|
||||
tag = os.environ["RELEASE_TAG"]
|
||||
tag_raw = tag[1:] if tag.startswith("v") else tag
|
||||
tag_version = str(Version(tag_raw))
|
||||
|
||||
src = Path("deeptutor/__version__.py").read_text(encoding="utf-8")
|
||||
match = re.search(r'^__version__\s*=\s*"([^"]+)"', src, re.MULTILINE)
|
||||
if not match:
|
||||
raise SystemExit(
|
||||
"Could not find __version__ in deeptutor/__version__.py"
|
||||
)
|
||||
code_version = str(Version(match.group(1)))
|
||||
|
||||
if code_version != tag_version:
|
||||
raise SystemExit(
|
||||
f"Release tag {tag!r} (normalized {tag_version!r}) does not "
|
||||
f"match deeptutor/__version__.py value {code_version!r}. "
|
||||
"Bump __version__ before tagging."
|
||||
)
|
||||
|
||||
with open(os.environ["GITHUB_OUTPUT"], "a", encoding="utf-8") as handle:
|
||||
handle.write(f"version={code_version}\n")
|
||||
PY
|
||||
env:
|
||||
RELEASE_TAG: ${{ github.event.release.tag_name }}
|
||||
|
||||
- name: Install frontend dependencies
|
||||
working-directory: web
|
||||
run: npm ci --legacy-peer-deps
|
||||
|
||||
- name: Build packaged Web assets
|
||||
run: python scripts/prepare_web_package.py
|
||||
env:
|
||||
NEXT_PUBLIC_API_BASE: __NEXT_PUBLIC_API_BASE_PLACEHOLDER__
|
||||
NEXT_PUBLIC_AUTH_ENABLED: __NEXT_PUBLIC_AUTH_ENABLED_PLACEHOLDER__
|
||||
|
||||
- name: Build distributions
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
mkdir -p dist/deeptutor
|
||||
# Run from /tmp so any repository-local build/ directory cannot shadow
|
||||
# PyPA's `build` module during repeated package builds.
|
||||
# Wheels are the supported public install artifacts. The full app
|
||||
# wheel contains packaged Next.js assets; source distributions would
|
||||
# either duplicate those large assets or require a frontend build.
|
||||
(cd /tmp && python -m build --wheel --outdir "$GITHUB_WORKSPACE/dist/deeptutor" "$GITHUB_WORKSPACE")
|
||||
|
||||
- name: Verify package metadata
|
||||
run: |
|
||||
python -m twine check dist/deeptutor/*
|
||||
python - <<'PY'
|
||||
from pathlib import Path
|
||||
expected = "${{ steps.version.outputs.version }}"
|
||||
files = {
|
||||
"deeptutor": sorted(path.name for path in Path("dist/deeptutor").glob("*")),
|
||||
}
|
||||
for package, names in files.items():
|
||||
print(package)
|
||||
print("\n".join(f" {name}" for name in names))
|
||||
required = [
|
||||
("deeptutor", f"deeptutor-{expected}-py3-none-any.whl"),
|
||||
]
|
||||
missing = [name for package, name in required if name not in files[package]]
|
||||
if missing:
|
||||
raise SystemExit(f"Missing expected distributions: {missing}")
|
||||
PY
|
||||
|
||||
- name: Publish deeptutor to PyPI
|
||||
uses: pypa/gh-action-pypi-publish@release/v1
|
||||
with:
|
||||
packages-dir: dist/deeptutor/
|
||||
print-hash: true
|
||||
@@ -0,0 +1,202 @@
|
||||
name: Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- dev
|
||||
paths:
|
||||
- "deeptutor/**"
|
||||
- "deeptutor_cli/**"
|
||||
- "tests/**"
|
||||
- "requirements/**"
|
||||
- "requirements.txt"
|
||||
- "pyproject.toml"
|
||||
- "web/**"
|
||||
- ".github/workflows/tests.yml"
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- dev
|
||||
paths:
|
||||
- "deeptutor/**"
|
||||
- "deeptutor_cli/**"
|
||||
- "tests/**"
|
||||
- "requirements/**"
|
||||
- "requirements.txt"
|
||||
- "pyproject.toml"
|
||||
- "web/**"
|
||||
- ".github/workflows/tests.yml"
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
name: Lint and Format
|
||||
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"
|
||||
|
||||
- name: Install lint tools
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install ruff
|
||||
|
||||
- name: Run Ruff lint
|
||||
run: ruff check .
|
||||
|
||||
- name: Run Ruff format check
|
||||
run: ruff format --check .
|
||||
|
||||
web-tests:
|
||||
name: Web Node Tests
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "22"
|
||||
cache: npm
|
||||
cache-dependency-path: web/package-lock.json
|
||||
|
||||
- name: Install frontend dependencies
|
||||
working-directory: web
|
||||
run: npm ci --legacy-peer-deps
|
||||
|
||||
- name: Run frontend node tests
|
||||
working-directory: web
|
||||
run: npm run test:node
|
||||
|
||||
import-check:
|
||||
name: Import Check (Python ${{ matrix.python-version }})
|
||||
runs-on: ubuntu-latest
|
||||
continue-on-error: ${{ matrix.experimental == true }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
python-version: ["3.11", "3.12", "3.13"]
|
||||
experimental: [false]
|
||||
include:
|
||||
- python-version: "3.14"
|
||||
experimental: true
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
||||
- name: Cache pip packages
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.cache/pip
|
||||
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('requirements/server.txt', 'requirements/cli.txt') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-${{ matrix.python-version }}-
|
||||
|
||||
- name: Install minimal dependencies for import check
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install -r requirements/server.txt
|
||||
|
||||
- name: Check module imports
|
||||
run: |
|
||||
echo "🐍 Testing with Python ${{ matrix.python-version }}"
|
||||
python -c "from deeptutor.runtime.orchestrator import ChatOrchestrator; print('✅ Orchestrator imports OK')"
|
||||
python -c "from deeptutor.runtime.registry.tool_registry import get_tool_registry; print('✅ Tool registry imports OK')"
|
||||
python -c "from deeptutor.runtime.registry.capability_registry import get_capability_registry; print('✅ Capability registry imports OK')"
|
||||
python -c "from deeptutor.services.config.runtime_settings import RuntimeSettingsService; print('✅ RuntimeSettingsService imports OK')"
|
||||
python -c "from deeptutor.api.routers.unified_ws import unified_websocket; print('✅ Unified WS imports OK')"
|
||||
python -c "from deeptutor.services.prompt.manager import PromptManager; print('✅ Prompt manager imports OK')"
|
||||
python -c "from deeptutor.logging import configure_logging, bind_log_context, capture_process_logs, ProcessLogEvent; print('✅ Logging imports OK')"
|
||||
env:
|
||||
PYTHONPATH: ${{ github.workspace }}
|
||||
|
||||
python-tests:
|
||||
name: Python Tests (Python ${{ matrix.python-version }})
|
||||
runs-on: ubuntu-latest
|
||||
needs: import-check
|
||||
continue-on-error: ${{ matrix.experimental == true }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
python-version: ["3.11", "3.12", "3.13"]
|
||||
experimental: [false]
|
||||
include:
|
||||
- python-version: "3.14"
|
||||
experimental: true
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
||||
- name: Cache pip packages
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.cache/pip
|
||||
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('requirements/server.txt', 'requirements/cli.txt', 'requirements/partners.txt') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-${{ matrix.python-version }}-
|
||||
|
||||
- name: Install smoke test dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install -r requirements/server.txt
|
||||
pip install -r requirements/partners.txt
|
||||
pip install pytest pytest-asyncio
|
||||
|
||||
- name: Create minimal runtime config
|
||||
run: |
|
||||
mkdir -p data/user/settings
|
||||
cat > data/user/settings/main.yaml <<'YAML'
|
||||
system:
|
||||
language: en
|
||||
logging:
|
||||
level: WARNING
|
||||
YAML
|
||||
|
||||
- name: Run Python tests
|
||||
run: |
|
||||
echo "🧪 Running Python tests on Python ${{ matrix.python-version }}"
|
||||
pytest -q tests deeptutor/learning/tests
|
||||
env:
|
||||
PYTHONPATH: ${{ github.workspace }}
|
||||
|
||||
test-summary:
|
||||
name: Test Summary
|
||||
runs-on: ubuntu-latest
|
||||
needs: [lint, web-tests, import-check, python-tests]
|
||||
if: always()
|
||||
|
||||
steps:
|
||||
- name: Check test results
|
||||
run: |
|
||||
echo "## 🧪 Test Results Summary" >> $GITHUB_STEP_SUMMARY
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
echo "| Check | Status |" >> $GITHUB_STEP_SUMMARY
|
||||
echo "|-------|--------|" >> $GITHUB_STEP_SUMMARY
|
||||
echo "| Lint and format | ${{ needs.lint.result == 'success' && '✅ Passed' || '❌ Failed' }} |" >> $GITHUB_STEP_SUMMARY
|
||||
echo "| Web node tests | ${{ needs.web-tests.result == 'success' && '✅ Passed' || '❌ Failed' }} |" >> $GITHUB_STEP_SUMMARY
|
||||
echo "| Import check (3.11/3.12/3.13; 3.14 best-effort) | ${{ needs.import-check.result == 'success' && '✅ Passed' || '❌ Failed' }} |" >> $GITHUB_STEP_SUMMARY
|
||||
echo "| Python tests (3.11/3.12/3.13; 3.14 best-effort) | ${{ needs.python-tests.result == 'success' && '✅ Passed' || '❌ Failed' }} |" >> $GITHUB_STEP_SUMMARY
|
||||
|
||||
- name: Fail if tests failed
|
||||
if: needs.lint.result == 'failure' || needs.web-tests.result == 'failure' || needs.import-check.result == 'failure' || needs.python-tests.result == 'failure'
|
||||
run: exit 1
|
||||
Reference in New Issue
Block a user