Skip to content

Commit

Permalink
⚗️ Test for CI System (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
soo-bak committed Jul 7, 2024
1 parent 5cc877c commit 4160725
Showing 1 changed file with 35 additions and 36 deletions.
71 changes: 35 additions & 36 deletions .github/workflows/UnitTestsAndCodeCoverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ jobs:
echo "SUMMARY_EXISTS=true" >> $GITHUB_ENV
else
echo "SUMMARY_EXISTS=false" >> $GITHUB_ENV
fi
- name: Setup Node.js
if: env.SUMMARY_EXISTS == 'true'
Expand All @@ -105,41 +104,41 @@ jobs:
if: env.SUMMARY_EXISTS == 'true'
run: |
echo "const fs = require('fs');
const xml2js = require('xml2js');
const parser = new xml2js.Parser();
const xml = fs.readFileSync('CodeCoverage/Report/Summary.xml', 'utf8');
const { context, getOctokit } = require('@actions/github');
const github = getOctokit(process.env.GITHUB_TOKEN);
parser.parseString(xml, (err, result) => {
if (err) throw err;
const summary = result.CoverageReport.Summary[0];
const commentBody = `
## Code Coverage Summary
- **Generated on**: ${summary.Generatedon[0]}
- **Parser**: ${summary.Parser[0]}
- **Assemblies**: ${summary.Assemblies[0]}
- **Classes**: ${summary.Classes[0]}
- **Files**: ${summary.Files[0]}
- **Covered Lines**: ${summary.Coveredlines[0]}
- **Uncovered Lines**: ${summary.Uncoveredlines[0]}
- **Coverable Lines**: ${summary.Coverablelines[0]}
- **Total Lines**: ${summary.Totallines[0]}
- **Line Coverage**: ${summary.Linecoverage[0]}%
- **Covered Branches**: ${summary.Coveredbranches[0]}
- **Total Branches**: ${summary.Totalbranches[0]}
- **Covered Methods**: ${summary.Coveredmethods[0]}
- **Total Methods**: ${summary.Totalmethods[0]}
- **Method Coverage**: ${summary.Methodcoverage[0]}%
`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: commentBody
});
});" > script.js
const xml2js = require('xml2js');
const parser = new xml2js.Parser();
const xml = fs.readFileSync('CodeCoverage/Report/Summary.xml', 'utf8');
const { context, getOctokit } = require('@actions/github');
const github = getOctokit(process.env.GITHUB_TOKEN);

parser.parseString(xml, (err, result) => {
if (err) throw err;
const summary = result.CoverageReport.Summary[0];
const commentBody = `
## Code Coverage Summary
- **Generated on**: ${summary.Generatedon[0]}
- **Parser**: ${summary.Parser[0]}
- **Assemblies**: ${summary.Assemblies[0]}
- **Classes**: ${summary.Classes[0]}
- **Files**: ${summary.Files[0]}
- **Covered Lines**: ${summary.Coveredlines[0]}
- **Uncovered Lines**: ${summary.Uncoveredlines[0]}
- **Coverable Lines**: ${summary.Coverablelines[0]}
- **Total Lines**: ${summary.Totallines[0]}
- **Line Coverage**: ${summary.Linecoverage[0]}%
- **Covered Branches**: ${summary.Coveredbranches[0]}
- **Total Branches**: ${summary.Totalbranches[0]}
- **Covered Methods**: ${summary.Coveredmethods[0]}
- **Total Methods**: ${summary.Totalmethods[0]}
- **Method Coverage**: ${summary.Methodcoverage[0]}%
`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: commentBody
});
});" > script.js
- name: Run Node.js Script
if: env.SUMMARY_EXISTS == 'true'
Expand Down

0 comments on commit 4160725

Please sign in to comment.