name: CI on: push: branches: [main, master] pull_request: workflow_dispatch: jobs: test: name: ${{ matrix.os }} / py${{ matrix.python-version }} runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: os: [ubuntu-latest, windows-latest] # 3.8 已 EOL(2024-10),这里从声明的最低版本 3.8 开始测, # 以验证 pyproject 的 requires-python 不是空话。 python-version: ["3.8", "3.10", "3.12"] steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Show Python version run: python --version - name: Compile check run: python -m py_compile scripts/bili_note.py scripts/install.py bili_note_cli/cli.py # 刻意不装任何运行时第三方包:本工具只用标准库,装上反而掩盖了意外依赖。 - name: Run offline test suite run: python -m unittest discover -s tests -v env: PYTHONIOENCODING: utf-8 - name: Entry-point smoke test (no install) run: | python -m bili_note_cli.cli --version python -m bili_note_cli.cli --help env: PYTHONIOENCODING: utf-8 - name: Skill script smoke test run: | python scripts/bili_note.py --version python scripts/bili_note.py --help - name: Install script dry run run: python scripts/install.py --dry-run env: PYTHONIOENCODING: utf-8 package: name: package install (${{ matrix.os }}) runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: os: [ubuntu-latest, windows-latest] steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: "3.12" # 真正装一遍:验证 pyproject 的 package-dir 映射确实把 scripts/bili_note.py # 装成了顶层模块 bili_note,并且 console script 能起来。 # 单测只能覆盖"仓库内直接跑",装不上是只有这条路径才暴露的问题。 - name: pip install . run: python -m pip install --disable-pip-version-check . - name: Console script works run: | bili-note --version bili-note --help - name: Installed module is importable and matches the repo copy run: | python -c "import bili_note, pathlib, sys; print('module:', pathlib.Path(bili_note.__file__).resolve()); print('version:', bili_note.__version__)" - name: Installed CLI can plan a run (no network) run: bili-note note --help env: PYTHONIOENCODING: utf-8