Skip to content

Commit 4dd8f57

Browse files
authored
Align bridge updater schedule and wait for CI
Align the web bridge llama.cpp updater schedule with llamadart-native and make the updater wait for the dispatched CI run before reporting success.
1 parent 9c57382 commit 4dd8f57

1 file changed

Lines changed: 67 additions & 16 deletions

File tree

.github/workflows/auto_llama_cpp_update.yml

Lines changed: 67 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ name: Auto-update llama.cpp Pin
22

33
on:
44
schedule:
5-
# Weekday morning UTC, after upstream llama.cpp usually publishes release tags.
6-
- cron: '17 10 * * 1-5'
5+
# Daily UTC, aligned with llamadart-native auto_native_release.yml.
6+
- cron: '23 3 * * *'
77
workflow_dispatch:
88

99
permissions:
@@ -13,7 +13,7 @@ permissions:
1313

1414
concurrency:
1515
group: llama-cpp-auto-update
16-
cancel-in-progress: true
16+
cancel-in-progress: false
1717

1818
env:
1919
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
@@ -42,40 +42,48 @@ jobs:
4242
exit 1
4343
fi
4444
45-
LATEST_TAG="$(gh release list --repo ggml-org/llama.cpp --limit 1 --json tagName --jq '.[0].tagName')"
45+
LATEST_TAG="$(gh release list --repo ggml-org/llama.cpp --limit 1 --json tagName --jq ".[0].tagName")"
4646
if [ -z "$LATEST_TAG" ] || [ "$LATEST_TAG" = "null" ]; then
4747
echo "error: could not resolve latest ggml-org/llama.cpp release tag"
4848
exit 1
4949
fi
5050
51-
echo "current_tag=$CURRENT_TAG" >> "$GITHUB_OUTPUT"
52-
echo "latest_tag=$LATEST_TAG" >> "$GITHUB_OUTPUT"
51+
{
52+
echo "current_tag=$CURRENT_TAG"
53+
echo "latest_tag=$LATEST_TAG"
54+
} >> "$GITHUB_OUTPUT"
5355
5456
if [ "$CURRENT_TAG" = "$LATEST_TAG" ]; then
55-
echo "update_needed=false" >> "$GITHUB_OUTPUT"
56-
echo "skip_reason=$VERSION_FILE already points at $LATEST_TAG" >> "$GITHUB_OUTPUT"
57+
{
58+
echo "update_needed=false"
59+
echo "skip_reason=$VERSION_FILE already points at $LATEST_TAG"
60+
} >> "$GITHUB_OUTPUT"
5761
exit 0
5862
fi
5963
6064
for pr in $(gh pr list --repo "$GITHUB_REPOSITORY" --state open --json number,headRefName --jq ".[] | select(.headRefName != \"$UPDATE_BRANCH\") | .number"); do
6165
if gh pr diff "$pr" --repo "$GITHUB_REPOSITORY" --name-only | grep -qx "$VERSION_FILE"; then
62-
echo "update_needed=false" >> "$GITHUB_OUTPUT"
63-
echo "skip_reason=PR #$pr already changes $VERSION_FILE; not racing a non-automation PR" >> "$GITHUB_OUTPUT"
66+
{
67+
echo "update_needed=false"
68+
echo "skip_reason=PR #$pr already changes $VERSION_FILE; not racing a non-automation PR"
69+
} >> "$GITHUB_OUTPUT"
6470
exit 0
6571
fi
6672
done
6773
6874
printf '%s\n' "$LATEST_TAG" > "$VERSION_FILE"
6975
70-
RELEASE_URL="$(gh release view "$LATEST_TAG" --repo ggml-org/llama.cpp --json url --jq '.url')"
76+
RELEASE_URL="$(gh release view "$LATEST_TAG" --repo ggml-org/llama.cpp --json url --jq ".url")"
7177
COMPARE_URL="https://github.com/ggml-org/llama.cpp/compare/${CURRENT_TAG}...${LATEST_TAG}"
72-
echo "release_url=$RELEASE_URL" >> "$GITHUB_OUTPUT"
73-
echo "compare_url=$COMPARE_URL" >> "$GITHUB_OUTPUT"
74-
echo "update_needed=true" >> "$GITHUB_OUTPUT"
78+
{
79+
echo "release_url=$RELEASE_URL"
80+
echo "compare_url=$COMPARE_URL"
81+
echo "update_needed=true"
82+
} >> "$GITHUB_OUTPUT"
7583
76-
gh release view "$LATEST_TAG" --repo ggml-org/llama.cpp --json body --jq '.body // ""' > /tmp/llama_cpp_release_notes.md
84+
gh release view "$LATEST_TAG" --repo ggml-org/llama.cpp --json body --jq ".body // \"\"" > /tmp/llama_cpp_release_notes.md
7785
gh api "repos/ggml-org/llama.cpp/compare/${CURRENT_TAG}...${LATEST_TAG}" \
78-
--jq '.commits[:80][] | "- " + (.commit.message | split("\n")[0]) + " (`" + (.sha[0:7]) + "`)"' \
86+
--jq ".commits[:80][] | \"- \" + (.commit.message | split(\"\\n\")[0]) + \" (\`\" + (.sha[0:7]) + \"\`)\"" \
7987
> /tmp/llama_cpp_commits.md || true
8088
8189
{
@@ -170,3 +178,46 @@ jobs:
170178
sleep $((attempt * 5))
171179
done
172180
echo "Dispatched CI for #${{ steps.create-pr.outputs.pull-request-number }} on $UPDATE_BRANCH."
181+
182+
- name: Wait for automation PR CI
183+
if: steps.create-pr.outputs.pull-request-number != ''
184+
timeout-minutes: 45
185+
env:
186+
GH_TOKEN: ${{ github.token }}
187+
PR_NUMBER: ${{ steps.create-pr.outputs.pull-request-number }}
188+
PR_HEAD_SHA: ${{ steps.create-pr.outputs.pull-request-head-sha }}
189+
run: |
190+
set -euo pipefail
191+
192+
if [ -z "$PR_HEAD_SHA" ] || [ "$PR_HEAD_SHA" = "null" ]; then
193+
PR_HEAD_SHA="$(gh pr view "$PR_NUMBER" --repo "$GITHUB_REPOSITORY" --json headRefOid --jq ".headRefOid")"
194+
fi
195+
if [ -z "$PR_HEAD_SHA" ] || [ "$PR_HEAD_SHA" = "null" ]; then
196+
echo "error: could not resolve head SHA for automation PR #$PR_NUMBER"
197+
exit 1
198+
fi
199+
200+
run_id=""
201+
for attempt in $(seq 1 30); do
202+
run_id="$(gh run list \
203+
--repo "$GITHUB_REPOSITORY" \
204+
--workflow ci.yml \
205+
--branch "$UPDATE_BRANCH" \
206+
--commit "$PR_HEAD_SHA" \
207+
--event workflow_dispatch \
208+
--json databaseId \
209+
--jq ".[0].databaseId // \"\"")"
210+
if [ -n "$run_id" ]; then
211+
break
212+
fi
213+
echo "Waiting for CI workflow_dispatch run for $PR_HEAD_SHA (attempt $attempt/30)."
214+
sleep 10
215+
done
216+
217+
if [ -z "$run_id" ]; then
218+
echo "error: dispatched CI workflow_dispatch run for $PR_HEAD_SHA was not found"
219+
exit 1
220+
fi
221+
222+
echo "Watching CI run $run_id for automation PR #$PR_NUMBER at $PR_HEAD_SHA."
223+
gh run watch "$run_id" --repo "$GITHUB_REPOSITORY" --exit-status --interval 30

0 commit comments

Comments
 (0)