Skip to content

Commit 969aac5

Browse files
authored
chore(smoke-tests): dispatch workflow run on GitHub Actions from Evergreen COMPASS-8751 (#6727)
* Turn existing CLI multi-command * Add dispatch command * Dispatch on GHA instead of running smoke tests on Evergreen * Print run url on failures * Move ref default to cli.ts * Use expansion to pass --ref * Try using trigger_branch * Add --github-pr-number to derive ref from PR # * Use hadron build info to determine the version * Pass version only for "dev" * Add all build variants as deps of smoketest-packaged-app
1 parent 5ff535f commit 969aac5

File tree

9 files changed

+727
-188
lines changed

9 files changed

+727
-188
lines changed

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

Lines changed: 13 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -60,39 +60,6 @@ const PACKAGE_BUILD_VARIANTS = [
6060
}
6161
];
6262
63-
const SMOKETEST_BUILD_VARIANTS = [
64-
{
65-
name: 'smoketest-ubuntu',
66-
display_name: 'Smoketest Ubuntu',
67-
run_on: 'ubuntu2004-large',
68-
depends_on: 'package-ubuntu',
69-
},
70-
{
71-
name: 'smoketest-windows',
72-
display_name: 'Smoketest Windows',
73-
run_on: 'windows-vsCurrent-large',
74-
depends_on: 'package-windows',
75-
},
76-
{
77-
name: 'smoketest-rhel',
78-
display_name: 'Smoketest RHEL',
79-
run_on: 'rhel80-large',
80-
depends_on: 'package-rhel',
81-
},
82-
{
83-
name: 'smoketest-macos-x64',
84-
display_name: 'Smoketest MacOS Intel',
85-
run_on: 'macos-14-gui',
86-
depends_on: 'package-macos-x64',
87-
},
88-
{
89-
name: 'smoketest-macos-arm',
90-
display_name: 'Smoketest MacOS Arm64',
91-
run_on: 'macos-14-arm64-gui',
92-
depends_on: 'package-macos-arm',
93-
}
94-
];
95-
9663
const TEST_PACKAGED_APP_BUILD_VARIANTS = [
9764
{
9865
name: 'test-packaged-app-ubuntu',
@@ -216,18 +183,18 @@ buildvariants:
216183
<% } %>
217184
<% } %>
218185

219-
<% for (const buildVariant of SMOKETEST_BUILD_VARIANTS) { %>
220-
<% for (const distribution of ['compass']) { %>
221-
- name: <%= buildVariant.name %>-<%= distribution %>
222-
display_name: <%= buildVariant.display_name %> (<%= distribution %>)
223-
run_on: <%= buildVariant.run_on %>
186+
- name: smoketest-packaged-app
187+
display_name: Smoke Test via GitHub Actions
188+
run_on: ubuntu2004-large
224189
depends_on:
225-
- name: package-<%= distribution %>
226-
variant: <%= buildVariant.depends_on %>
190+
<% for (const distribution of COMPASS_DISTRIBUTIONS) { %>
191+
<% for (const buildVariant of PACKAGE_BUILD_VARIANTS) { %>
192+
- name: package-<%= distribution %>
193+
variant: <%= buildVariant.name %>
194+
<% } %>
195+
<% } %>
227196
tasks:
228-
- name: smoketest-<%= distribution %>
229-
<% } %>
230-
<% } %>
197+
- name: smoketest-packaged-app
231198

232199
- name: test-eol-servers
233200
display_name: Test EoL Servers
@@ -468,21 +435,17 @@ tasks:
468435
compass_distribution: <%= distribution %>
469436
<% } %>
470437

471-
<% for (const distribution of ['compass']) { %>
472-
- name: smoketest-<%= distribution %>
438+
- name: smoketest-packaged-app
473439
tags: ['required-for-publish', 'run-on-pr']
474440
commands:
475441
- func: prepare
476442
- func: install
477443
- func: bootstrap
478444
vars:
479-
scope: 'compass-e2e-tests'
480-
- func: smoketest-packaged-app
445+
scope: '@mongodb-js/compass-smoke-tests'
446+
- func: smoketest-on-github-actions
481447
vars:
482-
mongodb_version: <%= LATEST_MAINTAINED_SERVER_VERSION.version %>
483-
compass_distribution: <%= distribution %>
484448
debug: 'compass-e2e-tests*,electron*,hadron*,mongo*'
485-
<% } %>
486449

487450
<% for (const serverVersion of SERVER_VERSIONS) { %>
488451
<% for(const group of E2E_TEST_GROUPS) { %>

.evergreen/buildvariants-and-tasks.yml

Lines changed: 26 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -76,46 +76,42 @@ buildvariants:
7676
- name: package-compass
7777
- name: package-compass-isolated
7878
- name: package-compass-readonly
79-
- name: smoketest-ubuntu-compass
80-
display_name: Smoketest Ubuntu (compass)
79+
- name: smoketest-packaged-app
80+
display_name: Smoke Test via GitHub Actions
8181
run_on: ubuntu2004-large
8282
depends_on:
8383
- name: package-compass
8484
variant: package-ubuntu
85-
tasks:
86-
- name: smoketest-compass
87-
- name: smoketest-windows-compass
88-
display_name: Smoketest Windows (compass)
89-
run_on: windows-vsCurrent-large
90-
depends_on:
9185
- name: package-compass
9286
variant: package-windows
93-
tasks:
94-
- name: smoketest-compass
95-
- name: smoketest-rhel-compass
96-
display_name: Smoketest RHEL (compass)
97-
run_on: rhel80-large
98-
depends_on:
9987
- name: package-compass
10088
variant: package-rhel
101-
tasks:
102-
- name: smoketest-compass
103-
- name: smoketest-macos-x64-compass
104-
display_name: Smoketest MacOS Intel (compass)
105-
run_on: macos-14-gui
106-
depends_on:
10789
- name: package-compass
10890
variant: package-macos-x64
109-
tasks:
110-
- name: smoketest-compass
111-
- name: smoketest-macos-arm-compass
112-
display_name: Smoketest MacOS Arm64 (compass)
113-
run_on: macos-14-arm64-gui
114-
depends_on:
11591
- name: package-compass
11692
variant: package-macos-arm
93+
- name: package-compass-isolated
94+
variant: package-ubuntu
95+
- name: package-compass-isolated
96+
variant: package-windows
97+
- name: package-compass-isolated
98+
variant: package-rhel
99+
- name: package-compass-isolated
100+
variant: package-macos-x64
101+
- name: package-compass-isolated
102+
variant: package-macos-arm
103+
- name: package-compass-readonly
104+
variant: package-ubuntu
105+
- name: package-compass-readonly
106+
variant: package-windows
107+
- name: package-compass-readonly
108+
variant: package-rhel
109+
- name: package-compass-readonly
110+
variant: package-macos-x64
111+
- name: package-compass-readonly
112+
variant: package-macos-arm
117113
tasks:
118-
- name: smoketest-compass
114+
- name: smoketest-packaged-app
119115
- name: test-eol-servers
120116
display_name: Test EoL Servers
121117
run_on: ubuntu1804-large
@@ -508,7 +504,7 @@ tasks:
508504
- func: save-all-artifacts
509505
vars:
510506
compass_distribution: compass-readonly
511-
- name: smoketest-compass
507+
- name: smoketest-packaged-app
512508
tags:
513509
- required-for-publish
514510
- run-on-pr
@@ -517,11 +513,9 @@ tasks:
517513
- func: install
518514
- func: bootstrap
519515
vars:
520-
scope: compass-e2e-tests
521-
- func: smoketest-packaged-app
516+
scope: '@mongodb-js/compass-smoke-tests'
517+
- func: smoketest-on-github-actions
522518
vars:
523-
mongodb_version: 8.0.x-enterprise
524-
compass_distribution: compass
525519
debug: compass-e2e-tests*,electron*,hadron*,mongo*
526520
- name: test-server-40x-community-1
527521
tags:

.evergreen/functions.yml

Lines changed: 8 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -651,14 +651,12 @@ functions:
651651
652652
npm run --unsafe-perm --workspace compass-e2e-tests test-packaged-ci
653653
654-
smoketest-packaged-app:
654+
smoketest-on-github-actions:
655655
- command: github.generate_token
656656
params:
657-
owner: 10gen
658-
repo: compass-mongodb-com
659657
expansion_name: generated_token
660658
permissions: # optional
661-
contents: read
659+
actions: write
662660
- command: shell.exec
663661
# Fail the task if it's idle for 10 mins
664662
timeout_secs: 600
@@ -667,42 +665,17 @@ functions:
667665
shell: bash
668666
env:
669667
<<: *compass-env
670-
<<: *compass-e2e-secrets
671668
DEBUG: ${debug|}
672-
MONGODB_VERSION: ${mongodb_version|}
673-
MONGODB_RUNNER_VERSION: ${mongodb_version|}
674-
HADRON_DISTRIBUTION: ${compass_distribution}
669+
GITHUB_TOKEN: ${generated_token}
675670
script: |
676671
set -e
677672
# Load environment variables
678673
eval $(.evergreen/print-compass-env.sh)
679-
680-
npm i -w packages/compass-smoke-tests https://x-access-token:${generated_token}@github.com/10gen/compass-mongodb-com --engine-strict=false
681-
682-
if [[ "$IS_WINDOWS" == "true" ]]; then
683-
npm run --unsafe-perm --workspace @mongodb-js/compass-smoke-tests start -- --package=windows_setup --tests time-to-first-query
684-
npm run --unsafe-perm --workspace @mongodb-js/compass-smoke-tests start -- --package=windows_zip --tests auto-update-from
685-
npm run --unsafe-perm --workspace @mongodb-js/compass-smoke-tests start -- --package=windows_msi --tests auto-update-from
686-
fi
687-
688-
if [[ "$IS_OSX" == "true" ]]; then
689-
echo "Disabling clipboard usage in e2e tests (TODO: https://jira.mongodb.org/browse/BUILD-14780)"
690-
export COMPASS_E2E_DISABLE_CLIPBOARD_USAGE="true"
691-
# NOTE: We're also skipping auto-update of the macOS app in CI
692-
# because it doesn't work. Running a different test to make sure it
693-
# can install and run successfully at least.
694-
npm run --unsafe-perm --workspace @mongodb-js/compass-smoke-tests start -- --package=osx_zip --tests=time-to-first-query
695-
npm run --unsafe-perm --workspace @mongodb-js/compass-smoke-tests start -- --package=osx_dmg --tests=time-to-first-query
696-
fi
697-
698-
if [[ "$IS_UBUNTU" == "true" ]]; then
699-
npm run --unsafe-perm --workspace @mongodb-js/compass-smoke-tests start -- --package=linux_deb --tests=time-to-first-query
700-
npm run --unsafe-perm --workspace @mongodb-js/compass-smoke-tests start -- --package=linux_tar --tests=time-to-first-query
701-
fi
702-
703-
if [[ "$IS_RHEL" == "true" ]]; then
704-
# npm run --unsafe-perm --workspace @mongodb-js/compass-smoke-tests start -- --package=linux_rpm --tests=time-to-first-query
705-
npm run --unsafe-perm --workspace @mongodb-js/compass-smoke-tests start -- --package=linux_tar --tests=time-to-first-query
674+
# Start the smoke tests on GitHub Actions and wait for successful completion
675+
if [[ "${requester}" == "github_pr" ]]; then
676+
npm run --workspace @mongodb-js/compass-smoke-tests start -- dispatch --github-pr-number ${github_pr_number}
677+
else
678+
npm run --workspace @mongodb-js/compass-smoke-tests start -- dispatch --ref ${branch_name}
706679
fi
707680
708681
test-web-sandbox:

.github/workflows/test-installers.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,14 @@ on:
1414
type: string
1515
description: 'S3 bucket key prefix to download installers from'
1616
required: true
17-
version:
17+
dev_version:
1818
type: string
19-
description: 'Version of the installer to download'
20-
required: true
19+
description: 'Dev version of the installer to download'
20+
nonce:
21+
type: string
22+
description: 'A random string to track the run from dispatch to watching'
23+
24+
run-name: Test Installers ${{ github.event.inputs.dev_version || github.ref_name }} / (nonce = ${{ github.event.inputs.nonce || 'not set' }})
2125

2226
jobs:
2327
test:
@@ -157,7 +161,7 @@ jobs:
157161
- name: Cache downloads
158162
uses: actions/cache@v4
159163
with:
160-
key: smoke-tests-downloads-${{ inputs.version }}-${{ runner.os }}-${{ runner.arch }}-${{ matrix.package }}
164+
key: smoke-tests-downloads-${{ inputs.dev_version || github.ref_name }}-${{ runner.os }}-${{ runner.arch }}-${{ matrix.package }}
161165
path: packages/compass-smoke-tests/.downloads
162166
- name: Install dependencies and build packages
163167
run: npm ci
@@ -190,8 +194,8 @@ jobs:
190194
env:
191195
EVERGREEN_BUCKET_NAME: ${{ inputs.bucket_name }}
192196
EVERGREEN_BUCKET_KEY_PREFIX: ${{ inputs.bucket_key_prefix }}
193-
DEV_VERSION_IDENTIFIER: ${{ inputs.version }}
194197
HADRON_DISTRIBUTION: ${{ matrix.hadron-distribution }}
198+
DEV_VERSION_IDENTIFIER: ${{ inputs.dev_version }}
195199
PLATFORM: ${{ matrix.hadron-platform }}
196200
ARCH: ${{ matrix.arch }}
197201
# Useful to pass a "fake" DISTRO_ID environment to inform the "mongodb-download-url" package

0 commit comments

Comments
 (0)