ci: cache package boundary artifacts

This commit is contained in:
Peter Steinberger
2026-04-22 01:42:33 +01:00
parent 5c74e9da01
commit d57fe63ee0
2 changed files with 49 additions and 27 deletions

View File

@@ -1615,6 +1615,45 @@ jobs:
with:
install-bun: "false"
- name: Cache extension package boundary artifacts
id: extension-package-boundary-cache
if: matrix.group == 'extension-package-boundary-compile'
uses: actions/cache@v5
with:
path: |
dist/plugin-sdk
packages/plugin-sdk/dist
extensions/*/dist/.boundary-tsc.tsbuildinfo
extensions/*/dist/.boundary-tsc.stamp
key: ${{ runner.os }}-extension-package-boundary-v1-${{ hashFiles('tsconfig.json', 'tsconfig.plugin-sdk.dts.json', 'packages/plugin-sdk/tsconfig.json', 'scripts/check-extension-package-tsc-boundary.mjs', 'scripts/prepare-extension-package-boundary-artifacts.mjs', 'scripts/write-plugin-sdk-entry-dts.ts', 'scripts/lib/plugin-sdk-entrypoints.json', 'scripts/lib/plugin-sdk-entries.mjs', 'src/channels/plugins/**', 'src/config/types*.ts', 'src/plugin-sdk/**', 'src/types/**', 'src/video-generation/dashscope-compatible.ts', 'src/video-generation/types.ts', 'extensions/**', 'extensions/tsconfig.package-boundary*.json', 'package.json', 'pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-extension-package-boundary-v1-
- name: Preserve extension package boundary cache hit
if: matrix.group == 'extension-package-boundary-compile' && steps.extension-package-boundary-cache.outputs.cache-hit == 'true'
shell: bash
run: |
set -euo pipefail
find extensions \
-path '*/dist' -prune -o \
-path '*/node_modules' -prune -o \
-type f \( -name '*.ts' -o -name '*.tsx' -o -name '*.mts' -o -name '*.cts' -o -name '*.js' -o -name '*.mjs' -o -name '*.json' \) \
-exec touch -t 200001010000 {} +
find src/channels/plugins src/config src/plugin-sdk src/types \
-type f \( -name '*.ts' -o -name '*.tsx' -o -name '*.mts' -o -name '*.cts' -o -name '*.js' -o -name '*.mjs' -o -name '*.json' \) \
-exec touch -t 200001010000 {} +
touch -t 200001010000 \
tsconfig.json \
tsconfig.plugin-sdk.dts.json \
packages/plugin-sdk/tsconfig.json \
scripts/check-extension-package-tsc-boundary.mjs \
scripts/prepare-extension-package-boundary-artifacts.mjs \
scripts/write-plugin-sdk-entry-dts.ts \
scripts/lib/plugin-sdk-entrypoints.json \
scripts/lib/plugin-sdk-entries.mjs \
package.json \
pnpm-lock.yaml
- name: Run additional check shard
env:
ADDITIONAL_CHECK_GROUP: ${{ matrix.group }}
@@ -2188,36 +2227,17 @@ jobs:
uses: actions/cache@v5
with:
path: apps/macos/.build
key: ${{ runner.os }}-swift-build-v1-${{ steps.swift-toolchain.outputs.key }}-${{ hashFiles('apps/macos/Package.swift', 'apps/macos/Package.resolved', 'apps/shared/OpenClawKit/Package.swift', 'Swabble/Package.swift') }}
key: ${{ runner.os }}-swift-build-v2-${{ steps.swift-toolchain.outputs.key }}-${{ hashFiles('apps/macos/Package.swift', 'apps/macos/Package.resolved', 'apps/macos/Sources/**', 'apps/macos/Tests/**', 'apps/shared/OpenClawKit/Package.swift', 'apps/shared/OpenClawKit/Sources/**', 'Swabble/Package.swift', 'Swabble/Sources/**') }}
restore-keys: |
${{ runner.os }}-swift-build-v1-${{ steps.swift-toolchain.outputs.key }}-
- name: Detect Swift input changes
id: swift-inputs
run: |
set -euo pipefail
if git show --pretty=format: --name-only HEAD -- \
apps/macos/Package.swift \
apps/macos/Package.resolved \
apps/macos/Sources \
apps/macos/Tests \
apps/shared/OpenClawKit/Package.swift \
apps/shared/OpenClawKit/Sources \
Swabble/Package.swift \
Swabble/Sources | grep -q .; then
echo "changed=true" >> "$GITHUB_OUTPUT"
else
echo "changed=false" >> "$GITHUB_OUTPUT"
fi
${{ runner.os }}-swift-build-v2-${{ steps.swift-toolchain.outputs.key }}-
- name: Preserve Swift build cache hit
if: steps.swift-build-cache.outputs.cache-hit == 'true' && steps.swift-inputs.outputs.changed == 'false'
if: steps.swift-build-cache.outputs.cache-hit == 'true'
run: |
set -euo pipefail
# When this commit did not touch Swift inputs, checkout mtimes are the
# only reason SwiftPM rebuilds cached products. Keep changed Swift
# commits on the normal rebuild path so stale objects cannot pass.
find apps/macos/Sources apps/macos/Tests apps/shared/OpenClawKit/Sources Swabble/Sources \
# Exact source-hash cache hits already match these inputs; checkout
# mtimes are the only reason SwiftPM rebuilds cached products.
find apps/macos/Sources apps/macos/Tests apps/shared/OpenClawKit/Sources Swabble/Sources apps/macos/.build/checkouts \
-type f -exec touch -t 200001010000 {} +
touch -t 200001010000 \
apps/macos/Package.swift \

View File

@@ -13,6 +13,7 @@ const ROOT_DTS_INPUTS = [
"tsconfig.json",
"tsconfig.plugin-sdk.dts.json",
"src/channels/plugins",
"src/config",
"src/plugin-sdk",
"src/video-generation/dashscope-compatible.ts",
"src/video-generation/types.ts",
@@ -29,6 +30,7 @@ const PACKAGE_DTS_INPUTS = [
"tsconfig.json",
"packages/plugin-sdk/tsconfig.json",
"src/channels/plugins",
"src/config",
"src/plugin-sdk",
"src/video-generation/dashscope-compatible.ts",
"src/video-generation/types.ts",
@@ -250,13 +252,13 @@ export async function main(argv = process.argv.slice(2)) {
const rootDtsFresh =
isArtifactSetFresh({
inputPaths: ROOT_DTS_INPUTS,
outputPaths: [ROOT_DTS_STAMP],
outputPaths: [ROOT_DTS_STAMP, ...ROOT_DTS_REQUIRED_OUTPUTS],
includeFile: isRelevantTypeInput,
}) && !hasMissingOutput(ROOT_DTS_REQUIRED_OUTPUTS);
const packageDtsFresh =
isArtifactSetFresh({
inputPaths: PACKAGE_DTS_INPUTS,
outputPaths: [PACKAGE_DTS_STAMP],
outputPaths: [PACKAGE_DTS_STAMP, ...PACKAGE_DTS_REQUIRED_OUTPUTS],
includeFile: isRelevantTypeInput,
}) && !hasMissingOutput(PACKAGE_DTS_REQUIRED_OUTPUTS);
const entryShimsFresh = isArtifactSetFresh({