@@ -79,6 +79,38 @@ def bump_version_files(tag):
7979 out .writelines (new_lines )
8080 print (f"Updated { path } : { pretty_key } ={ tag } , version bumped by 1" )
8181
82+ def trigger_and_wait_cache_build ():
83+ """Trigger a new build-cache CI run and wait for it to complete."""
84+ import time
85+ print ("Triggering build-cache CI run..." )
86+ r = subprocess .run (
87+ ["gh" , "workflow" , "run" , "build-cache.yml" , "--repo" , repo ],
88+ capture_output = True , text = True
89+ )
90+ if r .returncode != 0 :
91+ print (f" WARNING: Could not trigger build-cache: { r .stderr .strip ()} " )
92+ return None
93+ time .sleep (5 ) # wait for run to register
94+ r2 = subprocess .run (
95+ ["gh" , "run" , "list" , "--repo" , repo , "--workflow" , "build-cache.yml" ,
96+ "--limit" , "1" , "--json" , "databaseId,status" ],
97+ capture_output = True , text = True
98+ )
99+ if r2 .returncode != 0 : return None
100+ run_id = json .loads (r2 .stdout )[0 ]["databaseId" ]
101+ print (f" Waiting for run { run_id } to complete..." )
102+ while True :
103+ r3 = subprocess .run (
104+ ["gh" , "run" , "view" , str (run_id ), "--repo" , repo , "--json" , "status,conclusion" ],
105+ capture_output = True , text = True
106+ )
107+ data = json .loads (r3 .stdout )
108+ if data ["status" ] == "completed" :
109+ print (f" Run { run_id } completed with: { data ['conclusion' ]} " )
110+ return run_id if data ["conclusion" ] == "success" else None
111+ print (f" Status: { data ['status' ]} ... waiting 15s" )
112+ time .sleep (15 )
113+
82114def download_cache_artifacts ():
83115 """Download precompiled .o files from latest successful build-cache CI run."""
84116 import subprocess , json
0 commit comments