test: add entrypoint coverage

This commit is contained in:
2026-05-15 04:59:44 +00:00
parent 20d5ad698a
commit 8744ffbe0c
3 changed files with 496 additions and 28 deletions
+8 -28
View File
@@ -60,35 +60,15 @@ jobs:
- Action 定義: [`action.yaml`](action.yaml)
- 執行腳本: [`entrypoint.sh`](entrypoint.sh)
- 測試腳本: [`tests/entrypoint.sh`](tests/entrypoint.sh)
- CI workflow: [`.gitea/workflows/ci.yaml`](.gitea/workflows/ci.yaml)
## 專案範圍
## 測試
- 不需要新增 `.gitea/workflows/ci.yaml`
- 不需要新增 `tests/*`
- 除非另外明確要求,請不要再補這兩類檔案
直接執行:
## Review Exclusions
```bash
bash tests/entrypoint.sh
```
以下審查意見屬於刻意排除,不再以測試或 CI 的形式處理:
- `entrypoint.sh:10-15` `trim`
- `entrypoint.sh:16-18` `url_encode`
- `entrypoint.sh:30-59` `resolve_package_names`
- `entrypoint.sh:61-76` `parse_repo_context`
- `entrypoint.sh:35-51` `resolve_keep_count`
- `entrypoint.sh:78-120` `api_request`
- `entrypoint.sh:122-181` `fetch_package_versions`
- `entrypoint.sh:183-241` `collect_package_candidates`
- `entrypoint.sh:243-286` `process_candidates`
- `entrypoint.sh:290-332` `main` 整合 / E2E 測試
- `entrypoint.sh(整體)` 新增測試程式碼與測試框架
- `entrypoint.sh(整體)` 端對端測試
- `entrypoint.sh:78-120` `api_request` mock 測試
- `entrypoint.sh:7` 結構化 logging
- `entrypoint.sh:105` 驗證 `GITEA_SERVER_URL`
- `entrypoint.sh:125-126,241` 暫存檔重用與 I/O 微調
- `entrypoint.sh:149` 流式 JSON 合併
- `entrypoint.sh:204,215` 排序與日誌分離建議
- `entrypoint.sh:166-167,310-311` `url_encode` 熱路徑最佳化
- `entrypoint.sh:183-241` 改回掃描 owner 全量套件的 N+1 API 建議
- `entrypoint.sh:7-12` token 不使用 `export` 的安全偏好
Gitea CI 也會在 push 與 pull request 時執行同一支腳本。