Skip to content

Commit 34d56fe

Browse files
committed
Implement Windows ZIP installer
1 parent 8129314 commit 34d56fe

File tree

2 files changed

+30
-2
lines changed

2 files changed

+30
-2
lines changed

packages/compass-smoke-tests/src/cli.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import path from 'node:path';
66
import yargs from 'yargs';
77
import { hideBin } from 'yargs/helpers';
88
import { pick } from 'lodash';
9-
import { installMacDMG } from './installers/mac-dmg';
109
import { execute } from './execute';
1110
import {
1211
type PackageDetails,
@@ -17,7 +16,10 @@ import { createSandbox } from './directories';
1716
import { downloadFile } from './downloads';
1817
import { type PackageKind, SUPPORTED_PACKAGES } from './packages';
1918
import { type SmokeTestsContext } from './context';
19+
20+
import { installMacDMG } from './installers/mac-dmg';
2021
import { installMacZIP } from './installers/mac-zip';
22+
import { installWindowsZIP } from './installers/windows-zip';
2123

2224
const SUPPORTED_PLATFORMS = ['win32', 'darwin', 'linux'] as const;
2325
const SUPPORTED_ARCHS = ['x64', 'arm64'] as const;
@@ -150,6 +152,8 @@ function getInstaller(kind: PackageKind) {
150152
return installMacDMG;
151153
} else if (kind === 'osx_zip') {
152154
return installMacZIP;
155+
} else if (kind === 'windows_zip') {
156+
return installWindowsZIP;
153157
} else {
154158
throw new Error(`Installer for '${kind}' is not yet implemented`);
155159
}
@@ -192,7 +196,7 @@ async function run() {
192196
}
193197
} finally {
194198
console.log('Cleaning up sandbox');
195-
// fs.rmSync(context.sandboxPath, { recursive: true });
199+
fs.rmSync(context.sandboxPath, { recursive: true });
196200
}
197201
}
198202

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import path from 'node:path';
2+
3+
import type { InstalledAppInfo, InstallablePackage } from './types';
4+
import { execute } from '../execute';
5+
6+
export function installWindowsZIP({
7+
appName,
8+
filepath,
9+
destinationPath,
10+
}: InstallablePackage): InstalledAppInfo {
11+
const appPath = path.resolve(destinationPath, `${appName}.exe`);
12+
13+
execute('unzip', [filepath, '-d', destinationPath]);
14+
15+
// see if the executable will run without being quarantined or similar
16+
execute(appPath, ['--version']);
17+
18+
return {
19+
appPath: destinationPath,
20+
uninstall: async function () {
21+
/* TODO */
22+
},
23+
};
24+
}

0 commit comments

Comments
 (0)