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
3 changes: 3 additions & 0 deletions .github/workflows/llgo-binary-size-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ permissions:
contents: write

concurrency:
# This must not share a group with the benchmark workflow: GitHub keeps only
# one pending run per group, so a page-only update could otherwise cancel a
# waiting binary-size build.
group: llgo-binary-size-pages
cancel-in-progress: false

Expand Down
89 changes: 83 additions & 6 deletions .github/workflows/llgo-binary-size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,22 @@ on:
type: string

permissions:
contents: write
actions: write
contents: read
actions: read

concurrency:
group: llgo-binary-size-pages
# Keep benchmark builds in their own queue. The Pages-only workflow has a
# separate queue; sharing one group would let a newer pending Pages run
# replace a pending binary-size run even with cancel-in-progress disabled.
group: llgo-binary-size-build
cancel-in-progress: false

jobs:
update-pin:
if: github.event_name == 'repository_dispatch'
permissions:
contents: write
actions: write
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -87,8 +93,40 @@ jobs:
"https://api.github.com/repos/${GITHUB_REPOSITORY}/actions/workflows/llgo-binary-size.yml/dispatches" \
--data "$payload"

pr-scope:
if: github.event_name == 'pull_request'
permissions:
contents: read
runs-on: ubuntu-24.04
outputs:
version_changed: ${{ steps.changed.outputs.version_changed }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Detect a committed LLGo version change
id: changed
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
PR_SHA: ${{ github.event.pull_request.head.sha }}
run: |
set -euo pipefail
if git diff --name-only "$BASE_SHA" "$PR_SHA" | grep -Fxq 'ci/llgo-size/llgo-version.env'; then
echo 'version_changed=true' >> "$GITHUB_OUTPUT"
echo 'The PR changes the committed LLGo version; the full matrix will run.'
else
echo 'version_changed=false' >> "$GITHUB_OUTPUT"
echo 'The PR does not change the committed LLGo version; only Go validation will run.'
fi

binary-size:
if: github.event_name != 'repository_dispatch'
if: >-
always() && github.event_name != 'repository_dispatch' &&
(github.event_name != 'pull_request' || needs.pr-scope.outputs.version_changed == 'true')
needs: pr-scope
permissions:
contents: write
runs-on: ubuntu-24.04
timeout-minutes: 120
steps:
Expand Down Expand Up @@ -209,7 +247,7 @@ jobs:
if-no-files-found: error

- name: Publish binary-size history to Pages
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
if: github.ref == 'refs/heads/main'
env:
PAGES_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
Expand All @@ -223,7 +261,7 @@ jobs:
"$pages_dir" \
ci/llgo-size/site
deploy-pages:
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
needs: binary-size
runs-on: ubuntu-24.04
permissions:
Expand Down Expand Up @@ -253,3 +291,42 @@ jobs:
- name: Deploy GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

pr-validation:
if: >-
always() && github.event_name == 'pull_request' &&
needs.pr-scope.result == 'success' && needs.pr-scope.outputs.version_changed != 'true'
needs: pr-scope
permissions:
contents: read
runs-on: ubuntu-24.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v4

- name: Read the PR validation Go version
run: |
set -euo pipefail
source ci/llgo-size/llgo-version.env
mkdir -p .ci
printf '%s\n' "$GO_VERSION" > .ci/go-version

- uses: actions/setup-go@v5
with:
go-version-file: .ci/go-version

- name: Run the LLGo-size benchmark cases with Go
env:
BENT_BUILD_WORKERS: 4
run: |
set -euo pipefail
go build -o .ci/bent ./cmd/bent
mkdir -p .ci/bent-pr
(
cd .ci/bent-pr
"$GITHUB_WORKSPACE/.ci/bent" -I
"$GITHUB_WORKSPACE/.ci/bent" -v \
-B=benchmarks-llgo-size.toml \
-C=configurations-llgo-size.toml \
-c=Go -j="$BENT_BUILD_WORKERS"
)
16 changes: 14 additions & 2 deletions ci/llgo-size/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,26 @@ The workflow keeps Bent's native benchsize files, the existing Markdown summary,
For pushes to `main`, LLGo merge dispatches, and manual runs from `main`, the
workflow copies the structured result into the pages branch. The static page at
the Pages root lists all published runs and lets you compare any two runs by
benchmark and configuration. Pull requests still build and upload an artifact
but do not modify the history.
benchmark and configuration. Pull requests use the lightweight Go-only
validation job described below; they do not produce a binary-size artifact or
modify the history.

Changes that only touch the dashboard source or its publication scripts use the
separate `llgo-binary-size-pages.yml` workflow. That path publishes the updated
site directly without rebuilding benchmarks, and its publication jobs are
restricted to `main`; pull-request builds cannot publish Pages.

The benchmark and page-only workflows use separate concurrency queues. A page
refresh can therefore wait independently without replacing a pending
binary-size run.

Pull requests are split by whether they change `llgo-version.env`. A normal PR
uses a separate Go-only validation job: dependency acquisition, compilation,
and execution are checked without building LLGo or the four LLGo binary-size
variants. A PR that changes the committed LLGo version runs the full five-way
matrix and uploads the `llgo-binary-size` artifact for review, but still does
not publish history.

### First-time repository setup

The first publisher run creates the `pages` branch automatically. Before that
Expand Down
5 changes: 4 additions & 1 deletion docs/llgo-binary-size-handoff.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@

只修改仪表盘源码或页面发布脚本时,不进入二进制大小构建;独立的
`llgo-binary-size-pages.yml` 会直接刷新 `pages` 分支并部署站点。该工作流和
主工作流的发布 job 都限制在 `main`,PR 构建只验证和上传 artifact,不会发布。
主工作流的发布 job 都限制在 `main`。普通 PR 只运行 Go 配置的用例校验;如果
PR 修改 `llgo-version.env`,则运行完整的 LLGo 二进制大小矩阵并上传 artifact
供开发者参考,但两种 PR 都不会发布 Pages。
两个工作流使用独立的并发队列,页面刷新不会淘汰等待中的二进制大小构建。

核心文件:

Expand Down
Loading