Compare commits

...

1 Commits

Author SHA1 Message Date
Simon Genin (ges) 2042f2ec01 [IMP] release: add coverage report to gh pages. 2021-10-02 15:49:01 +02:00
3 changed files with 46 additions and 3 deletions
+3 -1
View File
@@ -31,4 +31,6 @@ release-notes.md
.rpt2_cache .rpt2_cache
# useful in some cases # useful in some cases
/temp /temp
coverage
+3 -1
View File
@@ -76,7 +76,9 @@
"jsx", "jsx",
"json", "json",
"node" "node"
] ],
"collectCoverage": true,
"coverageReporters": ["html"]
}, },
"prettier": { "prettier": {
"printWidth": 100, "printWidth": 100,
+40 -1
View File
@@ -62,6 +62,9 @@ async function startRelease() {
} }
let shouldUploadPlayground = await ask(`Should this release be uploaded on the playground [y/n] ? (y)`); let shouldUploadPlayground = await ask(`Should this release be uploaded on the playground [y/n] ? (y)`);
shouldUploadPlayground = shouldUploadPlayground.toLowerCase() !== 'n'; shouldUploadPlayground = shouldUploadPlayground.toLowerCase() !== 'n';
let shouldUploadPCoverageReport = await ask(`Should this release coverage report be published [y/n] ? (y)`);
shouldUploadPCoverageReport = shouldUploadPCoverageReport.toLowerCase() !== 'n';
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
log(`Step 2/${STEPS}: running tests...`); log(`Step 2/${STEPS}: running tests...`);
@@ -122,7 +125,7 @@ async function startRelease() {
if (shouldUploadPlayground) { if (shouldUploadPlayground) {
log(`Bonus step: publishing new release on playground...`); log(`Bonus step: publishing new release on playground...`);
let owl_code = null; let owl_code = null;
status = 0 let status = 0
try { try {
owl_code = await readFile("dist/owl.iife.js"); owl_code = await readFile("dist/owl.iife.js");
@@ -153,6 +156,42 @@ async function startRelease() {
logError("Something went wrong for the playground update.") logError("Something went wrong for the playground update.")
} }
} }
if (shouldUploadPCoverageReport) {
let status = 0
log(`Bonus step: publishing new coverage report...`);
if (!fs.existsSync("./coverage")) {
logError("Couldn't update coverage report, there is no coverage folder on master.")
return;
}
status += await execCommand("git stash push -a -- coverage");
if (status !== 0) {
logError("Couldn't stash coverage")
return;
}
status += await execCommand("git checkout gh-pages");
if (status !== 0) {
logError("Couldn't switch to gh-pages branch")
return;
}
status += await execCommand("rm -rf coverage");
status += await execCommand("git stash pop");
status += await execCommand("git add coverage");
status += await execCommand(`git commit -m "[IMP] update coverage report for owl v${next}"`);
status += await execCommand(`git push origin gh-pages`);
status += await execCommand("git checkout -");
if (status !== 0) {
logError("Something went wrong for the coverage report update.")
}
}
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------