Skip to content

Commit 1c0eced

Browse files
authored
ci: Fix CI version check (#9039)
1 parent 854ac9a commit 1c0eced

File tree

4 files changed

+189
-898
lines changed

4 files changed

+189
-898
lines changed

.github/workflows/ci-automated-check-environment.yml

+2-8
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,8 @@ jobs:
1717
- name: Setup Node
1818
uses: actions/setup-node@v2
1919
with:
20-
node-version: 14
21-
- name: Cache Node.js modules
22-
uses: actions/cache@v4
23-
with:
24-
path: ~/.npm
25-
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
26-
restore-keys: |
27-
${{ runner.os }}-node-
20+
node-version: 20
21+
cache: 'npm'
2822
- name: Install dependencies
2923
run: npm ci
3024
- name: CI Environments Check

ci/ciCheck.js

+15-20
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
'use strict';
22

33
const CiVersionCheck = require('./CiVersionCheck');
4-
const mongoVersionList = require('mongodb-version-list');
5-
const allNodeVersions = require('all-node-versions');
4+
const { exec } = require('child_process');
65

76
async function check() {
87
// Run checks
@@ -14,12 +13,13 @@ async function check() {
1413
* Check the MongoDB versions used in test environments.
1514
*/
1615
async function checkMongoDbVersions() {
17-
const releasedVersions = await new Promise((resolve, reject) => {
18-
mongoVersionList(function (error, versions) {
16+
const latestStableVersion = await new Promise((resolve, reject) => {
17+
exec('m --latest', (error, stdout) => {
1918
if (error) {
2019
reject(error);
20+
return;
2121
}
22-
resolve(versions);
22+
resolve(stdout.trim());
2323
});
2424
});
2525

@@ -29,37 +29,32 @@ async function checkMongoDbVersions() {
2929
yamlFilePath: './.github/workflows/ci.yml',
3030
ciEnvironmentsKeyPath: 'jobs.check-mongo.strategy.matrix.include',
3131
ciVersionKey: 'MONGODB_VERSION',
32-
releasedVersions,
33-
latestComponent: CiVersionCheck.versionComponents.minor,
34-
ignoreReleasedVersions: [
35-
'<4.0.0', // Versions reached their MongoDB end-of-life support date
36-
'~4.1.0', // Development release according to MongoDB support
37-
'~4.3.0', // Development release according to MongoDB support
38-
'~4.7.0', // Development release according to MongoDB support
39-
],
32+
releasedVersions: [latestStableVersion],
33+
latestComponent: CiVersionCheck.versionComponents.major,
34+
ignoreReleasedVersions: [],
4035
}).check();
4136
}
4237

4338
/**
4439
* Check the Nodejs versions used in test environments.
4540
*/
4641
async function checkNodeVersions() {
47-
const allVersions = await allNodeVersions();
48-
const releasedVersions = allVersions.versions;
42+
const allVersions = (await import('all-node-versions')).default;
43+
const { versions } = await allVersions();
44+
const nodeVersions = versions.map(version => version.node);
4945

5046
await new CiVersionCheck({
5147
packageName: 'Node.js',
5248
packageSupportUrl: 'https://github.com/nodejs/node/blob/master/CHANGELOG.md',
5349
yamlFilePath: './.github/workflows/ci.yml',
5450
ciEnvironmentsKeyPath: 'jobs.check-mongo.strategy.matrix.include',
5551
ciVersionKey: 'NODE_VERSION',
56-
releasedVersions,
52+
releasedVersions: nodeVersions,
5753
latestComponent: CiVersionCheck.versionComponents.minor,
5854
ignoreReleasedVersions: [
59-
'<12.0.0', // These versions have reached their end-of-life support date
60-
'>=13.0.0 <14.0.0', // These versions have reached their end-of-life support date
61-
'>=15.0.0 <16.0.0', // These versions have reached their end-of-life support date
62-
'>=19.0.0', // These versions are not officially supported yet
55+
'<18.0.0', // These versions have reached their end-of-life support date
56+
'>=19.0.0 <20.0.0', // These versions have reached their end-of-life support date
57+
'>=21.0.0', // These versions are not officially supported yet
6358
],
6459
}).check();
6560
}

0 commit comments

Comments
 (0)