@@ -124,42 +124,18 @@ jobs:
124124 sudo docker image prune --all --force 2>/dev/null || true
125125 df -h / /tmp
126126
127- - name : Select renderer lib (vendored, or build)
128- id : lib
127+ - name : Check vendor cache (or select vendors to build)
128+ id : vendors
129129 env :
130- REPO_ROOT : ${{ github.workspace }}
130+ OPENTUI_VERSION : ${{ needs.resolve.outputs.opentui_version }}
131+ PTY_VERSION : ${{ needs.resolve.outputs.pty_version }}
132+ BUN_PTY_VERSION : ${{ needs.resolve.outputs.bun_pty_version }}
131133 run : |
132- VENDOR="vendor/libopentui-${OPENTUI_VERSION}-android-aarch64.so"
133134 mkdir -p out
134- if [ -f "$VENDOR" ]; then
135- (cd vendor && sha256sum -c "libopentui-${OPENTUI_VERSION}-android-aarch64.so.sha256")
136- cp -v "$VENDOR" out/libopentui.so
137- echo "mode=vendored" >> "$GITHUB_OUTPUT"
138- else
139- echo "mode=build" >> "$GITHUB_OUTPUT"
140- echo "no vendored lib for opentui ${OPENTUI_VERSION}, will build from source"
141- fi
142-
143- - name : Select PTY natives (vendored, or build)
144- id : pty
145- env :
146- REPO_ROOT : ${{ github.workspace }}
147- run : |
148- mkdir -p out
149- PTY_BIN="vendor/opencode-pty-${PTY_VERSION}-android-aarch64"
150- RUSTPTY_SO="vendor/librust_pty-${BUN_PTY_VERSION}-android-aarch64.so"
151- if [ -f "$PTY_BIN" ] && [ -f "$RUSTPTY_SO" ]; then
152- (cd vendor && sha256sum -c "$(basename "$PTY_BIN").sha256" "$(basename "$RUSTPTY_SO").sha256")
153- cp -v "$PTY_BIN" out/opencode-pty
154- cp -v "$RUSTPTY_SO" out/librust_pty_arm64.so
155- echo "mode=vendored" >> "$GITHUB_OUTPUT"
156- else
157- echo "mode=build" >> "$GITHUB_OUTPUT"
158- echo "no vendored pty natives for pty ${PTY_VERSION} / bun-pty ${BUN_PTY_VERSION}, will build from source"
159- fi
135+ bash scripts/build-vendors.sh --plan >> "$GITHUB_OUTPUT"
160136
161137 - name : Install Zig
162- if : steps.lib .outputs.mode == 'build' || steps.pty.outputs.mode == 'build '
138+ if : steps.vendors .outputs.need_libopentui == 'true '
163139 run : |
164140 cd /tmp || exit
165141 wget -q "https://ziglang.org/download/${ZIG_VERSION}/zig-x86_64-linux-${ZIG_VERSION}.tar.xz" -O zig.tar.xz
@@ -169,7 +145,7 @@ jobs:
169145 zig version
170146
171147 - name : Install Android NDK
172- if : steps.lib .outputs.mode == 'build ' || steps.pty .outputs.mode == 'build '
148+ if : steps.vendors .outputs.need_libopentui == 'true ' || steps.vendors .outputs.need_pty == 'true '
173149 run : |
174150 if [ ! -d "$NDK_DIR/toolchains/llvm/prebuilt/linux-x86_64" ]; then
175151 cd /tmp || exit
@@ -180,7 +156,7 @@ jobs:
180156 fi
181157
182158 - name : Install Rust Android target
183- if : steps.pty .outputs.mode == 'build '
159+ if : steps.vendors .outputs.need_pty == 'true '
184160 run : |
185161 rustup target add aarch64-linux-android
186162 rustc --version
@@ -229,55 +205,19 @@ jobs:
229205 export PATH="$HOME/.bun/bin:$PATH"
230206 python3 scripts/patch-opentui-loader.py upstream
231207
232- - name : Build libopentui.so (android, fallback when not vendored)
233- if : steps.lib.outputs.mode == 'build'
234- env :
235- REPO_ROOT : ${{ github.workspace }}
236- run : bash scripts/build-libopentui-ci.sh
237-
238- - name : Vendor the built lib (commit back to repo)
239- # First build for a new opentui version lands here; every later run
240- # (weekly or manual) reuses vendor/ and skips the source build.
241- # No push trigger on this workflow, so this cannot self-trigger.
242- if : steps.lib.outputs.mode == 'build'
243- run : |
244- VENDOR="vendor/libopentui-${OPENTUI_VERSION}-android-aarch64.so"
245- cp -v out/libopentui.so "$VENDOR"
246- (cd vendor && sha256sum "$(basename "$VENDOR")" > "$(basename "$VENDOR").sha256")
247- git config user.name "opencode-android-bot"
248- git config user.email "opencode-android-bot@users.noreply.github.com"
249- git add "$VENDOR" "$VENDOR.sha256"
250- git commit -m "vendor libopentui ${OPENTUI_VERSION} android-aarch64 (CI-built)" || echo "nothing to commit"
251- git push
252-
253- - name : Build PTY natives (android, fallback when not vendored)
254- if : steps.pty.outputs.mode == 'build'
208+ - name : Ensure vendors (stage cached, build missing, commit back)
209+ # Always runs: verifies + stages the vendored natives into out/, builds
210+ # whatever is missing from source, ELF-gates it, and commits new files
211+ # straight back to vendor/ (same job, no loop: this workflow has no
212+ # push trigger). Every later run reuses the committed files.
255213 env :
256214 REPO_ROOT : ${{ github.workspace }}
257- run : bash scripts/build-pty-android-ci.sh
258-
259- - name : Vendor the built PTY natives (commit back to repo)
260- # First build for new pty/bun-pty versions lands here; every later run
261- # reuses vendor/ and skips the source build.
262- # No push trigger on this workflow, so this cannot self-trigger.
263- if : steps.pty.outputs.mode == 'build'
264- run : |
265- PTY_BIN="vendor/opencode-pty-${PTY_VERSION}-android-aarch64"
266- RUSTPTY_SO="vendor/librust_pty-${BUN_PTY_VERSION}-android-aarch64.so"
267- cp -v out/opencode-pty "$PTY_BIN"
268- cp -v out/librust_pty_arm64.so "$RUSTPTY_SO"
269- (cd vendor && sha256sum "$(basename "$PTY_BIN")" > "$(basename "$PTY_BIN").sha256")
270- (cd vendor && sha256sum "$(basename "$RUSTPTY_SO")" > "$(basename "$RUSTPTY_SO").sha256")
271- git config user.name "opencode-android-bot"
272- git config user.email "opencode-android-bot@users.noreply.github.com"
273- git add "$PTY_BIN" "$PTY_BIN.sha256" "$RUSTPTY_SO" "$RUSTPTY_SO.sha256"
274- git commit -m "vendor pty ${PTY_VERSION} + rust_pty ${BUN_PTY_VERSION} android-aarch64 (CI-built)" || echo "nothing to commit"
275- git push
215+ run : bash scripts/build-vendors.sh --commit
276216
277217 - name : Clean Rust build dirs (early, before embed install)
278218 # cargo target/ dirs are GBs; the all-platform bun install below needs
279219 # room (workerd/darwin/win prebuilds). Final cleanup repeats this.
280- if : steps.pty .outputs.mode == 'build '
220+ if : steps.vendors .outputs.need_pty == 'true '
281221 run : |
282222 rm -rf work/opencode-pty-*/target work/bun-pty-*/rust-pty/target ~/.cargo/registry/cache
283223 rm -f /tmp/ndk.zip /tmp/zig.tar.xz
0 commit comments