Skip to content

Commit

Permalink
Merge pull request #928 from koopjs/ci/fix-ci-tests
Browse files Browse the repository at this point in the history
chore: ci adjustments
  • Loading branch information
rgwozdz authored Feb 26, 2024
2 parents 9e5c2e2 + 3e7aca9 commit 26a42d6
Show file tree
Hide file tree
Showing 16 changed files with 466 additions and 566 deletions.
146 changes: 1 addition & 145 deletions .coverage_json/coverage-summary.json

Large diffs are not rendered by default.

5 changes: 0 additions & 5 deletions .github/workflows/ci-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ jobs:
steps:
- name: Checkout actions
uses: actions/checkout@v3
with:
fetch-depth: 0
- run: |
git checkout -b master origin/master
git checkout -

- uses: actions/setup-node@v3
with:
Expand Down
7 changes: 4 additions & 3 deletions ci/format-branch-coverage-changes.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const { writeFileSync, existsSync } = require('fs');
const json2md = require('json2md');
const coverageSummary = require('../.coverage_json/coverage-summary.json');

const markdownFilePath = '.branch-coverage-changes.md';

if (!existsSync('.coverage_changes_json/coverage-summary.json')) {
Expand All @@ -16,10 +17,10 @@ const rows = Object.entries(coverageChangesSummary)
return filePath !== 'total';
})
.map(([filePath, changesCoverage]) => {
const masterCoverage = coverageSummary[filePath];
const packagePath = filePath.split('packages')[1];
const packageFilePath = `packages${filePath.split('packages')[1]}`;
const masterCoverage = coverageSummary[packageFilePath];
return [
`packages${packagePath}`,
packageFilePath,
formatCovComparison(changesCoverage.statements.pct, masterCoverage.statements.pct),
formatCovComparison(changesCoverage.branches.pct, masterCoverage.branches.pct),
formatCovComparison(changesCoverage.functions.pct, masterCoverage.functions.pct),
Expand Down
12 changes: 12 additions & 0 deletions ci/format-coverage-summary.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const { writeFileSync } = require('fs');
const _ = require('lodash');
const coverageSummary = require('../.coverage_json/coverage-summary.json');
const formattedSummary = _.mapKeys(coverageSummary, ( value, key) => {
if(key === 'total') {
return key;
}
const packagePath = key.split('packages')[1];
return `packages${packagePath}`;
});

writeFileSync('.coverage_json/coverage-summary.json', JSON.stringify(formattedSummary), 'utf8');
7 changes: 5 additions & 2 deletions ci/merge-coverage-changes.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,16 @@ workspaces.forEach((workspace) => {
const package = workspace.split(path.sep).pop();

const coverageDir = path.join('.coverage', context);
const packageCoverageDirectory = path.join(process.cwd(),'.coverage', context);

if (!fs.existsSync(coverageDir)) {
console.log(`Package "${package}":`);

if (!fs.existsSync(packageCoverageDirectory)) {
console.log(`${coverageDir} not found in ${workspace}; skipping`);
process.chdir('../..');
return;
}

console.log(`Package "${package}":`);
process.stdout.write(` - merging ${context} test coverage results...`);
shell.exec(getCmd(package, coverageDir));
process.stdout.write('completed.\n\n');
Expand Down
Loading

0 comments on commit 26a42d6

Please sign in to comment.