Skip to content

Commit 289f2f7

Browse files
committed
Merge branch 'main' into autoupdate-from3
2 parents 99d9aa1 + 5fc97c6 commit 289f2f7

File tree

7 files changed

+99
-22
lines changed

7 files changed

+99
-22
lines changed

.evergreen/buildvariants-and-tasks.in.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,12 @@ const SMOKETEST_BUILD_VARIANTS = [
6767
// run_on: 'ubuntu2004-large',
6868
// depends_on: 'package-ubuntu',
6969
// },
70-
71-
// {
72-
// name: 'smoketest-windows',
73-
// display_name: 'Smoketest Windows',
74-
// run_on: 'windows-vsCurrent-large',
75-
// depends_on: 'package-windows',
76-
// },
70+
{
71+
name: 'smoketest-windows',
72+
display_name: 'Smoketest Windows',
73+
run_on: 'windows-vsCurrent-large',
74+
depends_on: 'package-windows',
75+
},
7776
// {
7877
// name: 'smoketest-rhel',
7978
// display_name: 'Smoketest RHEL',

.evergreen/buildvariants-and-tasks.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,14 @@ buildvariants:
7676
- name: package-compass
7777
- name: package-compass-isolated
7878
- name: package-compass-readonly
79+
- name: smoketest-windows-compass
80+
display_name: Smoketest Windows (compass)
81+
run_on: windows-vsCurrent-large
82+
depends_on:
83+
- name: package-compass
84+
variant: package-windows
85+
tasks:
86+
- name: smoketest-compass
7987
- name: smoketest-macos-x64-compass
8088
display_name: Smoketest MacOS Intel (compass)
8189
run_on: macos-14-gui

.evergreen/functions.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -705,17 +705,17 @@ functions:
705705
# Load environment variables
706706
eval $(.evergreen/print-compass-env.sh)
707707
708-
#if [[ "$IS_WINDOWS" == "true" ]]; then
708+
if [[ "$IS_WINDOWS" == "true" ]]; then
709709
# TODO: windows_setup
710710
# TODO: windows_msi
711-
# TODO: windows_zip
712-
#fi
711+
npm run --unsafe-perm --workspace @mongodb-js/compass-smoke-tests start -- --package=windows_zip
712+
fi
713713
714714
if [[ "$IS_OSX" == "true" ]]; then
715715
echo "Disabling clipboard usage in e2e tests (TODO: https://jira.mongodb.org/browse/BUILD-14780)"
716716
export COMPASS_E2E_DISABLE_CLIPBOARD_USAGE="true"
717717
npm run --unsafe-perm --workspace @mongodb-js/compass-smoke-tests start -- --package=osx_dmg
718-
# TODO: osx_zip
718+
npm run --unsafe-perm --workspace @mongodb-js/compass-smoke-tests start -- --package=osx_zip
719719
fi
720720
721721
#if [[ "$IS_UBUNTU" == "true" ]]; then

.github/workflows/update-electron.yaml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ name: Update electron
44
on:
55
workflow_dispatch:
66
schedule:
7-
- cron: "0 0 * * *"
7+
- cron: '0 0 * * *'
88

99
jobs:
1010
update_generated_files:
@@ -27,7 +27,7 @@ jobs:
2727
- uses: actions/setup-node@v4
2828
with:
2929
node-version: 20.16.0
30-
cache: "npm"
30+
cache: 'npm'
3131

3232
- name: Install [email protected]
3333
run: |
@@ -43,10 +43,9 @@ jobs:
4343
uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # 7.0.5
4444
with:
4545
token: ${{ steps.app-token.outputs.token }}
46-
commit-message: "chore(deps): update electron"
46+
commit-message: 'chore(deps): update electron'
4747
branch: ci/update-electron
48-
title: "chore(deps): update electron"
48+
title: 'chore(deps): update electron'
4949
labels: no-title-validation
5050
body: |
5151
- Update electron
52-
author: "${{ steps.app-token.outputs.app-slug }}[bot]"

packages/compass-smoke-tests/src/build-info.ts

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,27 +41,65 @@ export const windowsFilenameKeys = [
4141
'windows_nupkg_full_filename',
4242
] as const;
4343
export type WindowsBuildInfo = CommonBuildInfo &
44-
Record<typeof windowsFilenameKeys[number], string>;
44+
Record<typeof windowsFilenameKeys[number], string> & {
45+
installerOptions: {
46+
name: string;
47+
};
48+
};
4549

4650
export function assertBuildInfoIsWindows(
4751
buildInfo: unknown
4852
): asserts buildInfo is WindowsBuildInfo {
4953
assertObjectHasKeys(buildInfo, 'buildInfo', commonKeys);
5054
assertObjectHasKeys(buildInfo, 'buildInfo', windowsFilenameKeys);
55+
assert(typeof buildInfo === 'object', 'Expected buildInfo to be an object');
56+
assert(buildInfo !== null, 'Expected buildInfo to be an object');
57+
assert(
58+
'installerOptions' in buildInfo &&
59+
typeof buildInfo.installerOptions === 'object',
60+
'Expected buildInfo.installerOptions to be an object'
61+
);
62+
const { installerOptions } = buildInfo;
63+
assert(
64+
typeof installerOptions === 'object' &&
65+
installerOptions !== null &&
66+
'name' in installerOptions &&
67+
typeof installerOptions.name === 'string',
68+
'Expected buildInfo.installerOptions.name to be a string'
69+
);
5170
}
5271

5372
export const osxFilenameKeys = [
5473
'osx_dmg_filename',
5574
'osx_zip_filename',
5675
] as const;
5776
export type OSXBuildInfo = CommonBuildInfo &
58-
Record<typeof osxFilenameKeys[number], string>;
77+
Record<typeof osxFilenameKeys[number], string> & {
78+
installerOptions: {
79+
title: string;
80+
};
81+
};
5982

6083
export function assertBuildInfoIsOSX(
6184
buildInfo: unknown
6285
): asserts buildInfo is OSXBuildInfo {
6386
assertObjectHasKeys(buildInfo, 'buildInfo', commonKeys);
6487
assertObjectHasKeys(buildInfo, 'buildInfo', osxFilenameKeys);
88+
assert(typeof buildInfo === 'object', 'Expected buildInfo to be an object');
89+
assert(buildInfo !== null, 'Expected buildInfo to be an object');
90+
assert(
91+
'installerOptions' in buildInfo &&
92+
typeof buildInfo.installerOptions === 'object',
93+
'Expected buildInfo.installerOptions to be an object'
94+
);
95+
const { installerOptions } = buildInfo;
96+
assert(
97+
typeof installerOptions === 'object' &&
98+
installerOptions !== null &&
99+
'title' in installerOptions &&
100+
typeof installerOptions.title === 'string',
101+
'Expected buildInfo.installerOptions.title to be a string'
102+
);
65103
}
66104

67105
export const ubuntuFilenameKeys = [
@@ -93,6 +131,7 @@ export type PackageDetails = {
93131
kind: PackageKind;
94132
filename: string;
95133
autoUpdatable: boolean;
134+
appName: string;
96135
} & (
97136
| {
98137
kind: 'windows_setup' | 'windows_msi' | 'windows_zip';
@@ -129,6 +168,7 @@ export function getPackageDetails(
129168
kind,
130169
buildInfo,
131170
filename: buildInfo[`${kind}_filename`],
171+
appName: buildInfo.installerOptions.name,
132172
autoUpdatable: kind === 'windows_setup',
133173
};
134174
} else if (kind === 'osx_dmg' || kind === 'osx_zip') {
@@ -137,6 +177,7 @@ export function getPackageDetails(
137177
kind,
138178
buildInfo,
139179
filename: buildInfo[`${kind}_filename`],
180+
appName: buildInfo.installerOptions.title,
140181
autoUpdatable: true,
141182
};
142183
} else if (kind === 'linux_deb' || kind === 'linux_tar') {
@@ -145,6 +186,7 @@ export function getPackageDetails(
145186
kind,
146187
buildInfo,
147188
filename: buildInfo[`${kind}_filename`],
189+
appName: buildInfo.productName,
148190
autoUpdatable: false,
149191
};
150192
} else if (kind === 'linux_rpm' || kind === 'rhel_tar') {
@@ -153,6 +195,7 @@ export function getPackageDetails(
153195
kind,
154196
buildInfo,
155197
filename: buildInfo[`${kind}_filename`],
198+
appName: buildInfo.productName,
156199
autoUpdatable: false,
157200
};
158201
} else {

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import kill from 'tree-kill';
88
import yargs from 'yargs';
99
import { hideBin } from 'yargs/helpers';
1010
import { pick } from 'lodash';
11-
import { installMacDMG } from './installers/mac-dmg';
1211
import { execute } from './execute';
1312
import {
1413
type PackageDetails,
@@ -19,7 +18,10 @@ import { createSandbox } from './directories';
1918
import { downloadFile } from './downloads';
2019
import { type PackageKind, SUPPORTED_PACKAGES } from './packages';
2120
import { type SmokeTestsContext } from './context';
21+
22+
import { installMacDMG } from './installers/mac-dmg';
2223
import { installMacZIP } from './installers/mac-zip';
24+
import { installWindowsZIP } from './installers/windows-zip';
2325

2426
const SUPPORTED_PLATFORMS = ['win32', 'darwin', 'linux'] as const;
2527
const SUPPORTED_ARCHS = ['x64', 'arm64'] as const;
@@ -152,6 +154,8 @@ function getInstaller(kind: PackageKind) {
152154
return installMacDMG;
153155
} else if (kind === 'osx_zip') {
154156
return installMacZIP;
157+
} else if (kind === 'windows_zip') {
158+
return installWindowsZIP;
155159
} else {
156160
throw new Error(`Installer for '${kind}' is not yet implemented`);
157161
}
@@ -177,14 +181,12 @@ async function run() {
177181
])
178182
);
179183

180-
const { kind, buildInfo, filepath, autoUpdatable } = await getTestSubject(
184+
const { kind, filepath, appName, autoUpdatable } = await getTestSubject(
181185
context
182186
);
183187
const install = getInstaller(kind);
184188

185189
try {
186-
const appName = buildInfo.productName;
187-
188190
const { appPath, uninstall } = install({
189191
appName,
190192
filepath,
@@ -286,6 +288,8 @@ function runTest({
286288
'--test-filter=auto-update',
287289
],
288290
{
291+
// We need to use a shell to get environment variables setup correctly
292+
shell: true,
289293
env: {
290294
...process.env,
291295
HADRON_AUTO_UPDATE_ENDPOINT_OVERRIDE: 'http://localhost:8080',
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)