🔧 chore(ci): merge superpowers update and sync workflow
This commit is contained in:
@@ -2,35 +2,19 @@ import unittest
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
SYNC_WORKFLOW = ROOT / ".gitea" / "workflows" / "sync-superpowers.yml"
|
||||
LEGACY_SYNC_WORKFLOW = ROOT / ".gitea" / "workflows" / "sync-superpowers.yml"
|
||||
AUTO_UPDATE_WORKFLOW = ROOT / ".gitea" / "workflows" / "update-thirdparty-superpowers.yml"
|
||||
AUTO_UPDATE_SCRIPT = ROOT / ".gitea" / "ci" / "update_thirdparty_superpowers.sh"
|
||||
SYNC_SCRIPT = ROOT / ".gitea" / "ci" / "sync_superpowers.sh"
|
||||
|
||||
|
||||
class SuperpowersWorkflowTests(unittest.TestCase):
|
||||
def test_sync_workflow_uses_manual_trigger(self):
|
||||
text = SYNC_WORKFLOW.read_text(encoding="utf-8")
|
||||
self.assertIn("workflow_dispatch:", text)
|
||||
def test_legacy_sync_workflow_is_removed(self):
|
||||
self.assertFalse(LEGACY_SYNC_WORKFLOW.exists())
|
||||
|
||||
def test_sync_workflow_triggers_on_thirdparty_push(self):
|
||||
text = SYNC_WORKFLOW.read_text(encoding="utf-8")
|
||||
self.assertIn("push:", text)
|
||||
self.assertIn("- thirdparty/skill", text)
|
||||
|
||||
def test_sync_workflow_clears_stale_index_flags(self):
|
||||
text = SYNC_WORKFLOW.read_text(encoding="utf-8")
|
||||
self.assertIn("git update-index --no-assume-unchanged", text)
|
||||
self.assertIn("--no-skip-worktree", text)
|
||||
|
||||
def test_sync_workflow_runs_from_latest_main(self):
|
||||
text = SYNC_WORKFLOW.read_text(encoding="utf-8")
|
||||
self.assertIn('TARGET_BRANCH: "main"', text)
|
||||
self.assertIn('git fetch origin "${{ env.TARGET_BRANCH }}"', text)
|
||||
self.assertIn(
|
||||
'git checkout -B "${{ env.TARGET_BRANCH }}" "origin/${{ env.TARGET_BRANCH }}"',
|
||||
text,
|
||||
)
|
||||
def test_auto_update_workflow_name_describes_full_pipeline(self):
|
||||
text = AUTO_UPDATE_WORKFLOW.read_text(encoding="utf-8")
|
||||
self.assertIn("name: Update and Sync Superpowers", text)
|
||||
|
||||
def test_auto_update_workflow_triggers_on_main_push(self):
|
||||
text = AUTO_UPDATE_WORKFLOW.read_text(encoding="utf-8")
|
||||
@@ -47,6 +31,24 @@ class SuperpowersWorkflowTests(unittest.TestCase):
|
||||
text = AUTO_UPDATE_WORKFLOW.read_text(encoding="utf-8")
|
||||
self.assertIn("bash .gitea/ci/update_thirdparty_superpowers.sh", text)
|
||||
|
||||
def test_auto_update_workflow_runs_sync_after_update(self):
|
||||
text = AUTO_UPDATE_WORKFLOW.read_text(encoding="utf-8")
|
||||
self.assertIn("update:", text)
|
||||
self.assertIn("sync:", text)
|
||||
self.assertIn("needs: update", text)
|
||||
self.assertIn("bash .gitea/ci/sync_superpowers.sh", text)
|
||||
|
||||
def test_auto_update_workflow_sync_job_clears_stale_index_flags(self):
|
||||
text = AUTO_UPDATE_WORKFLOW.read_text(encoding="utf-8")
|
||||
self.assertIn("git update-index --no-assume-unchanged", text)
|
||||
self.assertIn("--no-skip-worktree", text)
|
||||
|
||||
def test_auto_update_workflow_sync_job_runs_from_latest_main(self):
|
||||
text = AUTO_UPDATE_WORKFLOW.read_text(encoding="utf-8")
|
||||
self.assertIn('TARGET_BRANCH: "main"', text)
|
||||
self.assertIn('git fetch origin "$TARGET_BRANCH"', text)
|
||||
self.assertIn('git checkout -B "$TARGET_BRANCH" "origin/$TARGET_BRANCH"', text)
|
||||
|
||||
def test_auto_update_script_targets_thirdparty_branch(self):
|
||||
text = AUTO_UPDATE_SCRIPT.read_text(encoding="utf-8")
|
||||
self.assertIn('TARGET_BRANCH="${TARGET_BRANCH:-thirdparty/skill}"', text)
|
||||
|
||||
Reference in New Issue
Block a user