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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
83 changes: 80 additions & 3 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,15 @@ jobs:
# release that republished an old tag would leave no other trace.
- name: Lint duplicate versions
run: lua5.4 tests/check_duplicate_versions.lua pkgs/*/*.lua

# mcpp reads a declarative subset of a descriptor, and the index writes
# the forms every supported mcpp release reads as the installer does: a
# version's value is a table written in place, and versions every
# platform shares are written once and referred to
# (`macosx = { ref = "linux" }`). tests/check_xpm_form.lua says what
# each other form costs and how it was measured.
- name: Lint the form of xpm
run: lua5.4 tests/check_xpm_form.lua pkgs/*/*.lua
# mwrap identities bind the owner prefix to where the wrapper repo is
# hosted (docs/mwrap.md, "Official and personal mwrap repositories"):
# `mcpplibs.mwrap.<lib>` names official wrappers under the mcpplibs org,
Expand Down Expand Up @@ -785,6 +794,55 @@ jobs:
[ $fail -eq 0 ] && echo "All CN mirror urls reachable and matching."
exit $fail

# ── Every version a changed descriptor lists installs ─────────────────
# A member depends on one version of a package, so a descriptor whose
# install() branches on the version runs its other branches nowhere else.
# 2026-12-03: the cmdline entry's branch for 0.0.1 looked for the unpacked
# tree before it was placed, 0.0.1 never installed, the members (on 0.1.0)
# passed, and every pull request of mcpp, which depends on 0.0.1, failed.
# tests/install_every_version.py fetches each listed version once, through
# the pinned mcpp, against this checkout as the built-in index.
#
# The descriptors are the ones this change adds or modifies, taken from the
# diff itself: `select` answers __ALL__ for a change to this workflow, and
# every version of every descriptor is not what a change can break. A
# scheduled or dispatched run has no base and names nothing.
every-listed-version:
needs: select
if: needs.select.outputs.pkgs != ''
runs-on: ubuntu-latest
timeout-minutes: 90
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download pinned mcpp
run: |
curl -L -fsS --retry 5 --retry-all-errors --retry-delay 10 -o mcpp.tar.gz \
"https://github.com/mcpp-community/mcpp/releases/download/v${MCPP_VERSION}/mcpp-${MCPP_VERSION}-linux-x86_64.tar.gz"
tar -xzf mcpp.tar.gz
echo "MCPP=$PWD/mcpp-${MCPP_VERSION}-linux-x86_64/bin/mcpp" >> "$GITHUB_ENV"
# What a descriptor reads as, at the base and now (tests/xpm.lua).
- name: Install lua
run: sudo apt-get install -y --no-install-recommends lua5.4
- name: Every listed version of a changed descriptor installs
env:
BASE: ${{ github.event.pull_request.base.sha || github.event.before }}
MCPP_INDEX_MIRROR: GLOBAL
run: |
if [ -z "$BASE" ] || ! git cat-file -e "$BASE^{commit}" 2>/dev/null; then
echo "No base to compare with (a scheduled or dispatched run): no descriptor is changed."
exit 0
fi
files=$(git diff --name-only --diff-filter=AMR "$BASE" HEAD -- 'pkgs/*/*.lua')
if [ -z "$files" ]; then
echo "The change adds or modifies no descriptor."
exit 0
fi
export MCPP_HOME="$RUNNER_TEMP/mcpp-home"
python3 tests/prepare_builtin_index.py --home "$MCPP_HOME"
python3 tests/install_every_version.py --mcpp "$MCPP" --base "$BASE" $files

# ── The whole test surface, as a mcpp workspace ───────────────────────
# mcpp-index is a mcpp [workspace]; every per-library test project under
# tests/examples/ is a member. `mcpp test --workspace` builds + runs each
Expand Down Expand Up @@ -1222,9 +1280,28 @@ jobs:
# 875s, 778s and 541s), so LPT packed blind. With the rows measured
# from that run, four shards still put the slowest at about 86 minutes
# of members; six put it at about 58.
ln=$(shards_for linux 6)
mn=$(shards_for macos 6)
wn=$(shards_for windows 6)
#
# ── 2026-12-04: macos 6 -> 8, windows 6 -> 8, linux 6 -> 8 ──────
#
# Observed on a full cold run (mcpp-index#979, run 47360333124, both
# attempts): `macos default 1/6`, `4/6`, `5/6` and `windows default
# 0/6` cancelled at the cap during `mcpp test`. Members with no row
# were priced at 90s (boost-libs 1054s, boost-module 952s, ffmpeg-cpu
# 563s on macOS; godot-cpp 729s, grpc-tools 599s and 34 more on
# Windows), and the macOS wrapper rows left out their installed
# checks (opencv-webp 281s against 1236s). With the rows measured
# from that run, six shards put the slowest at about 112 minutes on
# macOS and 108 on Windows; eight put it at about 80 and 79.
#
# The run of those rows (47434758792) cancelled `linux default 3/6`
# at the cap in grpc-cpu, its siblings taking 47 to 88 minutes: the
# linux rows had the same gaps (godot-cpp 544s, boost-libs 394s,
# huxerui-archive 385s untimed). With them measured from that run,
# six shards put the slowest at about 90 minutes, eight at about 72;
# the llvm leg follows with three more.
ln=$(shards_for linux 8)
mn=$(shards_for macos 8)
wn=$(shards_for windows 8)
# THE TWO LINUX LEGS ARE NOT THE SAME COST, AND THE PLANNER CANNOT
# SEE THAT. `plan_shards.lua` takes a PLATFORM and reads one timing
# table; it has no toolchain dimension, so `linux default` and
Expand Down
12 changes: 8 additions & 4 deletions .github/workflows/xpkgindex-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,15 @@ jobs:
- uses: actions/checkout@v4
with:
repository: openxlings/xpkgindex-update
ref: 6c0bee2941e36132bc2ac3d1f7edbef8b5790320
ref: 96f7bd336122f61c153fe44db87fc3fe9b97c19c
path: .updater
persist-credentials: false
- name: Use the pinned updater source
run: echo "PYTHONPATH=$PWD/.updater/src" >> "$GITHUB_ENV"
# The audit compares a version written differently by the value Lua
# evaluates (tests/autoupdate/ci.py, evaluated_versions).
- name: Install lua
run: sudo apt-get install -y --no-install-recommends lua5.4
- name: All GitHub-direct descriptors are declared; published versions are preserved
id: coverage
env:
Expand Down Expand Up @@ -87,7 +91,7 @@ jobs:
id: scan
if: github.event_name != 'pull_request'
continue-on-error: true # The mandatory gate below accepts only the approved source outage.
uses: openxlings/xpkgindex-update@6c0bee2941e36132bc2ac3d1f7edbef8b5790320
uses: openxlings/xpkgindex-update@96f7bd336122f61c153fe44db87fc3fe9b97c19c
with:
mode: check
token: ${{ github.token }}
Expand Down Expand Up @@ -149,7 +153,7 @@ jobs:
- uses: actions/checkout@v4
with:
repository: openxlings/xpkgindex-update
ref: 6c0bee2941e36132bc2ac3d1f7edbef8b5790320
ref: 96f7bd336122f61c153fe44db87fc3fe9b97c19c
path: .updater
persist-credentials: false
- uses: actions/download-artifact@v4
Expand Down Expand Up @@ -296,7 +300,7 @@ jobs:
- uses: actions/checkout@v4
with:
repository: openxlings/xpkgindex-update
ref: 6c0bee2941e36132bc2ac3d1f7edbef8b5790320
ref: 96f7bd336122f61c153fe44db87fc3fe9b97c19c
path: .updater
persist-credentials: false
- uses: actions/download-artifact@v4
Expand Down
4 changes: 2 additions & 2 deletions .xpkgindex/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Shared by deployment, site-check and cache refresh; bump through a reviewed PR.
# Includes the click-controlled phone navigation fix (xpkgindex PR #12).
xpkgindex @ git+https://github.com/openxlings/xpkgindex.git@2d3dd90dde89383e457a1ad6d5d87d4c75d697e5
# Includes the platform reference read as the installer reads it (xpkgindex PR #13).
xpkgindex @ git+https://github.com/openxlings/xpkgindex.git@3d2062756327f4dc7702ed1903749800f16c96f9
47 changes: 42 additions & 5 deletions docs/repository-and-schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,23 @@ resolves.

- `url`: a string, or a `{ GLOBAL=…, CN=… }` table (this repository uses the table form throughout).
- `sha256`: required, and equal to the digest of the actual downloaded bytes.
- A version's value is a table written in place.

Versions every platform shares are written once. One platform's table states them; each other platform refers to it
and states beside the reference only what is its own:

```lua
xpm = {
linux = { ["1.8.9"] = { url = "…", sha256 = "…" } },
macosx = { ref = "linux" },
windows = { ref = "linux", deps = {} }, -- linux has deps that windows does not take
},
```

A platform that refers to another (`ref = "<platform>"`, or `inherits = "<platform>"`; xlings reads both from
libxpkg 0.0.64) holds the versions it does not state itself, and its `deps` when it states none (`deps = {}` states
none). A platform that states other versions than a third one keeps its own table: a supported mcpp release before
2026.12.4.1 reads a referring platform as the versions every platform with a table shares.

`platform_rows` (a platform package's entry; mcpp >= 2026.11.17.1 reads it, an earlier mcpp ignores it): the rows
the platform serves, for the rows mcpp's own target table has no platform for (mcpp SPEC-013 §14) — a row the engine
Expand Down Expand Up @@ -174,7 +191,17 @@ locally with `mcpp xpkg parse pkgs/<x>/<name>.lua`.
are rejected; runs `check_mirror_urls.lua`; runs `check_package_name.lua` (identity shape, see "Package identity"
above); runs `check_reserved_namespace.lua` (the build-plugin naming rule, docs/package-types.md §I); then runs `mcpp xpkg parse` over every descriptor with the mcpp version CI pins (strict — an unknown key
fails). `xpkg parse` in mcpp >= 0.0.106 enforces the identity shape itself, which makes the lua lint an earlier and
cheaper redundant gate.
cheaper redundant gate. `check_xpm_form.lua` holds the form of `xpm` to what every supported mcpp release reads
as the installer does: every platform and every version is a table written in place (a supported release before
2026.12.4.1 reads a version stated through a local table, `versions["1.2.1"]`, as revision 0 while the installer
records its real one, and every build reinstalls the package); versions every platform shares are written once
and referred to; a reference names a platform `xpm` has a table for, and no chain of references is a cycle.
- `every-listed-version`: every version a changed descriptor lists for linux is fetched once (`mcpp fetch` in a
project of its own, against the checkout as the built-in index): the archive downloads, `install()` runs, and mcpp
reads the manifest. Members test one version of a package; this runs the branches an `install()` takes for the
others (`tests/install_every_version.py`). A descriptor that reads as at the change's base — the same text
outside `xpm`, and the same versions and deps on every platform once references are resolved (`tests/xpm.lua`)
— installs nothing.
- `mirror-cn-reachable` (always runs): `curl`s each CN url; all must return 200.
- `select`: decides the entire plan once and emits it to the runners as data. Three questions are answered here
rather than on each runner — which members run, how many shards each platform gets, and which members land on
Expand All @@ -185,10 +212,11 @@ locally with `mcpp xpkg parse pkgs/<x>/<name>.lua`.
non-member edit to the workspace manifest, or a shared test script. Documentation-only and `tools/`-only changes
select nothing.
- Sharding applies to full runs only — a selective run is one job per platform. The shard count per platform is
that platform's **measured runner concurrency** (linux 3, macos 1, windows 2) rather than a round number.
Wall-clock is `ceil(shards / concurrency) × slowest-shard`, so shards beyond the concurrency remove no work and
each still pays its own checkout, mcpp download and cache restore. At concurrency 1, splitting macOS is strictly
slower than not splitting it. Re-measure with:
the platform's measured work (`lua5.4 tests/plan_shards.lua <platform> 0 0`) at about 70 minutes a shard, capped
per platform: linux 8 (its llvm leg three more), macOS 8, Windows 8. The cap is the job's 90-minute timeout, not
the runner concurrency: wall-clock is `ceil(shards / concurrency) × slowest-shard`, so shards beyond the
concurrency queue and still finish, while a shard over the timeout is cancelled. Each shard pays its own
checkout, mcpp download and cache restore. Re-measure the concurrency with:
`gh api repos/<owner>/<repo>/actions/runs/<id>/jobs --paginate --jq '[.jobs[]|select(.status=="in_progress")]|length'`
- The assignment itself comes from `tests/plan_shards.lua`. It reads `tests/member-timings.tsv` and packs
longest-first onto the least-loaded shard; ties break toward the shard already holding members with overlapping
Expand Down Expand Up @@ -238,9 +266,18 @@ for f in pkgs/*/*.lua; do
lua5.4 tests/check_reserved_namespace.lua "$f" || fail=1
lua5.4 tests/check_mwrap_repo_identity.lua "$f" || fail=1
done
lua5.4 tests/check_xpm_form.lua pkgs/*/*.lua || fail=1
[ $fail -eq 0 ] && echo "ALL LINT PASS"
```

Every listed version of the descriptors a change touches, as the `every-listed-version` job installs them:

```bash
export MCPP_HOME="$(mktemp -d)"
python3 tests/prepare_builtin_index.py --home "$MCPP_HOME"
python3 tests/install_every_version.py --mcpp "$MCPP" --base origin/main $(git diff --name-only origin/main -- 'pkgs/*/*.lua')
```

## Running workspace members locally

`tests/run_members.sh` is the entry point CI uses, so a local run measures the same thing under the same split:
Expand Down
42 changes: 37 additions & 5 deletions docs/zh/repository-and-schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,21 @@ namespace = "mcpplibs", name = "capi.lua" -- 短名仍带点

- `url`:字符串,或 `{ GLOBAL=…, CN=… }` 表(本仓统一使用表形式)。
- `sha256`:必填,等于实际下载字节的摘要。
- 一个版本的值是就地写出的表。

各平台共有的版本只写一次:由一个平台的表陈述,其余平台引用它,并在引用旁只陈述自己独有的内容:

```lua
xpm = {
linux = { ["1.8.9"] = { url = "…", sha256 = "…" } },
macosx = { ref = "linux" },
windows = { ref = "linux", deps = {} }, -- linux 有 windows 不取的 deps
},
```

引用另一平台的平台(`ref = "<platform>"` 或 `inherits = "<platform>"`;xlings 自 libxpkg 0.0.64 起读取二者)
持有自身未陈述的版本,并在自身未陈述 `deps` 时持有被引用平台的 `deps`(`deps = {}` 陈述为无)。与第三个平台
陈述不同版本的平台保留自己的表:2026.12.4.1 之前受支持的 mcpp 版本把引用平台读作所有有表的平台共有的版本。

`platform_rows`(平台包的条目;mcpp >= 2026.11.17.1 读取,更早的 mcpp 忽略):平台服务的行,用于 mcpp 自身的目标表
没有平台的行(mcpp SPEC-013 §14)——引擎不认识的行、`planned` 行、本机没有内置提供者服务的行。构建指名这样的行而没有
Expand Down Expand Up @@ -137,18 +152,26 @@ mcpp 跑 `xpkg parse`(strict:未知键即失败),所以需要更新文法/键的
- `lint`(始终运行):lua 语法 `loadfile(f,'t')`;须含 `spec=`/`name=`/`xpm=`;禁止前导 v 版本;执行
`check_mirror_urls.lua`;执行 `check_package_name.lua`(身份形态,见上文「包身份」);执行 `check_reserved_namespace.lua`(构建插件命名规则,见 package-types §I);再用 CI pin 的
mcpp 对每个描述符跑 `mcpp xpkg parse`(strict,未知键即失败)。mcpp ≥ 0.0.106 的 `xpkg parse` 自身
也强制身份形态,lua lint 因此是更早、更便宜的冗余闸门。
也强制身份形态,lua lint 因此是更早、更便宜的冗余闸门。`check_xpm_form.lua` 把 `xpm` 的写法限定在每个受支持
的 mcpp 版本都与安装器读法一致的范围内:每个平台与每个版本都是就地写出的表(2026.12.4.1 之前受支持的版本把经
局部表陈述的版本 `versions["1.2.1"]` 读作修订 0,而安装器记录的是它真实的修订,于是每次构建都重装该包);各平台
共有的版本只写一次并被引用;引用指向 `xpm` 中有表的平台,引用链不成环。
- `every-listed-version`:被改动的描述符为 linux 所列的每个版本各取得一次(在各自的工程里运行 `mcpp fetch`,
以检出的树为内置索引):归档下载、`install()` 运行、mcpp 读到清单。成员只测试一个包的一个版本;这一步执行
`install()` 为其余版本所走的分支(`tests/install_every_version.py`)。读法与改动基线相同的描述符 —— `xpm`
之外的文本相同,且解析引用之后每个平台的版本与 deps 相同(`tests/xpm.lua`)—— 不安装任何东西。
- `mirror-cn-reachable`(始终运行):逐个 `curl` CN url,均须返回 200。
- `select`:一次性决定整个计划,并以数据形式下发给各 runner。三个问题在此处而非各 runner 上回答 ——
哪些成员要跑、每个平台分几片、哪些成员落在哪一片。
- 选择性成员测试:PR 时由 `git diff` 将改动文件映射到受影响成员
(`pkgs/<x>/<lib>.lua` → mcpp.toml 引用 `<lib>` 的成员;`tests/examples/<m>/**` → 成员 `<m>`)。
可能影响全部成员的改动则选中整个 workspace:非 PR 事件、本 workflow 文件、workspace 清单的非成员
部分、共享测试脚本。仅文档与仅 `tools/` 的改动不选中任何成员。
- 分片仅用于全量运行,选择性运行为每平台一个 job。每平台的分片数取该平台**实测的 runner 并发度**
(linux 3、macos 1、windows 2),而非取整数。墙钟为 `ceil(分片数 / 并发度) × 最慢分片`,故超出并发度
的分片不减少任何工作量,却各自仍要付出 checkout、mcpp 下载与缓存恢复的固定开销;并发度为 1 时,
对 macOS 分片严格慢于不分片。重新测量:
- 分片仅用于全量运行,选择性运行为每平台一个 job。每平台的分片数按该平台的实测工作量
(`lua5.4 tests/plan_shards.lua <平台> 0 0`)以每片约 70 分钟计算,并按平台设上限:linux 8(其 llvm
腿再多 3)、macOS 8、Windows 8。上限由 job 的 90 分钟超时决定,而非 runner 并发度:墙钟为
`ceil(分片数 / 并发度) × 最慢分片`,超出并发度的分片排队后仍能完成,超时的分片则被取消。每个分片
各自付出 checkout、mcpp 下载与缓存恢复的固定开销。重新测量并发度:
`gh api repos/<owner>/<repo>/actions/runs/<id>/jobs --paginate --jq '[.jobs[]|select(.status=="in_progress")]|length'`
- 分配本身由 `tests/plan_shards.lua` 给出:读取 `tests/member-timings.tsv`,按耗时降序依次放入当前负载
最小的分片;负载接近时优先选择已含有共同依赖成员的分片 —— 分片之间不共享构建缓存,同一依赖落在两片
Expand Down Expand Up @@ -192,9 +215,18 @@ for f in pkgs/*/*.lua; do
lua5.4 tests/check_reserved_namespace.lua "$f" || fail=1
lua5.4 tests/check_mwrap_repo_identity.lua "$f" || fail=1
done
lua5.4 tests/check_xpm_form.lua pkgs/*/*.lua || fail=1
[ $fail -eq 0 ] && echo "ALL LINT PASS"
```

一次改动所涉描述符的每个所列版本,按 `every-listed-version` 作业的方式安装:

```bash
export MCPP_HOME="$(mktemp -d)"
python3 tests/prepare_builtin_index.py --home "$MCPP_HOME"
python3 tests/install_every_version.py --mcpp "$MCPP" --base origin/main $(git diff --name-only origin/main -- 'pkgs/*/*.lua')
```

## 本地运行 workspace 成员

`tests/run_members.sh` 即 CI 使用的入口,故本地运行度量的是同一对象、同一划分:
Expand Down
1 change: 1 addition & 0 deletions mcpp.toml
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ members = [
"tests/examples/websocket-features",
"tests/examples/websocket-tls",
"tests/examples/wolfssl",
"tests/examples/xpkg",
"tests/examples/tl-optional",
"tests/examples/tinygltf",
"tests/examples/tinygltf-v301",
Expand Down
Loading
Loading