🐛 fix(ci): restore workflow-run commit verification
This commit is contained in:
+6
-4
@@ -34,13 +34,15 @@ python test/integration/check_doc_links.py
|
||||
|
||||
## 🧭 CI 自动化测试
|
||||
|
||||
测试套件通过 Gitea Actions 自动运行(见 `.gitea/workflows/checks.yml` 的 `tests` job):
|
||||
测试套件通过 Gitea Actions 自动运行(见 `.gitea/workflows/checks.yml` 的
|
||||
`🔎 规范检查 + 全量测试` job):
|
||||
|
||||
- **触发方式**:`workflow_run`——「🧰 准备环境」(`prepare.yml`)完成后触发。
|
||||
Prepare 监听 `push:main`、`pull_request`、`workflow_dispatch` 与每日 `schedule`,
|
||||
故推送到 main、对 main 开 PR 或手动运行 Prepare 都会经 Prepare 传导到测试。
|
||||
Prepare 监听 `push:main`、`pull_request` 与 `workflow_dispatch`;推送到 main、
|
||||
对 main 开 PR 或手动运行 Prepare 都会经 Prepare 传导到测试。每日 `schedule`
|
||||
只属于 thirdparty updater,不会触发这套提交验证。
|
||||
- **运行平台**:standard-ubuntu-22
|
||||
- **注**:`checks.yml` 同时包含 commit message 规范校验(`standards` job)。
|
||||
- **注**:同一 job 先校验 commit message,再运行全量测试。
|
||||
|
||||
## 📚 测试详解
|
||||
|
||||
|
||||
@@ -228,44 +228,36 @@ class ThirdpartySkillsPipelineTests(unittest.TestCase):
|
||||
self.assertIn("update_thirdparty_snapshots", text)
|
||||
self.assertIn("sync_thirdparty_skills", text)
|
||||
|
||||
def test_scheduled_prepare_calls_updater_without_an_independent_entry(self):
|
||||
def test_schedule_runs_updater_without_changing_prepare_run_shape(self):
|
||||
prepare_text = PREPARE_WORKFLOW.read_text(encoding="utf-8")
|
||||
updater_text = WORKFLOW.read_text(encoding="utf-8")
|
||||
|
||||
self.assertEqual(workflow_mapping_keys(prepare_text, "jobs"), ["prepare"])
|
||||
self.assertEqual(
|
||||
workflow_mapping_keys(prepare_text, "jobs"),
|
||||
["prepare", "update_thirdparty_scheduled"],
|
||||
workflow_mapping_keys(prepare_text, "on"),
|
||||
["push", "pull_request", "workflow_dispatch"],
|
||||
)
|
||||
self.assertEqual(
|
||||
workflow_mapping_keys(updater_text, "on"),
|
||||
["workflow_call", "workflow_run"],
|
||||
["schedule", "workflow_run"],
|
||||
)
|
||||
self.assertIn(" needs: prepare", prepare_text)
|
||||
self.assertIn(" if: ${{ github.event_name == 'schedule' }}", prepare_text)
|
||||
self.assertIn(
|
||||
" uses: ./.gitea/workflows/update-thirdparty-skills.yml",
|
||||
prepare_text,
|
||||
)
|
||||
self.assertIn(" source_branch: ${{ github.ref_name }}", prepare_text)
|
||||
self.assertIn(" source_sha: ${{ github.sha }}", prepare_text)
|
||||
self.assertIn(" WORKFLOW: ${{ secrets.WORKFLOW }}", prepare_text)
|
||||
self.assertIn(" workflow_call:", updater_text)
|
||||
self.assertIn(" source_branch:", updater_text)
|
||||
self.assertIn(" source_sha:", updater_text)
|
||||
self.assertIn(" WORKFLOW:", updater_text)
|
||||
self.assertIn(" required: true", updater_text)
|
||||
self.assertIn(
|
||||
"SOURCE_BRANCH: ${{ inputs.source_branch || "
|
||||
"github.event.workflow_run.head_branch }}",
|
||||
updater_text,
|
||||
)
|
||||
self.assertIn(
|
||||
"SOURCE_SHA: ${{ inputs.source_sha || "
|
||||
"github.event.workflow_run.head_sha }}",
|
||||
updater_text,
|
||||
)
|
||||
self.assertIn("github.event_name == 'workflow_call' ||", updater_text)
|
||||
self.assertIn("github.event.workflow_run.event != 'schedule'", updater_text)
|
||||
self.assertNotIn("update_thirdparty_scheduled", prepare_text)
|
||||
self.assertNotIn("uses: ./.gitea/workflows/", prepare_text)
|
||||
self.assertNotIn(" schedule:", prepare_text)
|
||||
self.assertNotIn(" workflow_call:", updater_text)
|
||||
self.assertIn(' - cron: "0 22 * * *"', updater_text)
|
||||
self.assertIn("github.event_name == 'schedule' ||", updater_text)
|
||||
self.assertNotIn("github.event.workflow_run.event != 'schedule'", updater_text)
|
||||
self.assertIn('SOURCE_BRANCH="$GITHUB_REF_NAME"', updater_text)
|
||||
self.assertIn('SOURCE_SHA="$GITHUB_SHA"', updater_text)
|
||||
self.assertIn('SOURCE_BRANCH="${{ github.event.workflow_run.head_branch }}"', updater_text)
|
||||
self.assertIn('SOURCE_SHA="${{ github.event.workflow_run.head_sha }}"', updater_text)
|
||||
self.assertIn('echo "SOURCE_BRANCH=$SOURCE_BRANCH" >> "$GITHUB_ENV"', updater_text)
|
||||
self.assertIn('echo "SOURCE_SHA=$SOURCE_SHA" >> "$GITHUB_ENV"', updater_text)
|
||||
self.assertIn('HEAD_SHA="$SOURCE_SHA"', updater_text)
|
||||
self.assertIn('checkout --detach --force "${SOURCE_SHA:-}"', updater_text)
|
||||
self.assertIn('git init --bare "$REPOSITORY_DIR"', updater_text)
|
||||
self.assertIn("'+refs/heads/*:refs/remotes/origin/*'", updater_text)
|
||||
|
||||
def test_inline_workflow_exposes_manifest_and_publish_contract(self):
|
||||
text = WORKFLOW.read_text(encoding="utf-8")
|
||||
|
||||
Reference in New Issue
Block a user