Skip to content

Commit

Permalink
adding script to create matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
crysmags committed Sep 25, 2024
1 parent c3ba75a commit 226f0ea
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
12 changes: 6 additions & 6 deletions packages/datadog-instrumentations/src/helpers/matrices.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
"16"
],
"range": [
"2.4.2 - 2.6.12",
"3.0.7 - 3.2.7",
"4.0.0 - 4.4.2"
[
"2.4.2 - 2.6.12",
"3.0.7 - 3.2.7",
"4.0.0 - 4.4.2"
]
],
"include": [
{
"node-version": [
"18"
],
"node-version": "18",
"range": [
"4.4.1 - 4.4.2"
]
Expand Down
9 changes: 4 additions & 5 deletions scripts/create_matrix.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,17 @@ function generateMatrix (name) {
const range = []
const plugin = versionsPlugin['node-versions']
for (const version in plugin) {
range.push({ 'node-version': [version], range: plugin[version] })
range.push({ 'node-version': version, range: plugin[version] })
}

for (let ele = 0; ele < range.length; ele++) {
if (ele === 0) {
matrix['node-version'] = range[ele]['node-version']
matrix.range = range[ele].range
matrix['node-version'] = [range[ele]['node-version']]
matrix.range = [range[ele].range]
} else {
matrix.include = [range[ele]]
}
}

matricesJson.matrices[name] = matrix
} else {
matrix = {
Expand All @@ -77,7 +76,7 @@ function generateMatrix (name) {
}
fs.writeFileSync(matricesPath, JSON.stringify(matricesJson, null, 2))
}

generateMatrix('couchbase')
module.exports = {
generateMatrix
}

0 comments on commit 226f0ea

Please sign in to comment.