mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-24 19:35:28 -06:00
150 lines
6.4 KiB
YAML
150 lines
6.4 KiB
YAML
name: Vitest Cache Warm
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
workflow_dispatch:
|
|
repository_dispatch:
|
|
types: [vitest-cache-warm]
|
|
schedule:
|
|
- cron: "17 8 * * *"
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: vitest-cache-warm
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
warm:
|
|
# Shared CI cache publication is isolated from pull-request execution.
|
|
# Trusted release/proof workflows may save only through the same authority contract.
|
|
if: github.repository == 'openclaw/openclaw'
|
|
runs-on: ${{ vars.OPENCLAW_CI_RUNNER_BACKEND == 'github' && 'ubuntu-24.04' || 'blacksmith-8vcpu-ubuntu-2404' }}
|
|
timeout-minutes: 60
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
|
|
|
- name: Setup Node environment
|
|
id: setup-node-env
|
|
uses: ./.github/actions/setup-node-env
|
|
with:
|
|
build-all-cache-scope: full
|
|
cache-mode: read-write
|
|
dependency-cache: "true"
|
|
install-bun: "false"
|
|
node-compile-cache: "true"
|
|
node-compile-cache-scope: "test"
|
|
vitest-fs-cache: "true"
|
|
|
|
- name: Warm build cache
|
|
env:
|
|
NODE_OPTIONS: --max-old-space-size=8192
|
|
run: pnpm build
|
|
|
|
- name: Select broad cache seed
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
node --import tsx --input-type=module <<'EOF'
|
|
import { appendFileSync } from "node:fs";
|
|
import { createVitestCacheWarmGroups } from "./scripts/lib/ci-node-test-plan.mts";
|
|
|
|
// Warm the selected planner envelopes for the striped unit-fast graph
|
|
// plus import-bound graphs that remained cold in protected-cache readers.
|
|
const groups = createVitestCacheWarmGroups();
|
|
appendFileSync(
|
|
process.env.GITHUB_ENV,
|
|
[
|
|
`OPENCLAW_NODE_TEST_GROUPS_JSON=${JSON.stringify(groups)}`,
|
|
"OPENCLAW_NODE_TEST_PLAN_CONCURRENCY=1",
|
|
].join("\n") + "\n",
|
|
);
|
|
EOF
|
|
|
|
- name: Warm transform and compile caches
|
|
env:
|
|
# Match the CI shard lanes running the same envelopes: without the
|
|
# raised ceiling a heavy suite's worker can die under default heap
|
|
# (run 31874567859), skipping every cache save for the day.
|
|
NODE_OPTIONS: --max-old-space-size=8192
|
|
run: node --import tsx scripts/ci-run-node-test-shard.mts
|
|
|
|
- name: Save Node toolchain cache
|
|
if: ${{ steps.setup-node-env.outputs.cache-mode == 'read-write' && runner.os != 'Windows' && runner.environment != 'github-hosted' && steps.setup-node-env.outputs.node-toolchain-populated == 'true' && steps.setup-node-env.outputs.node-toolchain-cache-matched-key != steps.setup-node-env.outputs.node-toolchain-cache-key }}
|
|
continue-on-error: true
|
|
uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
|
|
with:
|
|
path: ${{ steps.setup-node-env.outputs.node-toolchain-cache-path }}
|
|
key: ${{ steps.setup-node-env.outputs.node-toolchain-cache-key }}
|
|
|
|
- name: Save exact dependency cache
|
|
if: ${{ steps.setup-node-env.outputs.cache-mode == 'read-write' && steps.setup-node-env.outputs.dependency-cache-key != '' && steps.setup-node-env.outputs.dependency-cache-hit != 'true' }}
|
|
continue-on-error: true
|
|
uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
|
|
with:
|
|
path: |
|
|
node_modules
|
|
ui/node_modules
|
|
packages/*/node_modules
|
|
examples/*/node_modules
|
|
.cache/openclaw-pnpm-store
|
|
key: ${{ steps.setup-node-env.outputs.dependency-cache-key }}
|
|
|
|
# Prefix restores accumulate old lockfile generations. Keep the trusted
|
|
# writer bounded before publishing the coarser fallback store.
|
|
- name: Prune pnpm store before save
|
|
if: ${{ steps.setup-node-env.outputs.cache-mode == 'read-write' && steps.setup-node-env.outputs.pnpm-store-cache-key != '' && steps.setup-node-env.outputs.pnpm-store-cache-hit != 'true' }}
|
|
shell: bash
|
|
run: |
|
|
du -sh "${{ steps.setup-node-env.outputs.pnpm-store-cache-path }}" || true
|
|
pnpm store prune
|
|
du -sh "${{ steps.setup-node-env.outputs.pnpm-store-cache-path }}" || true
|
|
|
|
- name: Save pnpm store cache
|
|
if: ${{ steps.setup-node-env.outputs.cache-mode == 'read-write' && steps.setup-node-env.outputs.pnpm-store-cache-key != '' && steps.setup-node-env.outputs.pnpm-store-cache-hit != 'true' }}
|
|
continue-on-error: true
|
|
uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
|
|
with:
|
|
path: ${{ steps.setup-node-env.outputs.pnpm-store-cache-path }}
|
|
key: ${{ steps.setup-node-env.outputs.pnpm-store-cache-key }}
|
|
|
|
- name: Save Vitest transform cache
|
|
if: ${{ steps.setup-node-env.outputs.cache-mode == 'read-write' && steps.setup-node-env.outputs.vitest-cache-key != '' }}
|
|
continue-on-error: true
|
|
uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
|
|
with:
|
|
path: /var/tmp/openclaw-vitest-fs-cache
|
|
key: ${{ steps.setup-node-env.outputs.vitest-cache-key }}
|
|
|
|
- name: Save Node compile cache
|
|
if: ${{ steps.setup-node-env.outputs.cache-mode == 'read-write' && steps.setup-node-env.outputs.node-compile-cache-key != '' }}
|
|
continue-on-error: true
|
|
uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
|
|
with:
|
|
path: /var/tmp/openclaw-node-compile-cache
|
|
key: ${{ steps.setup-node-env.outputs.node-compile-cache-key }}
|
|
|
|
- name: Save build-all cache
|
|
if: ${{ steps.setup-node-env.outputs.cache-mode == 'read-write' && steps.setup-node-env.outputs.build-all-cache-key != '' }}
|
|
continue-on-error: true
|
|
uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
|
|
with:
|
|
path: .artifacts/build-all-cache
|
|
key: ${{ steps.setup-node-env.outputs.build-all-cache-key }}
|
|
|
|
- name: Save dist build cache
|
|
if: ${{ steps.setup-node-env.outputs.cache-mode == 'read-write' }}
|
|
continue-on-error: true
|
|
uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
|
|
with:
|
|
path: |
|
|
dist/
|
|
dist-runtime/
|
|
packages/*/dist/
|
|
extensions/*/src/host/**/.bundle.hash
|
|
extensions/*/src/host/**/*.bundle.js
|
|
key: ${{ runner.os }}-dist-build-v3-${{ github.sha }}
|