Repository navigation
docs: 完善 PyPI 安装与发布文档 #17
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ci-${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| test: | |
| timeout-minutes: 20 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| python-version: ["3.10", "3.13"] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| - uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: 安装项目 | |
| run: python -m pip install . | |
| - name: 编译检查 | |
| run: python -m compileall -q src tests | |
| - name: 运行测试 | |
| run: python -m unittest discover -s tests -v | |
| - name: 校验 Skill 分发副本 | |
| run: python scripts/sync_session_handoff_skill.py --check | |
| - name: 依赖一致性检查 | |
| run: python -m pip check | |
| package: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| - uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0 | |
| with: | |
| python-version: "3.13" | |
| - name: 安装发布校验工具 | |
| run: python -m pip install build twine | |
| - name: 构建 Wheel 与源码包 | |
| run: python -m build | |
| - name: 校验分发元数据 | |
| run: python -m twine check dist/* | |
| - name: 校验源码包内容 | |
| run: | | |
| python - <<'PY' | |
| import glob | |
| import tarfile | |
| archive = glob.glob("dist/*.tar.gz")[0] | |
| with tarfile.open(archive, "r:gz") as stream: | |
| names = stream.getnames() | |
| required_suffixes = { | |
| "CHANGELOG.md", | |
| "CODE_OF_CONDUCT.md", | |
| "CONTRIBUTING.md", | |
| "LICENSE", | |
| "README.en.md", | |
| "SECURITY.md", | |
| "SUPPORT.md", | |
| "docs/RELEASING.md", | |
| "docs/ROADMAP.md", | |
| "docs/decisions/ADR-010-machine-readable-operations-and-history.md", | |
| "docs/decisions/ADR-011-single-hmem-entry.md", | |
| "docs/decisions/ADR-012-mit-license.md", | |
| "examples/ACTIVE.example.md", | |
| "scripts/sync_session_handoff_skill.py", | |
| "skills/session-handoff/SKILL.md", | |
| } | |
| missing = { | |
| suffix | |
| for suffix in required_suffixes | |
| if not any(name.endswith(suffix) for name in names) | |
| } | |
| assert not missing, missing | |
| PY | |
| - name: 验证 Wheel 安装及入口 | |
| run: | | |
| python -m pip install dist/*.whl | |
| python - <<'PY' | |
| from importlib.metadata import distribution | |
| scripts = { | |
| entry.name: entry.value | |
| for entry in distribution("handoff-memory").entry_points | |
| if entry.group == "console_scripts" | |
| } | |
| expected = { | |
| "hmem": "handoff_memory.cli:main", | |
| } | |
| assert scripts == expected, scripts | |
| PY | |
| hmem --version | |
| hmem help init | grep -- "--select-tools" | |
| if command -v handoff-memory >/dev/null 2>&1; then | |
| echo "不应安装旧的 handoff-memory 命令" >&2 | |
| exit 1 | |
| fi | |
| - name: 验证安装后的跨项目流程 | |
| run: | | |
| project="${RUNNER_TEMP}/handoff-smoke" | |
| hmem init "$project" --name "Wheel Smoke" --integrate codex | |
| test ! -e "$project/AGENTS.md" | |
| test -f "$project/.agents/skills/session-handoff/SKILL.md" | |
| hmem integrate codex "$project" --with-rules | |
| test -f "$project/AGENTS.md" | |
| interactive_project="${RUNNER_TEMP}/handoff-interactive" | |
| printf 'all\n' | hmem init "$interactive_project" --select-tools | |
| test -f "$interactive_project/.agents/skills/session-handoff/SKILL.md" | |
| test ! -e "$interactive_project/.agents/rules/handoff-memory.md" | |
| test ! -e "$interactive_project/.github/copilot-instructions.md" | |
| test -f "$interactive_project/.github/skills/session-handoff/SKILL.md" | |
| hmem integrate all "$interactive_project" --with-rules | |
| test -f "$interactive_project/.agents/rules/handoff-memory.md" | |
| test -f "$interactive_project/.github/copilot-instructions.md" | |
| test -f "$interactive_project/.trae/rules/project_rules.md" | |
| test -f "$interactive_project/.trae/skills/session-handoff/SKILL.md" | |
| test -f "$interactive_project/.qoder/rules/handoff-memory.md" | |
| test -f "$interactive_project/.qoder/skills/session-handoff/SKILL.md" | |
| test -f "$interactive_project/.opencode/skills/session-handoff/SKILL.md" | |
| cp examples/ACTIVE.example.md "$project/.ai-memory/ACTIVE.md" | |
| hmem check "$project" --strict --format json | |
| hmem save "$project" --format json | |
| hmem resume "$project" --format json | |
| hmem history "$project" --format json | |
| hmem show latest "$project" --format json | |
| - name: 保存发布构建产物 | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: handoff-memory-dist | |
| path: dist/* | |
| if-no-files-found: error | |
| svn-integration: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| - uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0 | |
| with: | |
| python-version: "3.13" | |
| - name: 安装 Subversion | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y subversion | |
| - name: 安装项目 | |
| run: python -m pip install . | |
| - name: 运行 Git/SVN 版本库集成测试 | |
| run: python -m unittest tests.test_repository_state -v |