mirror of
https://github.com/openmlsys/openmlsys-zh.git
synced 2026-04-25 11:02:36 +08:00
ci: use peaceiris action for mdbook
Replace manual mdBook installation in CI and Pages workflows with peaceiris/actions-mdbook@v2 and keep a regression test to ensure the action stays in use.
This commit is contained in:
@@ -6,6 +6,7 @@ from pathlib import Path
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parents[1]
|
||||
WORKFLOW_PATH = REPO_ROOT / ".github" / "workflows" / "update_docs.yml"
|
||||
CI_WORKFLOW_PATH = REPO_ROOT / ".github" / "workflows" / "main.yml"
|
||||
|
||||
|
||||
class UpdateDocsWorkflowTests(unittest.TestCase):
|
||||
@@ -19,6 +20,13 @@ class UpdateDocsWorkflowTests(unittest.TestCase):
|
||||
self.assertIn("${{ steps.pages.outputs.base_url }}", workflow)
|
||||
self.assertNotIn("git clone https://x-access-token:${DEPLOY_TOKEN}", workflow)
|
||||
|
||||
def test_workflows_use_peaceiris_mdbook_action(self) -> None:
|
||||
for workflow_path in (WORKFLOW_PATH, CI_WORKFLOW_PATH):
|
||||
workflow = workflow_path.read_text(encoding="utf-8")
|
||||
self.assertIn("uses: peaceiris/actions-mdbook@v2", workflow, workflow_path.as_posix())
|
||||
self.assertIn("mdbook-version: 'latest'", workflow, workflow_path.as_posix())
|
||||
self.assertNotIn("cargo install mdbook --locked", workflow, workflow_path.as_posix())
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user