为全部 Rust 测试组启用隔离编译缓存
Project CI / Backend tests (pull_request) Has been cancelled
Project CI / Native shell tests (pull_request) Has been cancelled
Project CI / Frontend tests (pull_request) Has been cancelled
Project CI / Repository checks (pull_request) Has been cancelled
Project CI / AI game creator shell web tests (pull_request) Has been cancelled
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Has been cancelled
Project CI / AI game creator shell Rust crates (pull_request) Has been cancelled
Project CI / AI game creator shell Rust smoke (pull_request) Has been cancelled
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Has been cancelled
Project CI / AI game creator shell Rust crates (push) Successful in 1m22s
Project CI / AI game creator shell Rust smoke (push) Successful in 1m51s
Project CI / Backend tests (push) Successful in 5m35s
Project CI / AI game creator shell Rust lane 2/2 (push) Successful in 7m8s
Project CI / AI game creator shell Rust lane 1/2 (push) Successful in 8m11s
Project CI / Native shell tests (push) Successful in 7m6s
Project CI / Frontend tests (push) Successful in 3m30s
Project CI / Repository checks (push) Successful in 3m28s
Project CI / AI game creator shell web tests (push) Successful in 3m7s

扩展缓存消费到 AGC 双 lane、crates、smoke、后端及桌面壳测试
补齐各组实际编译目标和工作目录的可信快照预热
保留 SpacetimeDB 独立编译边界并排除发布构建缓存
根据完整快照体积将对象缓存上限调整为 4 GiB
更新工作流契约测试、运维文档及项目共享记忆
This commit was merged in pull request #459.
This commit is contained in:
2026-09-22 05:52:16 +00:00
parent 48eb3d5007
commit 292e42cf5e
8 changed files with 159 additions and 33 deletions
+43 -3
View File
@@ -63,9 +63,49 @@ source "${GITHUB_ENV}"
set +a
test -n "${RUSTC_WRAPPER}"
trap 'bash /tmp/ci-rust-cache.sh report' EXIT
cd apps/ai-game-creator-shell/src-tauri
cargo test --locked --manifest-path Cargo.toml \
--bin genarrative-ai-game-creator-shell --no-run
# 与 CI 的工作目录、features 和目标逐项对齐,只编译,不运行测试/应用。
echo '[rust-cache] warming backend tests and checks'
cargo test --locked --workspace --exclude spacetime-module --no-fail-fast \
--manifest-path server-rs/Cargo.toml --no-run
cargo test --locked -p spacetime-module --no-fail-fast \
--manifest-path server-rs/Cargo.toml --no-run
cargo check --locked -p api-server --all-targets --manifest-path server-rs/Cargo.toml
cargo check --locked -p spacetime-module --manifest-path server-rs/Cargo.toml
echo '[rust-cache] warming AGC standalone, shared and plugin crates'
for manifest in \
server-rs/crates/agent-runtime-core/Cargo.toml \
server-rs/crates/agent-runtime-orchestration/Cargo.toml \
plugins/agc-cocos-editor/native/cocos-editor-bridge/Cargo.toml; do
# 与 CI 一样,这些 crate 没有已提交的独立 Cargo.lock。
cargo test --manifest-path "${manifest}" --no-run
done
cargo test --locked -p platform-llm --manifest-path server-rs/Cargo.toml --no-run
cargo test --locked -p shared-contracts --manifest-path server-rs/Cargo.toml --no-run
for editor in unity godot; do
cargo test --locked --manifest-path "plugins/agc-${editor}-editor/native/${editor}-editor-bridge/Cargo.toml" --no-run
done
echo '[rust-cache] warming desktop tests and AGC prompt contracts'
cargo test --manifest-path apps/desktop-shell/src-tauri/Cargo.toml --no-run
cargo test --locked --manifest-path apps/ai-game-creator-shell/src-tauri/Cargo.toml \
--test runtime_prompt_bundle_build --test prompt_source_boundaries --no-run
# Cargo 的 fresh 判断不保证不同 cwd 都经过 sccache;先清掉临时容器中的 target。
cargo clean --manifest-path apps/ai-game-creator-shell/src-tauri/Cargo.toml
echo '[rust-cache] warming AGC Rust lanes'
(
cd apps/ai-game-creator-shell/src-tauri
cargo test --locked --manifest-path Cargo.toml \
--bin genarrative-ai-game-creator-shell --no-run
)
cargo clean --manifest-path apps/ai-game-creator-shell/src-tauri/Cargo.toml
echo '[rust-cache] warming AGC agent-run smoke executable'
(
cd apps/ai-game-creator-shell
cargo build --manifest-path src-tauri/Cargo.toml
)
du -sh /opt/genarrative-ci/rust-cache/objects
WARM
docker cp "${container_id}:/opt/genarrative-ci/rust-cache/." "${work_dir}/snapshot/"
docker rm -f "${container_id}" >/dev/null
+1 -1
View File
@@ -12,7 +12,7 @@ configure_local_cache() {
for variable in ${!SCCACHE_@}; do unset "${variable}"; done
export SCCACHE_CONF="${state}/config"
export SCCACHE_DIR="${cache_root}/objects"
export SCCACHE_CACHE_SIZE=2G
export SCCACHE_CACHE_SIZE=4G
export SCCACHE_SERVER_UDS="${state}/server.sock"
# 单个不可缓存的链接/测试阶段可能超过一分钟;保持统计直到 report 显式停止。
export SCCACHE_IDLE_TIMEOUT=0
+62 -16
View File
@@ -142,23 +142,45 @@ function backendStepIndex(stepName: string) {
}
describe('project CI workflow', () => {
it('trials isolated compilation caching only in AGC Rust lane 1', () => {
const lane = jobSection('ai-game-creator-shell-rust-lane-1');
expect(lane).toContain('node --test scripts/ci-rust-cache.test.mjs');
expect(lane.indexOf('bash scripts/ci-rust-cache.sh prepare')).toBeLessThan(
lane.indexOf('npm run check:native-shells:agc-rust-shard-1'),
);
expect(
stepSection(
'ai-game-creator-shell-rust-lane-1',
'Report isolated Rust compilation cache',
),
).toContain('if: always()');
for (const job of jobNames.filter(
(name) => name !== 'ai-game-creator-shell-rust-lane-1',
)) {
expect(jobSection(job)).not.toContain('ci-rust-cache.sh');
it('uses isolated compilation caching for every Rust test job', () => {
const firstRustSteps = {
'ai-game-creator-shell-rust-lane-1':
'Run AI game creator shell Rust shard 1/4',
'ai-game-creator-shell-rust-lane-2':
'Run AI game creator shell Rust shard 3/4',
'ai-game-creator-shell-rust-smoke':
'Run AI game creator shell agent-run smoke',
'ai-game-creator-shell-rust-crates':
'Run AI game creator shell shared crate gates',
'backend-tests': 'Run server-rs workspace tests',
'native-shell-tests': 'Run native shell gates',
};
for (const job of jobNames) {
const section = jobSection(job);
if (!(job in firstRustSteps)) {
expect(section).not.toContain('ci-rust-cache.sh');
continue;
}
const firstRustStep = firstRustSteps[job as keyof typeof firstRustSteps];
const prepare = section.indexOf('bash scripts/ci-rust-cache.sh prepare');
expect(prepare).toBeGreaterThan(
section.indexOf('Checkout full history from Gitea'),
);
expect(prepare).toBeLessThan(section.indexOf(`- name: ${firstRustStep}`));
expect(
stepSection(job, 'Report isolated Rust compilation cache'),
).toContain('if: always()');
}
// 缓存自身的行为测试只执行一次,避免随 job 数量重复运行。
expect(
workflow.match(/node --test scripts\/ci-rust-cache.test.mjs/g),
).toHaveLength(1);
const releaseStep = stepSection(
'native-shell-tests',
'Run native shell release build smoke',
);
expect(releaseStep).toContain("RUSTC_WRAPPER: ''");
expect(releaseStep).toContain("CARGO_BUILD_RUSTC_WRAPPER: ''");
expect(workflow).toContain("CARGO_INCREMENTAL: '0'");
expect(workflow).toContain("RUSTC_WRAPPER: ''");
for (const [, name, value] of workflow
@@ -170,6 +192,30 @@ describe('project CI workflow', () => {
}
});
it('warms backend targets without merging the SpacetimeDB feature boundary', () => {
const warmCommands = rustCacheBuildScript
.replace(/\\\r?\n/g, '')
.replace(/\s+/g, ' ');
for (const [, command] of jobSection('backend-tests').matchAll(
/run: (cargo [^\n]+)/g,
)) {
expect(warmCommands).toContain(command.trim());
}
expect(warmCommands).toContain(
'cargo test --locked --workspace --exclude spacetime-module --no-fail-fast --manifest-path server-rs/Cargo.toml --no-run',
);
expect(warmCommands).toContain(
'cargo test --locked -p spacetime-module --no-fail-fast --manifest-path server-rs/Cargo.toml --no-run',
);
expect(warmCommands).toContain('cd apps/ai-game-creator-shell/src-tauri');
expect(warmCommands).toContain(
'cd apps/ai-game-creator-shell cargo build --manifest-path src-tauri/Cargo.toml',
);
expect(warmCommands).toContain(
'cargo test --manifest-path apps/desktop-shell/src-tauri/Cargo.toml --no-run',
);
});
it('runs for master pushes, pull requests, and manual dispatch only', () => {
expect(workflow).toMatch(
/on:\n {2}push:\n {4}branches:\n {6}- master\n {2}pull_request:\n {2}workflow_dispatch:/u,