@@ -119,14 +119,54 @@ jobs:
119119 - name : Install pi CLI for runtime build
120120 run : npm install -g @mariozechner/pi-coding-agent
121121
122+ - name : Resolve pi CLI version
123+ id : pi-version
124+ run : |
125+ set -euo pipefail
126+ PI_VERSION=$(npm list -g @mariozechner/pi-coding-agent --depth=0 --json \
127+ | node -e 'const fs = require("node:fs"); const data = JSON.parse(fs.readFileSync(0, "utf8")); process.stdout.write(data.dependencies?.["@mariozechner/pi-coding-agent"]?.version ?? "unknown");')
128+ echo "version=$PI_VERSION" >> "$GITHUB_OUTPUT"
129+ echo "pi_version=$PI_VERSION"
130+
131+ - name : Restore runtime pack cache
132+ id : runtime-pack-cache
133+ uses : actions/cache/restore@v4
134+ with :
135+ path : " ~/Library/Application Support/com.pi.work/runtime"
136+ key : runtime-pack-${{ runner.os }}-${{ runner.arch }}-pi-${{ steps.pi-version.outputs.version }}-${{ hashFiles('mise-tasks/runtime-build', 'runtime/init.sh', 'runtime/taskd.js') }}
137+
122138 - name : Install dependencies
123139 run : pnpm install --frozen-lockfile
124140
125141 - name : Run full live regression gate
126142 env :
127143 PIWORK_QEMU_ACCEL : tcg
144+ PIWORK_RUNTIME_CACHE_HIT : ${{ steps.runtime-pack-cache.outputs.cache-hit }}
128145 run : mise run test-regressions
129146
147+ - name : Check runtime pack cache save eligibility
148+ if : always()
149+ id : runtime-pack-cache-ready
150+ run : |
151+ set -euo pipefail
152+ RUNTIME_DIR="$HOME/Library/Application Support/com.pi.work/runtime"
153+
154+ if [[ -f "$RUNTIME_DIR/manifest.json" ]] \
155+ && [[ -f "$RUNTIME_DIR/vmlinuz-virt" ]] \
156+ && [[ -f "$RUNTIME_DIR/initramfs-virt-fast" ]]; then
157+ echo "ready=true" >> "$GITHUB_OUTPUT"
158+ exit 0
159+ fi
160+
161+ echo "ready=false" >> "$GITHUB_OUTPUT"
162+
163+ - name : Save runtime pack cache
164+ if : always() && steps.runtime-pack-cache.outputs.cache-hit != 'true' && steps.runtime-pack-cache-ready.outputs.ready == 'true'
165+ uses : actions/cache/save@v4
166+ with :
167+ path : " ~/Library/Application Support/com.pi.work/runtime"
168+ key : runtime-pack-${{ runner.os }}-${{ runner.arch }}-pi-${{ steps.pi-version.outputs.version }}-${{ hashFiles('mise-tasks/runtime-build', 'runtime/init.sh', 'runtime/taskd.js') }}
169+
130170 - name : Collect integration diagnostics on failure
131171 if : failure()
132172 run : |
0 commit comments