@happier-dev/stack 0.1.0-preview.10.1 → 0.1.0-preview.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -27,6 +27,25 @@ function commandExists(cmd) {
|
|
|
27
27
|
return spawnSync('bash', ['-lc', `command -v ${cmd} >/dev/null 2>&1`], { stdio: 'ignore' }).status === 0;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
function runWithHardTimeout({ cmd, args, cwd, env, encoding, maxBuffer, timeoutMs }) {
|
|
31
|
+
if (commandExists('timeout')) {
|
|
32
|
+
const seconds = Math.max(1, Math.ceil(timeoutMs / 1000));
|
|
33
|
+
return spawnSync('timeout', ['--signal=KILL', '--kill-after=30s', `${seconds}s`, cmd, ...args], {
|
|
34
|
+
cwd,
|
|
35
|
+
encoding,
|
|
36
|
+
env,
|
|
37
|
+
maxBuffer,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
return spawnSync(cmd, args, {
|
|
41
|
+
cwd,
|
|
42
|
+
encoding,
|
|
43
|
+
env,
|
|
44
|
+
maxBuffer,
|
|
45
|
+
timeout: timeoutMs,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
30
49
|
function currentTarget() {
|
|
31
50
|
const os = process.platform === 'linux' ? 'linux' : process.platform === 'darwin' ? 'darwin' : '';
|
|
32
51
|
const arch = process.arch === 'x64' ? 'x64' : process.arch === 'arm64' ? 'arm64' : '';
|
|
@@ -65,25 +84,20 @@ test('compiled happier and server binaries execute from isolated cwd', async (t)
|
|
|
65
84
|
const repoRoot = resolve(fileURLToPath(new URL('../../..', import.meta.url)));
|
|
66
85
|
const version = `0.0.0-smoke.${Date.now()}`;
|
|
67
86
|
|
|
68
|
-
const buildCli =
|
|
69
|
-
process.execPath,
|
|
70
|
-
[
|
|
87
|
+
const buildCli = runWithHardTimeout({
|
|
88
|
+
cmd: process.execPath,
|
|
89
|
+
args: [
|
|
71
90
|
'scripts/release/build-cli-binaries.mjs',
|
|
72
91
|
'--channel=preview',
|
|
73
92
|
`--version=${version}`,
|
|
74
93
|
`--targets=${target}`,
|
|
75
94
|
],
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
maxBuffer: 50 * 1024 * 1024,
|
|
83
|
-
// If this ever hangs on CI, fail with a clear timeout rather than blocking the entire suite.
|
|
84
|
-
timeout: 15 * 60 * 1000,
|
|
85
|
-
}
|
|
86
|
-
);
|
|
95
|
+
cwd: repoRoot,
|
|
96
|
+
encoding: 'utf-8',
|
|
97
|
+
env: { ...process.env },
|
|
98
|
+
maxBuffer: 50 * 1024 * 1024,
|
|
99
|
+
timeoutMs: 15 * 60 * 1000,
|
|
100
|
+
});
|
|
87
101
|
assert.equal(buildCli.status, 0, formatSpawnSyncResult(buildCli));
|
|
88
102
|
|
|
89
103
|
const cliArtifactPath = join(repoRoot, 'dist', 'release-assets', 'cli', `happier-v${version}-${target}.tar.gz`);
|
|
@@ -107,23 +121,20 @@ test('compiled happier and server binaries execute from isolated cwd', async (t)
|
|
|
107
121
|
);
|
|
108
122
|
|
|
109
123
|
if (isLinuxTarget(target)) {
|
|
110
|
-
const buildServer =
|
|
111
|
-
process.execPath,
|
|
112
|
-
[
|
|
124
|
+
const buildServer = runWithHardTimeout({
|
|
125
|
+
cmd: process.execPath,
|
|
126
|
+
args: [
|
|
113
127
|
'scripts/release/build-server-binaries.mjs',
|
|
114
128
|
'--channel=preview',
|
|
115
129
|
`--version=${version}`,
|
|
116
130
|
`--targets=${target}`,
|
|
117
131
|
],
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
timeout: 15 * 60 * 1000,
|
|
125
|
-
}
|
|
126
|
-
);
|
|
132
|
+
cwd: repoRoot,
|
|
133
|
+
encoding: 'utf-8',
|
|
134
|
+
env: { ...process.env },
|
|
135
|
+
maxBuffer: 50 * 1024 * 1024,
|
|
136
|
+
timeoutMs: 15 * 60 * 1000,
|
|
137
|
+
});
|
|
127
138
|
assert.equal(buildServer.status, 0, formatSpawnSyncResult(buildServer));
|
|
128
139
|
|
|
129
140
|
const serverArtifactPath = join(repoRoot, 'dist', 'release-assets', 'server', `happier-server-v${version}-${target}.tar.gz`);
|