Skip to content

Commit 5ed7154

Browse files
The backend is one ok-image bundle with every system's okrun: each system packs its universal self-contained package, mcpp pack --merge joins them, and the editor packages carry the bundle and the joined okrun; the program-per-system form is gone; a host-platform row; CI builds mcpp from MCPP_SOURCE_REF until it is released
Co-authored-by: speak-agent <248744407+speak-agent@users.noreply.github.com>
1 parent 285732b commit 5ed7154

18 files changed

Lines changed: 252 additions & 170 deletions

File tree

‎.github/actions/setup-mcpp/action.yml‎

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: Set up mcpp
2-
description: Install xlings, the pinned mcpp and (for macOS and Windows targets) the pinned LLVM, with the package store cached.
2+
description: Install xlings, the pinned mcpp (built from MCPP_SOURCE_REF when it is set) and (for macOS and Windows targets) the pinned LLVM, with the package store cached.
33
inputs:
44
llvm:
55
description: Install LLVM and make it mcpp's default toolchain.
@@ -58,3 +58,54 @@ runs:
5858
sleep 30
5959
done
6060
mcpp toolchain default "llvm@$LLVM_VERSION"
61+
# MCPP_SOURCE_REF: mcpp built from that ref by the release installed above, before the ref is
62+
# released; the program is kept per commit and system, and put first on PATH.
63+
- name: Resolve MCPP_SOURCE_REF
64+
id: source
65+
if: env.MCPP_SOURCE_REF != ''
66+
shell: bash
67+
run: |
68+
set -euo pipefail
69+
sha="$(git ls-remote https://github.com/mcpp-community/mcpp.git "refs/heads/$MCPP_SOURCE_REF" "refs/tags/$MCPP_SOURCE_REF" | head -1 | cut -f1)"
70+
[ -n "$sha" ] || { echo "::error::mcpp-community/mcpp has no branch or tag $MCPP_SOURCE_REF"; exit 1; }
71+
echo "sha=$sha" >> "$GITHUB_OUTPUT"
72+
- name: Restore mcpp built from ${{ env.MCPP_SOURCE_REF }}
73+
id: kept
74+
if: env.MCPP_SOURCE_REF != ''
75+
uses: actions/cache/restore@v5
76+
with:
77+
path: ~/.mcpp-source/bin
78+
key: mcpp-source-${{ runner.os }}-${{ runner.arch }}-${{ steps.source.outputs.sha }}
79+
- name: mcpp from ${{ env.MCPP_SOURCE_REF }}
80+
id: built
81+
if: env.MCPP_SOURCE_REF != ''
82+
shell: bash
83+
env:
84+
SHA: ${{ steps.source.outputs.sha }}
85+
run: |
86+
set -euo pipefail
87+
case "$RUNNER_OS" in Windows) exe=mcpp.exe ;; *) exe=mcpp ;; esac
88+
bin="$HOME/.mcpp-source/bin"
89+
# A kept program that does not start (its toolchain's run-time is not in this store) is built again.
90+
if ! "$bin/$exe" --version > /dev/null 2>&1; then
91+
src="$RUNNER_TEMP/mcpp-source"
92+
rm -rf "$src"
93+
git init -q "$src"
94+
git -C "$src" fetch -q --depth 1 https://github.com/mcpp-community/mcpp.git "$SHA"
95+
git -C "$src" checkout -q FETCH_HEAD
96+
(cd "$src" && mcpp build)
97+
built="$(find "$src/target" -type f -name "$exe" -path '*/bin/*' ! -path '*/dist/*' | head -1)"
98+
[ -n "$built" ] || { echo "::error::building mcpp at $MCPP_SOURCE_REF left no $exe"; exit 1; }
99+
mkdir -p "$bin"
100+
cp "$built" "$bin/$exe"
101+
echo "fresh=true" >> "$GITHUB_OUTPUT"
102+
fi
103+
"$bin/$exe" --version
104+
case "$RUNNER_OS" in Windows) cygpath -w "$bin" ;; *) echo "$bin" ;; esac >> "$GITHUB_PATH"
105+
# Kept as soon as it is built, so a job that fails later does not build it again.
106+
- name: Keep mcpp built from ${{ env.MCPP_SOURCE_REF }}
107+
if: env.MCPP_SOURCE_REF != '' && steps.built.outputs.fresh == 'true' && steps.kept.outputs.cache-hit != 'true'
108+
uses: actions/cache/save@v5
109+
with:
110+
path: ~/.mcpp-source/bin
111+
key: ${{ steps.kept.outputs.cache-primary-key }}

‎.github/scripts/check-package.sh‎

Lines changed: 14 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,18 @@
22
# check-package.sh <package> <root inside the archive>
33
#
44
# What an editor package carries of the backend, checked on the system this runs on (CI runs it on
5-
# every system): with the ok-image bundle (mcpp design 2026-10-28 part 2 §15), exactly one
6-
# backend/mcpp-ide.okb, an okrun for every system and architecture, and the one for this system
7-
# starting the bundle; until the bundle is built, a program for every system, and the one for this
8-
# system answering.
5+
# every system): the ok-image bundle (mcpp design 2026-10-28 part 2 §15), exactly one
6+
# backend/mcpp-ide.okb; an okrun for every system and architecture CI packs; and the one for this
7+
# system starting the bundle.
98
set -euo pipefail
109
package="$1" prefix="$2"
1110
dir="$(mktemp -d)"
1211
trap 'rm -rf "$dir"' EXIT
1312
unzip -q "$package" -d "$dir"
1413
root="$dir/$prefix"
1514

16-
case "$(uname -s)" in Linux) os=linux vs=linux ;; Darwin) os=macos vs=darwin ;; *) os=windows vs=win32 ;; esac
17-
case "$(uname -m)" in x86_64|amd64|AMD64) arch=x86_64 va=x64 ;; aarch64|arm64|ARM64) arch=aarch64 va=arm64 ;; *) arch="$(uname -m)" va="$arch" ;; esac
15+
case "$(uname -s)" in Linux) os=linux ;; Darwin) os=macos ;; *) os=windows ;; esac
16+
case "$(uname -m)" in x86_64|amd64|AMD64) arch=x86_64 ;; aarch64|arm64|ARM64) arch=aarch64 ;; *) arch="$(uname -m)" ;; esac
1817
exe=""; [ "$os" = windows ] && exe=".exe"
1918

2019
answers() { # <argv...>: the backend says who it is
@@ -25,25 +24,13 @@ answers() { # <argv...>: the backend says who it is
2524
}
2625

2726
okbs="$(find "$root" -name '*.okb' | wc -l | tr -d ' ')"
28-
if [ "$okbs" != 0 ]; then
29-
[ "$okbs" = 1 ] || { echo "::error::$package carries $okbs ok-image bundles; one is expected"; exit 1; }
30-
[ -f "$root/backend/mcpp-ide.okb" ] || { echo "::error::the bundle is not backend/mcpp-ide.okb"; exit 1; }
31-
for want in linux-x86_64 linux-aarch64 macos-aarch64 windows-x86_64; do
32-
ls "$root/backend/okrun/$want/"okrun* > /dev/null 2>&1 || { echo "::error::$package carries no okrun for $want"; exit 1; }
33-
done
34-
okrun="$root/backend/okrun/$os-$arch/okrun$exe"
35-
chmod +x "$okrun" 2>/dev/null || true
36-
answers "$okrun" "$root/backend/mcpp-ide.okb"
37-
echo "$package: one bundle; okrun for $os-$arch starts it"
38-
exit 0
39-
fi
40-
41-
[ -d "$root/backend" ] && { echo "::error::$package has backend/ but no bundle"; exit 1; }
42-
echo "::notice::$package carries no ok-image bundle yet (mcpp's platforms and openkal 0.17.2); checking its per-system programs"
43-
for want in linux-x64/mcpp-ide linux-arm64/mcpp-ide darwin-arm64/mcpp-ide win32-x64/mcpp-ide.exe; do
44-
[ -f "$root/bin/$want" ] || { echo "::error::$package carries no bin/$want"; exit 1; }
27+
[ "$okbs" = 1 ] || { echo "::error::$package carries $okbs ok-image bundles; one is expected"; exit 1; }
28+
[ -f "$root/backend/mcpp-ide.okb" ] || { echo "::error::the bundle is not backend/mcpp-ide.okb"; exit 1; }
29+
for want in linux-x86_64 linux-aarch64 macos-aarch64 windows-x86_64; do
30+
ls "$root/backend/okrun/$want/"okrun* > /dev/null 2>&1 || { echo "::error::$package carries no okrun for $want"; exit 1; }
4531
done
46-
program="$root/bin/$vs-$va/mcpp-ide$exe"
47-
chmod +x "$program" 2>/dev/null || true
48-
answers "$program"
49-
echo "$package: a program for every system; the one for $vs-$va answers"
32+
[ -d "$root/bin" ] && { echo "::error::$package carries bin/ beside the bundle"; exit 1; }
33+
okrun="$root/backend/okrun/$os-$arch/okrun$exe"
34+
chmod +x "$okrun" 2>/dev/null || true
35+
answers "$okrun" "$root/backend/mcpp-ide.okb"
36+
echo "$package: one bundle; okrun for $os-$arch starts it"

‎.github/versions.env‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# The versions CI builds and tests with, in one file; .github/actions/setup-mcpp exports them.
2-
# The mcpp whose control contract the fixtures were captured from (protocol/fixtures/version.txt).
2+
# The released mcpp CI installs; with MCPP_SOURCE_REF, the one that builds mcpp from that ref.
33
MCPP_VERSION=2026.10.26.2
4+
# Until mcpp 2026.10.27.1 is released: the ref of mcpp-community/mcpp CI builds and uses, whose control
5+
# contract the fixtures were captured from (protocol/fixtures/version.txt) and whose platforms
6+
# (openkal-platform 0.17.2) the backend's ok images are built on. Empty: the release above is used.
7+
MCPP_SOURCE_REF=release/2026.10.27.1
48
# The LLVM the backend builds with on macOS and Windows (the targets mcpp reaches there with it).
59
LLVM_VERSION=23.1.3
610
# The xlings mcpp 2026.10.26.2 bundles, which reads the current index.

0 commit comments

Comments
 (0)