Repository navigation
ci: run the existing Python tests and CLI smoke checks #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,79 @@ | ||||||
| name: CI | ||||||
|
|
||||||
| # Nothing ran these tests before. The repo ships seven test modules (101 tests | ||||||
| # collected; six at the repository root plus one under | ||||||
| # adapters/agent-plugins-multica/), and README.md:192 documents the project's | ||||||
| # own pre-commit norm: | ||||||
| # | ||||||
| # "提交改动前运行完整 Python 测试、CLI help smoke test 和地址静态搜索。" | ||||||
| # | ||||||
| # Nothing under .github enforced any of it. This workflow covers the first two | ||||||
| # clauses -- the full Python test suite and the CLI help smoke test. It does | ||||||
| # NOT run the third (地址静态搜索, the static address search), so a green run | ||||||
| # here is not evidence that the whole documented norm was satisfied. | ||||||
|
|
||||||
| on: | ||||||
| push: | ||||||
| branches: [main] | ||||||
| pull_request: | ||||||
| branches: [main] | ||||||
| workflow_dispatch: | ||||||
|
|
||||||
| permissions: | ||||||
| contents: read | ||||||
|
|
||||||
| concurrency: | ||||||
| group: ci-${{ github.ref }} | ||||||
| cancel-in-progress: true | ||||||
|
|
||||||
| jobs: | ||||||
| test: | ||||||
| name: Python tests | ||||||
| runs-on: ${{ matrix.os }} | ||||||
| strategy: | ||||||
| fail-fast: false | ||||||
| matrix: | ||||||
| # README.md:31 and :228 declare "Python 3.9+"; the newer entry is what | ||||||
| # the project is actually developed on. | ||||||
| os: [ubuntu-latest, windows-latest] | ||||||
| python-version: ["3.9", "3.13"] | ||||||
| exclude: | ||||||
| # The suite uses only stdlib and local modules, so the OS axis adds | ||||||
| # little beyond a path-separator check; keep the full Python axis. | ||||||
| - os: windows-latest | ||||||
| python-version: "3.9" | ||||||
| steps: | ||||||
| - uses: actions/checkout@v4 | ||||||
|
|
||||||
| - uses: actions/setup-python@v5 | ||||||
| with: | ||||||
| python-version: ${{ matrix.python-version }} | ||||||
|
|
||||||
| - name: Show interpreter | ||||||
| run: python --version | ||||||
|
|
||||||
| - name: Install pytest | ||||||
| run: python -m pip install --disable-pip-version-check pytest | ||||||
|
|
||||||
| # The suite is unittest-based and imports only stdlib plus sibling | ||||||
| # modules, so it runs from the repository root with no install step. | ||||||
| - name: Run tests | ||||||
| run: python -m pytest -q --no-header | ||||||
|
|
||||||
| cli-smoke: | ||||||
| name: CLI help smoke | ||||||
| runs-on: ubuntu-latest | ||||||
| steps: | ||||||
| - uses: actions/checkout@v4 | ||||||
|
|
||||||
| - uses: actions/setup-python@v5 | ||||||
| with: | ||||||
| python-version: "3.13" | ||||||
|
|
||||||
| # README.md:192 names the CLI help smoke test alongside the Python tests. | ||||||
| # --help must exit 0 without touching a deployment target. | ||||||
| - name: multica_deploy --help | ||||||
| run: python multica_deploy.py --help | ||||||
|
|
||||||
| - name: fleet_plan --help | ||||||
| run: python fleet_plan.py --help | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Useful? React with 👍 / 👎. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win 🔎 Supported by static analysis🏁 Script executed: #!/bin/bash
# Inspect the CLI dispatch and documented invocation without executing repository code.
tail -n 55 fleet_plan.py
rg -n -C 3 '__main__|ArgumentParser|sys\.argv|run_plan\(' fleet_plan.py
rg -n -C 2 'fleet_plan(\.py)?|run_plan' README.mdRepository: 2233admin/multica-deployment-tool Length of output: 2318 🏁 Script executed: set -e
printf '%s\n' '--- workflow ---'
nl -ba .github/workflows/ci.yml | sed -n '55,80p'
printf '%s\n' '--- README fleet-plan references ---'
rg -n -C 4 -F -e 'fleet_plan.py' -e 'fleet plan' -e 'run_plan' README.md || test "$?" -eq 1
printf '%s\n' '--- fleet-plan entrypoint and tests ---'
rg -n -C 4 -F -e 'run_plan(' -e 'fleet_plan.py' -e 'fleet_plan' --glob '*.py' --glob 'test*' . || test "$?" -eq 1
printf '%s\n' '--- fleet_plan.py final declaration ---'
nl -ba fleet_plan.py | sed -n '460,510p'Repository: 2233admin/multica-deployment-tool Length of output: 21707 Invoke the fleet-plan CLI through its supported entrypoint.
🐛 Suggested fix--- "a/.github/workflows/ci.yml"
+++ "b/.github/workflows/ci.yml"
@@ -70,4 +70,4 @@
run: python multica_deploy.py --help
- name: fleet_plan --help
- run: python fleet_plan.py --help
+ run: python multica_deploy.py fleet plan --help📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔒 Security & Privacy | 🛡️ Detected with Advanced Tier | 🟡 Minor | ⚡ Quick win
Sensitive Data Exposure
Reachability: External
Exploitability: Moderate
CWE: CWE-522 — Insufficiently Protected Credentials
View Security blast radius
Disable checkout credential persistence in both jobs.
The workflow executes checked-out code after
actions/checkout@v4. By default, checkout stores the GitHub token in local Git configuration, which the executed code can read.contents: readlimits the token scope but does not prevent disclosure.Disable credential persistence
Apply this change to both checkout steps.
📝 Committable suggestion
🧰 Tools
🪛 zizmor (1.30.1)
[warning] 40-40: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false
(artipacked)
🤖 Prompt for AI Agents
Sources: Learnings, Linters/SAST tools