perf(ci): speed up release builds and Windows packaging (#7975)
This commit is contained in:
1 parent
f70eeeeb06
commit
25dcee00a6
6 files changed
+251
-120
No files matched your search
@@ -100,9 +100,6 @@ jobs:
|
||||
cache: true
|
||||
run-install: true
|
||||
|
||||
- name: Ensure Electron runtime is installed
|
||||
run: vp run --filter @t3tools/desktop ensure:electron
|
||||
|
||||
- id: release_meta
|
||||
name: Resolve release version
|
||||
shell: bash
|
||||
@@ -157,6 +154,40 @@ jobs:
|
||||
fi
|
||||
fi
|
||||
|
||||
- id: previous_tag
|
||||
name: Resolve previous release tag
|
||||
run: |
|
||||
node scripts/resolve-previous-release-tag.ts \
|
||||
--channel "${{ steps.release_meta.outputs.release_channel }}" \
|
||||
--current-tag "${{ steps.release_meta.outputs.tag }}" \
|
||||
--github-output
|
||||
|
||||
quality:
|
||||
name: Release quality checks
|
||||
needs: [preflight]
|
||||
if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' }}
|
||||
runs-on: blacksmith-8vcpu-ubuntu-2404
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
ref: ${{ needs.preflight.outputs.ref }}
|
||||
sparse-checkout: |
|
||||
/*
|
||||
!/.repos/
|
||||
sparse-checkout-cone-mode: false
|
||||
|
||||
- name: Setup Vite+
|
||||
uses: voidzero-dev/setup-vp@v1
|
||||
with:
|
||||
node-version-file: package.json
|
||||
cache: true
|
||||
run-install: true
|
||||
|
||||
- name: Ensure Electron runtime is installed
|
||||
run: vp run --filter @t3tools/desktop ensure:electron
|
||||
|
||||
- name: Check
|
||||
run: vp check
|
||||
|
||||
@@ -166,14 +197,6 @@ jobs:
|
||||
- name: Test
|
||||
run: vp run test
|
||||
|
||||
- id: previous_tag
|
||||
name: Resolve previous release tag
|
||||
run: |
|
||||
node scripts/resolve-previous-release-tag.ts \
|
||||
--channel "${{ steps.release_meta.outputs.release_channel }}" \
|
||||
--current-tag "${{ steps.release_meta.outputs.tag }}" \
|
||||
--github-output
|
||||
|
||||
relay_public_config:
|
||||
name: Resolve T3 Connect public config
|
||||
needs: preflight
|
||||
@@ -385,14 +408,34 @@ jobs:
|
||||
uses: voidzero-dev/setup-vp@v1
|
||||
with:
|
||||
node-version-file: package.json
|
||||
cache: true
|
||||
run-install: |
|
||||
args:
|
||||
- --filter=@t3tools/desktop...
|
||||
- --filter=t3...
|
||||
- --filter=@t3tools/scripts...
|
||||
cache: ${{ matrix.platform != 'win' }}
|
||||
run-install: false
|
||||
|
||||
- name: Resolve Windows package cache path
|
||||
if: matrix.platform == 'win'
|
||||
id: package_cache_path
|
||||
shell: pwsh
|
||||
run: '"path=$(vp pm cache dir)" >> $env:GITHUB_OUTPUT'
|
||||
|
||||
- name: Cache Windows packages
|
||||
if: matrix.platform == 'win'
|
||||
uses: actions/cache@v6
|
||||
with:
|
||||
path: ${{ steps.package_cache_path.outputs.path }}
|
||||
key: windows-release-packages-v1-${{ matrix.arch }}-${{ hashFiles('pnpm-lock.yaml') }}
|
||||
|
||||
- name: Install desktop dependencies
|
||||
run: vp install --filter=@t3tools/desktop... --filter=t3... --filter=@t3tools/scripts...
|
||||
|
||||
- name: Cache resource monitor
|
||||
id: resource_monitor_cache
|
||||
uses: actions/cache@v6
|
||||
with:
|
||||
path: native/resource-monitor/target/${{ matrix.rust_target }}/release/t3-resource-monitor${{ matrix.platform == 'win' && '.exe' || '' }}
|
||||
key: resource-monitor-${{ matrix.rust_target }}-${{ hashFiles('native/resource-monitor/Cargo.lock', 'native/resource-monitor/Cargo.toml', 'native/resource-monitor/src/**') }}
|
||||
|
||||
- name: Setup Rust
|
||||
if: steps.resource_monitor_cache.outputs.cache-hit != 'true'
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
targets: ${{ matrix.rust_target }}
|
||||
@@ -518,6 +561,7 @@ jobs:
|
||||
- name: Build desktop artifact
|
||||
shell: bash
|
||||
env:
|
||||
T3CODE_DESKTOP_REUSE_RESOURCE_MONITOR: ${{ steps.resource_monitor_cache.outputs.cache-hit == 'true' }}
|
||||
CSC_LINK: ${{ secrets.CSC_LINK }}
|
||||
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
|
||||
APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }}
|
||||
@@ -664,8 +708,8 @@ jobs:
|
||||
|
||||
publish_cli:
|
||||
name: Publish CLI to npm
|
||||
needs: [preflight, relay_public_config, build]
|
||||
if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.relay_public_config.result == 'success' && needs.build.result == 'success' }}
|
||||
needs: [preflight, relay_public_config, quality, build]
|
||||
if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.relay_public_config.result == 'success' && needs.quality.result == 'success' && needs.build.result == 'success' }}
|
||||
runs-on: ubuntu-24.04 # blacksmith-8vcpu-ubuntu-2404
|
||||
timeout-minutes: 10
|
||||
permissions:
|
||||
|
||||
@@ -11,7 +11,7 @@ This document covers the unified release workflow for stable and nightly desktop
|
||||
- push tag matching `v*.*.*` for stable releases
|
||||
- scheduled nightly check every three hours
|
||||
- manual `workflow_dispatch` for either channel
|
||||
- Runs quality gates first: lint, typecheck, test.
|
||||
- Runs lint, typecheck, and tests alongside artifact builds. Publishing waits for every check.
|
||||
- Reads the shared production T3 Connect relay URL and Clerk client configuration before packaging clients.
|
||||
- Builds four artifacts in parallel for both channels:
|
||||
- macOS `arm64` DMG
|
||||
@@ -365,6 +365,7 @@ Checklist:
|
||||
4. Push tag.
|
||||
5. Verify workflow steps:
|
||||
- preflight passes
|
||||
- release quality checks pass
|
||||
- all matrix builds pass
|
||||
- `publish_cli` publishes the exact release version before the release job
|
||||
- release job uploads expected files
|
||||
|
||||
Generated
+8
-77
@@ -38,6 +38,14 @@ catalogs:
|
||||
version: 0.2.2
|
||||
|
||||
overrides:
|
||||
'@anthropic-ai/claude-agent-sdk>@anthropic-ai/claude-agent-sdk-darwin-arm64': '-'
|
||||
'@anthropic-ai/claude-agent-sdk>@anthropic-ai/claude-agent-sdk-darwin-x64': '-'
|
||||
'@anthropic-ai/claude-agent-sdk>@anthropic-ai/claude-agent-sdk-linux-arm64': '-'
|
||||
'@anthropic-ai/claude-agent-sdk>@anthropic-ai/claude-agent-sdk-linux-arm64-musl': '-'
|
||||
'@anthropic-ai/claude-agent-sdk>@anthropic-ai/claude-agent-sdk-linux-x64': '-'
|
||||
'@anthropic-ai/claude-agent-sdk>@anthropic-ai/claude-agent-sdk-linux-x64-musl': '-'
|
||||
'@anthropic-ai/claude-agent-sdk>@anthropic-ai/claude-agent-sdk-win32-arm64': '-'
|
||||
'@anthropic-ai/claude-agent-sdk>@anthropic-ai/claude-agent-sdk-win32-x64': '-'
|
||||
'@clerk/backend': 3.14.0
|
||||
'@clerk/clerk-js': 6.29.2
|
||||
'@clerk/clerk-js>@base-org/account': '-'
|
||||
@@ -960,50 +968,6 @@ packages:
|
||||
'@alchemy.run/[email protected]':
|
||||
resolution: {integrity: sha512-5agdhQxWBodxa5hDRyjnpx91RTU3g+qd5fxYB7uNDCaOzB0XC47UU/KHR6zf6jhz/NXf61gJS+vhYwn8NHeRoQ==}
|
||||
|
||||
'@anthropic-ai/[email protected]':
|
||||
resolution: {integrity: sha512-rwfgArIa5WI0QPNqFsRBgvtSI0mrtpynUm0oK6+l6/KX4hcgnYGEzciZR1bOeD9/7sSZlTdIgt+T9alKeZmXcg==}
|
||||
cpu: [arm64]
|
||||
os: [darwin]
|
||||
|
||||
'@anthropic-ai/[email protected]':
|
||||
resolution: {integrity: sha512-0e58h8UQMtsQxLGIv9r4foxfBFWKZ7NeDtoplLhuD7EwQonehomw1sBXCch77t/IfUS+q5vQ5zv+fOGmap5nLQ==}
|
||||
cpu: [x64]
|
||||
os: [darwin]
|
||||
|
||||
'@anthropic-ai/[email protected]':
|
||||
resolution: {integrity: sha512-SRYfQcsXlOq+CD/FqkQBTSHbaD++w73GnnO+NUV9adLYrca3kfetRwWT1iguY1cNS0l34dCR3rlzCPq78vg1Jg==}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
libc: [musl]
|
||||
|
||||
'@anthropic-ai/[email protected]':
|
||||
resolution: {integrity: sha512-gLbaFqcGppFJQd4DLNV4IXoeahejT/p2/M8bSSvRDbla9GOsBr1AxV5XLRyBn1e7xFGozZIAIQr3+1chp7NJgQ==}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@anthropic-ai/[email protected]':
|
||||
resolution: {integrity: sha512-m4+I0qBEk7cxRKS+pL+eoWXbXTFOAo83fQ0tQvap4z/mDMm06IWJtEPoYTaMBwsp32GJWLkHWKbZSBCHZnp2DQ==}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
libc: [musl]
|
||||
|
||||
'@anthropic-ai/[email protected]':
|
||||
resolution: {integrity: sha512-Xl/m7TaSC3T5IDBdHrZQ9fCQYyDmPELN34CL+MoyPIf7uSmuZnjE9fUOqDh2Rv26JxWssi1M6X+BBvVuKd6Cpg==}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@anthropic-ai/[email protected]':
|
||||
resolution: {integrity: sha512-IG+8isJNNJKbnnhO7m+PGhfVCg+XoQ/MDxGde5eigFI0WsEfitjuWSWwx82bT9ghxI1aa6qNvI+UPgPcZuo5Fg==}
|
||||
cpu: [arm64]
|
||||
os: [win32]
|
||||
|
||||
'@anthropic-ai/[email protected]':
|
||||
resolution: {integrity: sha512-7cuqSKbHVItPGVwRbd3A0BEJwcNtc7Fhoh6qHN4C6yrmjSrvdYYx3MLvq/VI768/RoG7mAMDxb+j7WfEfoP9BA==}
|
||||
cpu: [x64]
|
||||
os: [win32]
|
||||
|
||||
'@anthropic-ai/[email protected]':
|
||||
resolution: {integrity: sha512-pAvhfk+iTodXZ6RF18Kz7BEUWFjL7EcR3tKuhUNdPpE1NAYCR3mSHGbafi72JsrNwKEDIs7FU31z3fqhwy8QzA==}
|
||||
engines: {node: '>=18.0.0'}
|
||||
@@ -10546,44 +10510,11 @@ snapshots:
|
||||
|
||||
'@alchemy.run/[email protected]': {}
|
||||
|
||||
'@anthropic-ai/[email protected]':
|
||||
optional: true
|
||||
|
||||
'@anthropic-ai/[email protected]':
|
||||
optional: true
|
||||
|
||||
'@anthropic-ai/[email protected]':
|
||||
optional: true
|
||||
|
||||
'@anthropic-ai/[email protected]':
|
||||
optional: true
|
||||
|
||||
'@anthropic-ai/[email protected]':
|
||||
optional: true
|
||||
|
||||
'@anthropic-ai/[email protected]':
|
||||
optional: true
|
||||
|
||||
'@anthropic-ai/[email protected]':
|
||||
optional: true
|
||||
|
||||
'@anthropic-ai/[email protected]':
|
||||
optional: true
|
||||
|
||||
'@anthropic-ai/[email protected](@anthropic-ai/[email protected]([email protected]))(@modelcontextprotocol/[email protected]([email protected]))([email protected])':
|
||||
dependencies:
|
||||
'@anthropic-ai/sdk': 0.93.0([email protected])
|
||||
'@modelcontextprotocol/sdk': 1.29.0([email protected])
|
||||
zod: 4.4.3
|
||||
optionalDependencies:
|
||||
'@anthropic-ai/claude-agent-sdk-darwin-arm64': 0.3.170
|
||||
'@anthropic-ai/claude-agent-sdk-darwin-x64': 0.3.170
|
||||
'@anthropic-ai/claude-agent-sdk-linux-arm64': 0.3.170
|
||||
'@anthropic-ai/claude-agent-sdk-linux-arm64-musl': 0.3.170
|
||||
'@anthropic-ai/claude-agent-sdk-linux-x64': 0.3.170
|
||||
'@anthropic-ai/claude-agent-sdk-linux-x64-musl': 0.3.170
|
||||
'@anthropic-ai/claude-agent-sdk-win32-arm64': 0.3.170
|
||||
'@anthropic-ai/claude-agent-sdk-win32-x64': 0.3.170
|
||||
|
||||
'@anthropic-ai/[email protected]([email protected])':
|
||||
dependencies:
|
||||
|
||||
@@ -78,6 +78,15 @@ minimumReleaseAgeExclude:
|
||||
- "@legendapp/[email protected]"
|
||||
|
||||
overrides:
|
||||
# The SDK always receives the user's Claude executable, so its bundled binaries are unused.
|
||||
"@anthropic-ai/claude-agent-sdk>@anthropic-ai/claude-agent-sdk-darwin-arm64": "-"
|
||||
"@anthropic-ai/claude-agent-sdk>@anthropic-ai/claude-agent-sdk-darwin-x64": "-"
|
||||
"@anthropic-ai/claude-agent-sdk>@anthropic-ai/claude-agent-sdk-linux-arm64": "-"
|
||||
"@anthropic-ai/claude-agent-sdk>@anthropic-ai/claude-agent-sdk-linux-arm64-musl": "-"
|
||||
"@anthropic-ai/claude-agent-sdk>@anthropic-ai/claude-agent-sdk-linux-x64": "-"
|
||||
"@anthropic-ai/claude-agent-sdk>@anthropic-ai/claude-agent-sdk-linux-x64-musl": "-"
|
||||
"@anthropic-ai/claude-agent-sdk>@anthropic-ai/claude-agent-sdk-win32-arm64": "-"
|
||||
"@anthropic-ai/claude-agent-sdk>@anthropic-ai/claude-agent-sdk-win32-x64": "-"
|
||||
"@clerk/backend": "catalog:"
|
||||
"@clerk/clerk-js": "catalog:"
|
||||
"@clerk/clerk-js>@base-org/account": "-"
|
||||
|
||||
@@ -40,6 +40,7 @@ import {
|
||||
resolveDesktopUpdateChannel,
|
||||
resolveDesktopWebAssetBrand,
|
||||
resolveResourceMonitorRustTargets,
|
||||
resolveWindowsServerAsarIgnoreGlobs,
|
||||
resourceMonitorExecutableName,
|
||||
resolveGitHubPublishConfig,
|
||||
resolveMockUpdateServerPort,
|
||||
@@ -47,6 +48,7 @@ import {
|
||||
resolvePackageManagerUserAgent,
|
||||
stageLinuxIconSize,
|
||||
stageDesktopDmgBackground,
|
||||
stageResourceMonitor,
|
||||
STAGE_INSTALL_ARGS,
|
||||
ancestorNodeModulesPaths,
|
||||
copyDirectoryPreservingSymlinks,
|
||||
@@ -118,7 +120,7 @@ const makeWindowsPayloadFixture = Effect.fn("test.makeWindowsPayloadFixture")(fu
|
||||
yield* fs.writeFileString(nativePath, "native-binary");
|
||||
|
||||
const generatedAsarPath = path.join(tempDir, WINDOWS_SERVER_ASAR_RESOURCE);
|
||||
yield* packWindowsServerAsar({ sourceDir, asarPath: generatedAsarPath });
|
||||
yield* packWindowsServerAsar({ sourceDir, asarPath: generatedAsarPath, arch: "x64" });
|
||||
|
||||
const stageDistDir = path.join(tempDir, "dist");
|
||||
const packagedAppDir = path.join(stageDistDir, "win-unpacked");
|
||||
@@ -488,6 +490,121 @@ it.layer(NodeServices.layer)("build-desktop-artifact", (it) => {
|
||||
}).pipe(Effect.provide(ConfigProvider.layer(ConfigProvider.fromEnv({ env: {} })))),
|
||||
);
|
||||
|
||||
it("excludes node-pty binaries for the other Windows architecture", () => {
|
||||
assert.deepStrictEqual(resolveWindowsServerAsarIgnoreGlobs("x64"), [
|
||||
...WINDOWS_SERVER_ASAR_IGNORE_GLOBS,
|
||||
"**/node_modules/node-pty/prebuilds/win32-arm64",
|
||||
"**/node_modules/node-pty/prebuilds/win32-arm64/**",
|
||||
"**/node_modules/node-pty/third_party/conpty/*/win10-arm64",
|
||||
"**/node_modules/node-pty/third_party/conpty/*/win10-arm64/**",
|
||||
]);
|
||||
assert.deepStrictEqual(resolveWindowsServerAsarIgnoreGlobs("arm64"), [
|
||||
...WINDOWS_SERVER_ASAR_IGNORE_GLOBS,
|
||||
"**/node_modules/node-pty/prebuilds/win32-x64",
|
||||
"**/node_modules/node-pty/prebuilds/win32-x64/**",
|
||||
"**/node_modules/node-pty/third_party/conpty/*/win10-x64",
|
||||
"**/node_modules/node-pty/third_party/conpty/*/win10-x64/**",
|
||||
]);
|
||||
});
|
||||
|
||||
it.effect(
|
||||
"keeps target and WSL native files while excluding the other Windows architecture",
|
||||
() =>
|
||||
Effect.scoped(
|
||||
Effect.gen(function* () {
|
||||
const fs = yield* FileSystem.FileSystem;
|
||||
const path = yield* Path.Path;
|
||||
const tempDir = yield* fs.makeTempDirectoryScoped({
|
||||
prefix: "t3-windows-architecture-test-",
|
||||
});
|
||||
const sourceDir = path.join(tempDir, "server");
|
||||
const nativeFiles = [
|
||||
"node_modules/node-pty/prebuilds/win32-x64/conpty/OpenConsole.exe",
|
||||
"node_modules/node-pty/prebuilds/win32-arm64/conpty/OpenConsole.exe",
|
||||
"node_modules/node-pty/prebuilds/linux-x64/pty.node",
|
||||
"node_modules/node-pty/third_party/conpty/1.0.0/win10-x64/OpenConsole.exe",
|
||||
"node_modules/node-pty/third_party/conpty/1.0.0/win10-arm64/OpenConsole.exe",
|
||||
];
|
||||
|
||||
for (const nativeFile of nativeFiles) {
|
||||
const nativePath = path.join(sourceDir, nativeFile);
|
||||
yield* fs.makeDirectory(path.dirname(nativePath), { recursive: true });
|
||||
yield* fs.writeFileString(nativePath, "native");
|
||||
}
|
||||
|
||||
const asarPath = path.join(tempDir, "server.asar");
|
||||
yield* packWindowsServerAsar({ sourceDir, asarPath, arch: "x64" });
|
||||
const unpackedRoot = `${asarPath}.unpacked`;
|
||||
|
||||
assert.isTrue(
|
||||
yield* fs.exists(
|
||||
path.join(
|
||||
unpackedRoot,
|
||||
"node_modules/node-pty/prebuilds/win32-x64/conpty/OpenConsole.exe",
|
||||
),
|
||||
),
|
||||
);
|
||||
assert.isTrue(
|
||||
yield* fs.exists(
|
||||
path.join(unpackedRoot, "node_modules/node-pty/prebuilds/linux-x64/pty.node"),
|
||||
),
|
||||
);
|
||||
assert.isFalse(
|
||||
yield* fs.exists(
|
||||
path.join(unpackedRoot, "node_modules/node-pty/prebuilds/win32-arm64"),
|
||||
),
|
||||
);
|
||||
assert.isFalse(
|
||||
yield* fs.exists(
|
||||
path.join(unpackedRoot, "node_modules/node-pty/third_party/conpty/1.0.0/win10-arm64"),
|
||||
),
|
||||
);
|
||||
}),
|
||||
),
|
||||
);
|
||||
|
||||
it.effect("stages a cached resource monitor without invoking Cargo", () =>
|
||||
Effect.scoped(
|
||||
Effect.gen(function* () {
|
||||
const fs = yield* FileSystem.FileSystem;
|
||||
const path = yield* Path.Path;
|
||||
const repoRoot = yield* fs.makeTempDirectoryScoped({
|
||||
prefix: "t3-resource-monitor-cache-test-",
|
||||
});
|
||||
const binaryPath = path.join(
|
||||
repoRoot,
|
||||
"native/resource-monitor/target/x86_64-unknown-linux-gnu/release/t3-resource-monitor",
|
||||
);
|
||||
const stageResourcesDir = path.join(repoRoot, "stage");
|
||||
yield* fs.makeDirectory(path.dirname(binaryPath), { recursive: true });
|
||||
yield* fs.writeFileString(binaryPath, "cached monitor");
|
||||
|
||||
yield* stageResourceMonitor({
|
||||
repoRoot,
|
||||
stageResourcesDir,
|
||||
platform: "linux",
|
||||
arch: "x64",
|
||||
verbose: false,
|
||||
}).pipe(
|
||||
Effect.provide(
|
||||
ConfigProvider.layer(
|
||||
ConfigProvider.fromEnv({
|
||||
env: { T3CODE_DESKTOP_REUSE_RESOURCE_MONITOR: "true" },
|
||||
}),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
assert.equal(
|
||||
yield* fs.readFileString(
|
||||
path.join(stageResourcesDir, "resource-monitor/t3-resource-monitor"),
|
||||
),
|
||||
"cached monitor",
|
||||
);
|
||||
}),
|
||||
),
|
||||
);
|
||||
|
||||
it.effect("validates every ASAR-unpacked native in the packaged Windows payload", () =>
|
||||
Effect.scoped(
|
||||
Effect.gen(function* () {
|
||||
@@ -504,6 +621,7 @@ it.layer(NodeServices.layer)("build-desktop-artifact", (it) => {
|
||||
yield* packWindowsServerAsar({
|
||||
sourceDir: fixture.sourceDir,
|
||||
asarPath: secondAsarPath,
|
||||
arch: "x64",
|
||||
});
|
||||
const [firstAsar, secondAsar] = yield* Effect.all([
|
||||
fs.readFile(fixture.generatedAsarPath),
|
||||
|
||||
@@ -819,6 +819,21 @@ export const WINDOWS_SERVER_ASAR_IGNORE_GLOBS = [
|
||||
"**/node_modules/.bin",
|
||||
"**/node_modules/.bin/**",
|
||||
] as const;
|
||||
|
||||
export function resolveWindowsServerAsarIgnoreGlobs(arch: typeof BuildArch.Type) {
|
||||
const unusedArch = arch === "arm64" ? "x64" : "arm64";
|
||||
const unusedPrebuild = `**/node_modules/node-pty/prebuilds/win32-${unusedArch}`;
|
||||
const unusedConpty = `**/node_modules/node-pty/third_party/conpty/*/win10-${unusedArch}`;
|
||||
|
||||
return [
|
||||
...WINDOWS_SERVER_ASAR_IGNORE_GLOBS,
|
||||
unusedPrebuild,
|
||||
`${unusedPrebuild}/**`,
|
||||
unusedConpty,
|
||||
`${unusedConpty}/**`,
|
||||
];
|
||||
}
|
||||
|
||||
export const WINDOWS_PACKAGED_PAYLOAD_FILE_LIMIT = 80;
|
||||
export const WINDOWS_SERVER_RESOURCE_SOURCE_DIR = "apps/desktop/prod-resources/windows-server";
|
||||
export const WINDOWS_SERVER_EXTRA_RESOURCES = [
|
||||
@@ -1643,7 +1658,7 @@ const verifyPackagedBundleIsSelfContained = Effect.fn("verifyPackagedBundleIsSel
|
||||
},
|
||||
);
|
||||
|
||||
const stageResourceMonitor = Effect.fn("stageResourceMonitor")(function* (input: {
|
||||
export const stageResourceMonitor = Effect.fn("stageResourceMonitor")(function* (input: {
|
||||
readonly repoRoot: string;
|
||||
readonly stageResourcesDir: string;
|
||||
readonly platform: typeof BuildPlatform.Type;
|
||||
@@ -1655,28 +1670,33 @@ const stageResourceMonitor = Effect.fn("stageResourceMonitor")(function* (input:
|
||||
const manifestPath = path.join(input.repoRoot, "native/resource-monitor/Cargo.toml");
|
||||
const executableName = resourceMonitorExecutableName(input.platform);
|
||||
const rustTargets = resolveResourceMonitorRustTargets(input.platform, input.arch);
|
||||
const reuseResourceMonitor = yield* Config.boolean("T3CODE_DESKTOP_REUSE_RESOURCE_MONITOR").pipe(
|
||||
Config.withDefault(false),
|
||||
);
|
||||
const builtBinaries: string[] = [];
|
||||
|
||||
for (const rustTarget of rustTargets) {
|
||||
const spawnCommand = yield* resolveSpawnCommand("cargo", [
|
||||
"build",
|
||||
"--locked",
|
||||
"--release",
|
||||
"--manifest-path",
|
||||
manifestPath,
|
||||
"--target",
|
||||
rustTarget,
|
||||
]);
|
||||
yield* runCommand(
|
||||
ChildProcess.make(spawnCommand.command, spawnCommand.args, {
|
||||
cwd: input.repoRoot,
|
||||
shell: spawnCommand.shell,
|
||||
}),
|
||||
{
|
||||
label: `cargo build resource monitor (${rustTarget})`,
|
||||
verbose: input.verbose,
|
||||
},
|
||||
);
|
||||
if (!reuseResourceMonitor) {
|
||||
const spawnCommand = yield* resolveSpawnCommand("cargo", [
|
||||
"build",
|
||||
"--locked",
|
||||
"--release",
|
||||
"--manifest-path",
|
||||
manifestPath,
|
||||
"--target",
|
||||
rustTarget,
|
||||
]);
|
||||
yield* runCommand(
|
||||
ChildProcess.make(spawnCommand.command, spawnCommand.args, {
|
||||
cwd: input.repoRoot,
|
||||
shell: spawnCommand.shell,
|
||||
}),
|
||||
{
|
||||
label: `cargo build resource monitor (${rustTarget})`,
|
||||
verbose: input.verbose,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
const binaryPath = path.join(
|
||||
input.repoRoot,
|
||||
@@ -1693,6 +1713,9 @@ const stageResourceMonitor = Effect.fn("stageResourceMonitor")(function* (input:
|
||||
arch: input.arch,
|
||||
});
|
||||
}
|
||||
if (reuseResourceMonitor) {
|
||||
yield* Effect.log(`[desktop-artifact] Reusing cached resource monitor (${rustTarget}).`);
|
||||
}
|
||||
builtBinaries.push(binaryPath);
|
||||
}
|
||||
|
||||
@@ -2253,6 +2276,7 @@ const stageWslNodePtyPrebuild = Effect.fn("stageWslNodePtyPrebuild")(function* (
|
||||
export const packWindowsServerAsar = Effect.fn("packWindowsServerAsar")(function* (input: {
|
||||
readonly sourceDir: string;
|
||||
readonly asarPath: string;
|
||||
readonly arch: typeof BuildArch.Type;
|
||||
}) {
|
||||
const fs = yield* FileSystem.FileSystem;
|
||||
yield* Effect.tryPromise({
|
||||
@@ -2260,7 +2284,7 @@ export const packWindowsServerAsar = Effect.fn("packWindowsServerAsar")(function
|
||||
createPackageWithOptions(input.sourceDir, input.asarPath, {
|
||||
dot: true,
|
||||
unpack: WINDOWS_SERVER_ASAR_UNPACK_GLOB,
|
||||
globOptions: { ignore: [...WINDOWS_SERVER_ASAR_IGNORE_GLOBS] },
|
||||
globOptions: { ignore: resolveWindowsServerAsarIgnoreGlobs(input.arch) },
|
||||
}),
|
||||
catch: (cause) => new WindowsServerSidecarPackError({ asarPath: input.asarPath, cause }),
|
||||
});
|
||||
@@ -2354,7 +2378,11 @@ export const stageWindowsServerSidecar = Effect.fn("stageWindowsServerSidecar")(
|
||||
|
||||
yield* Effect.log("[desktop-artifact] Packing server.asar...");
|
||||
yield* fs.makeDirectory(path.dirname(input.asarPath), { recursive: true });
|
||||
yield* packWindowsServerAsar({ sourceDir: serverStageDir, asarPath: input.asarPath });
|
||||
yield* packWindowsServerAsar({
|
||||
sourceDir: serverStageDir,
|
||||
asarPath: input.asarPath,
|
||||
arch: input.arch,
|
||||
});
|
||||
const packedStat = yield* fs.stat(input.asarPath);
|
||||
yield* Effect.log(
|
||||
`[desktop-artifact] Packed server.asar (${String(packedStat.size)} bytes) + unpacked natives.`,
|
||||
|
||||
Reference in new issue
Block a user