mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-28 13:26:04 -06:00
fix(ci): preserve AI runtime build artifacts
This commit is contained in:
@@ -98,7 +98,7 @@ jobs:
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
cache_prefix="${RUNNER_OS}-dist-build-"
|
||||
cache_prefix="${RUNNER_OS}-dist-build-v2-"
|
||||
declare -A seen=()
|
||||
|
||||
resolve_tag_sha() {
|
||||
@@ -150,7 +150,8 @@ jobs:
|
||||
.artifacts/build-all-cache/
|
||||
dist/
|
||||
dist-runtime/
|
||||
key: ${{ runner.os }}-dist-build-${{ github.sha }}
|
||||
packages/ai/dist/
|
||||
key: ${{ runner.os }}-dist-build-v2-${{ github.sha }}
|
||||
restore-keys: ${{ steps.dist-cache-seeds.outputs.restore-keys }}
|
||||
|
||||
- name: Build dist on cache miss
|
||||
@@ -170,6 +171,7 @@ jobs:
|
||||
|
||||
test -d dist
|
||||
test -d dist-runtime
|
||||
test -f packages/ai/dist/internal/runtime.mjs
|
||||
if [[ ! -f dist/index.js && ! -f dist/index.mjs ]]; then
|
||||
echo "Missing dist/index.js or dist/index.mjs" >&2
|
||||
exit 1
|
||||
@@ -185,7 +187,8 @@ jobs:
|
||||
.artifacts/build-all-cache/
|
||||
dist/
|
||||
dist-runtime/
|
||||
key: ${{ runner.os }}-dist-build-${{ github.sha }}
|
||||
packages/ai/dist/
|
||||
key: ${{ runner.os }}-dist-build-v2-${{ github.sha }}
|
||||
|
||||
- name: Prepare Testbox shell
|
||||
shell: bash
|
||||
|
||||
@@ -672,9 +672,10 @@ jobs:
|
||||
path: |
|
||||
dist/
|
||||
dist-runtime/
|
||||
packages/ai/dist/
|
||||
extensions/*/src/host/**/.bundle.hash
|
||||
extensions/*/src/host/**/*.bundle.js
|
||||
key: ${{ runner.os }}-dist-build-${{ needs.preflight.outputs.checkout_revision }}
|
||||
key: ${{ runner.os }}-dist-build-v2-${{ needs.preflight.outputs.checkout_revision }}
|
||||
|
||||
- name: Build dist
|
||||
if: steps.dist_build_cache.outputs.cache-hit != 'true'
|
||||
@@ -687,7 +688,7 @@ jobs:
|
||||
run: pnpm ui:i18n:check
|
||||
|
||||
- name: Pack built runtime artifacts
|
||||
run: tar --posix -cf dist-runtime-build.tar.zst --use-compress-program zstdmt dist dist-runtime
|
||||
run: tar --posix -cf dist-runtime-build.tar.zst --use-compress-program zstdmt dist dist-runtime packages/ai/dist
|
||||
|
||||
- name: Upload built runtime artifacts
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
|
||||
@@ -833,6 +834,7 @@ jobs:
|
||||
path: |
|
||||
dist/
|
||||
dist-runtime/
|
||||
packages/ai/dist/
|
||||
extensions/*/src/host/**/.bundle.hash
|
||||
extensions/*/src/host/**/*.bundle.js
|
||||
key: ${{ steps.dist_build_cache.outputs.cache-primary-key }}
|
||||
|
||||
@@ -736,11 +736,33 @@ describe("ci workflow guards", () => {
|
||||
expect(saveStep.with.key).toBe("${{ steps.dist_build_cache.outputs.cache-primary-key }}");
|
||||
expect(restoreStep.with.path).toContain("dist/");
|
||||
expect(restoreStep.with.path).toContain("dist-runtime/");
|
||||
expect(restoreStep.with.path).toContain("packages/ai/dist/");
|
||||
expect(saveStep.with.path).toContain("packages/ai/dist/");
|
||||
expect(restoreStep.with.key).toContain("dist-build-v2-");
|
||||
expect(
|
||||
buildArtifactSteps.find((step) => step.name === "Pack built runtime artifacts").run,
|
||||
).toContain("packages/ai/dist");
|
||||
expect(restoreStep.with.path).toContain("extensions/*/src/host/**/.bundle.hash");
|
||||
expect(restoreStep.with.path).toContain("extensions/*/src/host/**/*.bundle.js");
|
||||
expect(buildArtifactSteps.map((step) => step.name)).not.toContain("Cache dist build");
|
||||
});
|
||||
|
||||
it("keeps the AI runtime in Testbox build artifact caches", () => {
|
||||
const workflow = readBuildArtifactsTestboxWorkflow();
|
||||
const steps = workflow.jobs["build-artifacts"].steps;
|
||||
const resolveSeedsStep = steps.find((step) => step.name === "Resolve release dist cache seeds");
|
||||
const restoreStep = steps.find((step) => step.name === "Restore dist build cache");
|
||||
const verifyStep = steps.find((step) => step.name === "Verify build artifacts");
|
||||
const saveStep = steps.find((step) => step.name === "Save dist build cache");
|
||||
|
||||
expect(resolveSeedsStep.run).toContain('cache_prefix="${RUNNER_OS}-dist-build-v2-"');
|
||||
expect(restoreStep.with.path).toContain("packages/ai/dist/");
|
||||
expect(restoreStep.with.key).toContain("dist-build-v2-");
|
||||
expect(verifyStep.run).toContain("test -f packages/ai/dist/internal/runtime.mjs");
|
||||
expect(saveStep.with.path).toContain("packages/ai/dist/");
|
||||
expect(saveStep.with.key).toContain("dist-build-v2-");
|
||||
});
|
||||
|
||||
it("runs gateway watch after parallel built artifact checks", () => {
|
||||
const workflow = readCiWorkflow();
|
||||
const buildArtifactSteps = workflow.jobs["build-artifacts"].steps;
|
||||
|
||||
Reference in New Issue
Block a user