Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion .github/workflows/llgo-binary-size-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,28 @@ jobs:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
set -a
source ci/llgo-size/llgo-version.env
set +a

# Rebuild every stored run's main position from the complete LLGo
# first-parent history. Result jobs may have been created from old or
# shallow checkouts, so their embedded index is only a hint.
git clone --filter=blob:none --no-checkout --single-branch --branch main \
"https://github.com/${LLGO_REPOSITORY}.git" \
"$GITHUB_WORKSPACE/.ci/llgo-history"
git -C "$GITHUB_WORKSPACE/.ci/llgo-history" \
rev-list --first-parent --reverse origin/main \
> "$GITHUB_WORKSPACE/.ci/llgo-main-history.txt"

pages_dir="$GITHUB_WORKSPACE/.ci/pages"
bash ci/llgo-size/prepare-pages-branch.sh \
"$pages_dir" \
"https://x-access-token:${PAGES_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
ci/llgo-size/publish-site.sh "$pages_dir" ci/llgo-size/site
ci/llgo-size/publish-site.sh \
"$pages_dir" \
ci/llgo-size/site \
"$GITHUB_WORKSPACE/.ci/llgo-main-history.txt"

deploy-pages:
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/llgo-binary-size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,10 @@ jobs:
git -C .ci/llgo fetch --progress --no-tags --depth=1 origin "$LLGO_COMMIT"
time_command "Check out pinned LLGo commit" \
git -C .ci/llgo checkout --detach "$LLGO_COMMIT"
git -C .ci/llgo fetch --no-tags origin main
# The commit-specific depth-1 fetch above makes this repository
# shallow. Unshallow it before assigning first-parent positions;
# otherwise every run appears to be main index 1.
git -C .ci/llgo fetch --no-tags --unshallow origin main
git -C .ci/llgo rev-list --first-parent --reverse origin/main > .ci/llgo-main-history.txt
llgo_main_index="$(awk -v commit="$LLGO_COMMIT" '$0 == commit { print NR; exit }' \
.ci/llgo-main-history.txt)"
Expand Down
9 changes: 7 additions & 2 deletions ci/llgo-size/publish-site.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ set -euo pipefail
script_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
pages_dir="$1"
site_dir="$2"
main_history="${3:-}"
if [[ -z "$pages_dir" || -z "$site_dir" ]]; then
echo "usage: publish-site.sh PAGES_DIR SITE_DIR" >&2
echo "usage: publish-site.sh PAGES_DIR SITE_DIR [LLGO_MAIN_HISTORY]" >&2
exit 2
fi

Expand All @@ -14,7 +15,11 @@ for file in index.html app.js performance.html performance.js compatibility.html
done
rm -f "$pages_dir/.nojekyll"
if [[ -s "$pages_dir/data/index.json" ]]; then
python3 "$script_dir/enrich_pull_requests.py" "$pages_dir/data/index.json"
enrich_args=("$pages_dir/data/index.json")
if [[ -n "$main_history" && -s "$main_history" ]]; then
enrich_args+=(--main-history "$main_history")
fi
python3 "$script_dir/enrich_pull_requests.py" "${enrich_args[@]}"
fi

git -C "$pages_dir" config user.name "github-actions[bot]"
Expand Down
2 changes: 2 additions & 0 deletions ci/llgo-size/test_enrich_pull_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,13 @@ def test_orders_runs_by_llgo_main_history_instead_of_build_completion(self):
{
"key": second,
"llgoCommit": second,
"llgoMainIndex": 1,
"createdAt": "2026-08-21T01:00:00Z",
},
{
"key": first,
"llgoCommit": first,
"llgoMainIndex": 1,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Test presets are dead input; doesn't verify stale-index correction

Both runs now carry llgoMainIndex: 1, but both commits (first, second) are in the main_history passed to order_runs, which unconditionally overwrites the index for any in-history commit. The preset 1 values are therefore always overwritten to 1/2, and the test passes identically whether they are 1,1 or absent — so it does not actually exercise replacement of a stale index, despite the test name.

If the intent is to prove a stale index gets corrected, make the presets wrong (e.g. both 99) and assert the corrected [2, 1]. Otherwise these two added lines add no coverage and could be reverted.

"createdAt": "2026-08-21T02:00:00Z",
},
]
Expand Down
Loading