ci: disable coverage chart generation (#7672)
This commit is contained in:
parent
1f3d726068
commit
ec1238d4fd
|
@ -5,20 +5,20 @@ const find = require('lodash/find')
|
||||||
const round = require('lodash/round')
|
const round = require('lodash/round')
|
||||||
const fs = require('fs/promises')
|
const fs = require('fs/promises')
|
||||||
const { DateTime } = require('luxon')
|
const { DateTime } = require('luxon')
|
||||||
const isPlainObject = require('lodash/isPlainObject')
|
// const isPlainObject = require('lodash/isPlainObject')
|
||||||
|
|
||||||
const dec = new TextDecoder()
|
const dec = new TextDecoder()
|
||||||
|
|
||||||
async function main () {
|
async function main () {
|
||||||
const token = core.getInput('token')
|
const token = core.getInput('token')
|
||||||
const tokenCommon = core.getInput('tokenCommon')
|
// const tokenCommon = core.getInput('tokenCommon')
|
||||||
const inputCovPath = core.getInput('coverageResultsPath') // 'data/coverage-raw.json'
|
const inputCovPath = core.getInput('coverageResultsPath') // 'data/coverage-raw.json'
|
||||||
const outputCovPath = core.getInput('coverageResultsPath') // 'data/coverage.json'
|
const outputCovPath = core.getInput('coverageResultsPath') // 'data/coverage.json'
|
||||||
const outputHistPath = core.getInput('histCoveragePath') // 'data/historical-coverage.json'
|
const outputHistPath = core.getInput('histCoveragePath') // 'data/historical-coverage.json'
|
||||||
const relVersionRaw = core.getInput('version') // 'v7.47.0'
|
const relVersionRaw = core.getInput('version') // 'v7.47.0'
|
||||||
const relVersion = relVersionRaw.indexOf('v') === 0 ? relVersionRaw.substring(1) : relVersionRaw
|
const relVersion = relVersionRaw.indexOf('v') === 0 ? relVersionRaw.substring(1) : relVersionRaw
|
||||||
const gh = github.getOctokit(token)
|
const gh = github.getOctokit(token)
|
||||||
const ghCommon = github.getOctokit(tokenCommon)
|
// const ghCommon = github.getOctokit(tokenCommon)
|
||||||
const owner = github.context.repo.owner // 'ietf-tools'
|
const owner = github.context.repo.owner // 'ietf-tools'
|
||||||
const repo = github.context.repo.repo // 'datatracker'
|
const repo = github.context.repo.repo // 'datatracker'
|
||||||
const sender = github.context.payload.sender.login // 'rjsparks'
|
const sender = github.context.payload.sender.login // 'rjsparks'
|
||||||
|
@ -116,137 +116,137 @@ async function main () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// -> Coverage Chart
|
// -> Coverage Chart
|
||||||
if (chartsDirListing.some(c => c.name === `${newRelease.id}.svg`)) {
|
// if (chartsDirListing.some(c => c.name === `${newRelease.id}.svg`)) {
|
||||||
console.info(`Chart SVG already exists for ${newRelease.name}, skipping...`)
|
// console.info(`Chart SVG already exists for ${newRelease.name}, skipping...`)
|
||||||
} else {
|
// } else {
|
||||||
console.info(`Generating chart SVG for ${newRelease.name}...`)
|
// console.info(`Generating chart SVG for ${newRelease.name}...`)
|
||||||
|
|
||||||
const { ChartJSNodeCanvas } = require('chartjs-node-canvas')
|
// const { ChartJSNodeCanvas } = require('chartjs-node-canvas')
|
||||||
const chartJSNodeCanvas = new ChartJSNodeCanvas({ type: 'svg', width: 850, height: 300, backgroundColour: '#FFFFFF' })
|
// const chartJSNodeCanvas = new ChartJSNodeCanvas({ type: 'svg', width: 850, height: 300, backgroundColour: '#FFFFFF' })
|
||||||
|
|
||||||
// -> Reorder versions
|
// // -> Reorder versions
|
||||||
const versions = []
|
// const versions = []
|
||||||
for (const [key, value] of Object.entries(covData)) {
|
// for (const [key, value] of Object.entries(covData)) {
|
||||||
if (isPlainObject(value)) {
|
// if (isPlainObject(value)) {
|
||||||
const vRel = find(releases, r => r.tag_name === key || r.tag_name === `v${key}`)
|
// const vRel = find(releases, r => r.tag_name === key || r.tag_name === `v${key}`)
|
||||||
if (!vRel) {
|
// if (!vRel) {
|
||||||
continue
|
// continue
|
||||||
}
|
// }
|
||||||
versions.push({
|
// versions.push({
|
||||||
tag: key,
|
// tag: key,
|
||||||
time: vRel.created_at,
|
// time: vRel.created_at,
|
||||||
stats: {
|
// stats: {
|
||||||
code: round(value.code * 100, 2),
|
// code: round(value.code * 100, 2),
|
||||||
template: round(value.template * 100, 2),
|
// template: round(value.template * 100, 2),
|
||||||
url: round(value.url * 100, 2)
|
// url: round(value.url * 100, 2)
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
const roVersions = orderBy(versions, ['time', 'tag'], ['asc', 'asc'])
|
// const roVersions = orderBy(versions, ['time', 'tag'], ['asc', 'asc'])
|
||||||
|
|
||||||
// -> Fill axis + data points
|
// // -> Fill axis + data points
|
||||||
const labels = []
|
// const labels = []
|
||||||
const datasetCode = []
|
// const datasetCode = []
|
||||||
const datasetTemplate = []
|
// const datasetTemplate = []
|
||||||
const datasetUrl = []
|
// const datasetUrl = []
|
||||||
|
|
||||||
for (const ver of roVersions) {
|
// for (const ver of roVersions) {
|
||||||
labels.push(ver.tag)
|
// labels.push(ver.tag)
|
||||||
datasetCode.push(ver.stats.code)
|
// datasetCode.push(ver.stats.code)
|
||||||
datasetTemplate.push(ver.stats.template)
|
// datasetTemplate.push(ver.stats.template)
|
||||||
datasetUrl.push(ver.stats.url)
|
// datasetUrl.push(ver.stats.url)
|
||||||
}
|
// }
|
||||||
|
|
||||||
// -> Generate chart SVG
|
// // -> Generate chart SVG
|
||||||
const outputStream = chartJSNodeCanvas.renderToBufferSync({
|
// const outputStream = chartJSNodeCanvas.renderToBufferSync({
|
||||||
type: 'line',
|
// type: 'line',
|
||||||
options: {
|
// options: {
|
||||||
borderColor: '#CCC',
|
// borderColor: '#CCC',
|
||||||
layout: {
|
// layout: {
|
||||||
padding: 20
|
// padding: 20
|
||||||
},
|
// },
|
||||||
plugins: {
|
// plugins: {
|
||||||
legend: {
|
// legend: {
|
||||||
position: 'bottom',
|
// position: 'bottom',
|
||||||
labels: {
|
// labels: {
|
||||||
font: {
|
// font: {
|
||||||
size: 11
|
// size: 11
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
},
|
// },
|
||||||
scales: {
|
// scales: {
|
||||||
x: {
|
// x: {
|
||||||
ticks: {
|
// ticks: {
|
||||||
font: {
|
// font: {
|
||||||
size: 10
|
// size: 10
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
},
|
// },
|
||||||
y: {
|
// y: {
|
||||||
ticks: {
|
// ticks: {
|
||||||
callback: (value) => {
|
// callback: (value) => {
|
||||||
return `${value}%`
|
// return `${value}%`
|
||||||
},
|
// },
|
||||||
font: {
|
// font: {
|
||||||
size: 10
|
// size: 10
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
},
|
// },
|
||||||
data: {
|
// data: {
|
||||||
labels,
|
// labels,
|
||||||
datasets: [
|
// datasets: [
|
||||||
{
|
// {
|
||||||
label: 'Code',
|
// label: 'Code',
|
||||||
data: datasetCode,
|
// data: datasetCode,
|
||||||
borderWidth: 2,
|
// borderWidth: 2,
|
||||||
borderColor: '#E53935',
|
// borderColor: '#E53935',
|
||||||
backgroundColor: '#C6282833',
|
// backgroundColor: '#C6282833',
|
||||||
fill: false,
|
// fill: false,
|
||||||
cubicInterpolationMode: 'monotone',
|
// cubicInterpolationMode: 'monotone',
|
||||||
tension: 0.4,
|
// tension: 0.4,
|
||||||
pointRadius: 0
|
// pointRadius: 0
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
label: 'Templates',
|
// label: 'Templates',
|
||||||
data: datasetTemplate,
|
// data: datasetTemplate,
|
||||||
borderWidth: 2,
|
// borderWidth: 2,
|
||||||
borderColor: '#039BE5',
|
// borderColor: '#039BE5',
|
||||||
backgroundColor: '#0277BD33',
|
// backgroundColor: '#0277BD33',
|
||||||
fill: false,
|
// fill: false,
|
||||||
cubicInterpolationMode: 'monotone',
|
// cubicInterpolationMode: 'monotone',
|
||||||
tension: 0.4,
|
// tension: 0.4,
|
||||||
pointRadius: 0
|
// pointRadius: 0
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
label: 'URLs',
|
// label: 'URLs',
|
||||||
data: datasetUrl,
|
// data: datasetUrl,
|
||||||
borderWidth: 2,
|
// borderWidth: 2,
|
||||||
borderColor: '#7CB342',
|
// borderColor: '#7CB342',
|
||||||
backgroundColor: '#558B2F33',
|
// backgroundColor: '#558B2F33',
|
||||||
fill: false,
|
// fill: false,
|
||||||
cubicInterpolationMode: 'monotone',
|
// cubicInterpolationMode: 'monotone',
|
||||||
tension: 0.4,
|
// tension: 0.4,
|
||||||
pointRadius: 0
|
// pointRadius: 0
|
||||||
}
|
// }
|
||||||
]
|
// ]
|
||||||
}
|
// }
|
||||||
}, 'image/svg+xml')
|
// }, 'image/svg+xml')
|
||||||
const svg = Buffer.from(outputStream).toString('base64')
|
// const svg = Buffer.from(outputStream).toString('base64')
|
||||||
|
|
||||||
// -> Upload to common repo
|
// // -> Upload to common repo
|
||||||
console.info(`Uploading chart SVG for ${newRelease.name}...`)
|
// console.info(`Uploading chart SVG for ${newRelease.name}...`)
|
||||||
await ghCommon.rest.repos.createOrUpdateFileContents({
|
// await ghCommon.rest.repos.createOrUpdateFileContents({
|
||||||
owner,
|
// owner,
|
||||||
repo: repoCommon,
|
// repo: repoCommon,
|
||||||
path: `assets/graphs/datatracker/${newRelease.id}.svg`,
|
// path: `assets/graphs/datatracker/${newRelease.id}.svg`,
|
||||||
message: `chore: update datatracker release chart for release ${newRelease.name}`,
|
// message: `chore: update datatracker release chart for release ${newRelease.name}`,
|
||||||
content: svg
|
// content: svg
|
||||||
})
|
// })
|
||||||
}
|
// }
|
||||||
|
|
||||||
// -> Add to changelog body
|
// -> Add to changelog body
|
||||||
let formattedBody = ''
|
let formattedBody = ''
|
||||||
|
@ -265,7 +265,7 @@ async function main () {
|
||||||
formattedBody += `}?style=flat-square)`
|
formattedBody += `}?style=flat-square)`
|
||||||
formattedBody += `}?style=flat-square)`
|
formattedBody += `}?style=flat-square)`
|
||||||
formattedBody += `}?style=flat-square)\n\n`
|
formattedBody += `}?style=flat-square)\n\n`
|
||||||
formattedBody += ``
|
// formattedBody += ``
|
||||||
|
|
||||||
core.setOutput('changelog', formattedBody)
|
core.setOutput('changelog', formattedBody)
|
||||||
}
|
}
|
||||||
|
|
10411
dev/coverage-action/package-lock.json
generated
10411
dev/coverage-action/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -8,17 +8,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "1.10.1",
|
"@actions/core": "1.10.1",
|
||||||
"@actions/github": "6.0.0",
|
"@actions/github": "6.0.0",
|
||||||
"chart.js": "3.9.1",
|
|
||||||
"chartjs-node-canvas": "4.1.6",
|
|
||||||
"lodash": "4.17.21",
|
"lodash": "4.17.21",
|
||||||
"luxon": "3.4.4"
|
"luxon": "3.4.4"
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"eslint": "8.57.0",
|
|
||||||
"eslint-config-standard": "17.1.0",
|
|
||||||
"eslint-plugin-import": "2.29.1",
|
|
||||||
"eslint-plugin-node": "11.1.0",
|
|
||||||
"eslint-plugin-promise": "6.1.1",
|
|
||||||
"npm-check-updates": "16.14.18"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue