Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into fix/node20
Browse files Browse the repository at this point in the history
# Conflicts:
#	package-lock.json
#	package.json
  • Loading branch information
ghaiszaher committed Feb 3, 2024
2 parents a94a2ba + 687f107 commit b080e6d
Show file tree
Hide file tree
Showing 33 changed files with 122 additions and 75 deletions.
17 changes: 9 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,34 +22,35 @@ jobs:
java-version: 8
distribution: 'temurin'
cache: 'maven'
- run: cd tests && mvn clean test --batch-mode -Dmaven.test.failure.ignore=true
- run: cd integration-tests/maven && mvn clean verify --batch-mode -Dmaven.test.failure.ignore=true
- uses: ./
if: github.ref != 'refs/heads/master'
with:
check_name: Example Surefire Test Report
report_paths: '**/surefire-reports/*.xml, **/failsafe-reports/*.xml'
- uses: cclauss/[email protected]
with:
args: pytest --junit-xml=python/report.xml python/ || exit 0
args: pytest integration-tests/python/ --junit-xml=integration-tests/python/report.xml || exit 0
- uses: ./
if: github.ref != 'refs/heads/master'
with:
check_name: Example Pytest Report
report_paths: python/report.xml
- uses: actions/setup-go@v4
report_paths: integration-tests/python/report.xml
- uses: actions/setup-go@v5
with:
go-version: 1.18.x
go-version: 1.21.x
- run: |
cd go &&
cd integration-tests/go &&
go install github.com/jstemmer/go-junit-report/v2@latest &&
go test -v 2>&1 ./... |
go-junit-report -out report.xml
- uses: ./
if: github.ref != 'refs/heads/master'
with:
check_name: Example Go Report
report_paths: go/report.xml
report_paths: integration-tests/go/report.xml
file_name_in_stack_trace: true
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/copilot-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
on:
pull_request

jobs:
check-contributors:
name: Check contributors
uses: scacap/infra.gh-actions/.github/workflows/copilot-contributor-check.yml@v1
secrets: inherit
with:
repository: ${{ github.repository }}
pull_request_number: ${{ github.event.pull_request.number }}
24 changes: 12 additions & 12 deletions action.test.fixtures.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const finishedWithFailures = {
annotations: [
{
path:
'tests/email/src/test/java/action/surefire/report/email/EmailAddressTest.java',
'integration-tests/maven/email/src/test/java/action/surefire/report/email/EmailAddressTest.java',
start_line: 39,
end_line: 39,
start_column: 0,
Expand All @@ -22,7 +22,7 @@ const finishedWithFailures = {
},
{
path:
'tests/email/src/test/java/action/surefire/report/email/EmailAddressTest.java',
'integration-tests/maven/email/src/test/java/action/surefire/report/email/EmailAddressTest.java',
start_line: 49,
end_line: 49,
start_column: 0,
Expand All @@ -35,7 +35,7 @@ const finishedWithFailures = {
},
{
path:
'tests/email/src/test/java/action/surefire/report/email/EmailAddressTest.java',
'integration-tests/maven/email/src/test/java/action/surefire/report/email/EmailAddressTest.java',
start_line: 57,
end_line: 57,
start_column: 0,
Expand All @@ -48,7 +48,7 @@ const finishedWithFailures = {
},
{
path:
'tests/email/src/test/java/action/surefire/report/email/EmailAddressTest.java',
'integration-tests/maven/email/src/test/java/action/surefire/report/email/EmailAddressTest.java',
start_line: 18,
end_line: 18,
start_column: 0,
Expand All @@ -61,7 +61,7 @@ const finishedWithFailures = {
},
{
path:
'tests/email/src/test/java/action/surefire/report/email/EmailAddressTest.java',
'integration-tests/maven/email/src/test/java/action/surefire/report/email/EmailAddressTest.java',
start_line: 32,
end_line: 32,
start_column: 0,
Expand All @@ -74,7 +74,7 @@ const finishedWithFailures = {
},
{
path:
'tests/email/src/test/java/action/surefire/report/email/EmailAddressTest.java',
'integration-tests/maven/email/src/test/java/action/surefire/report/email/EmailAddressTest.java',
start_line: 25,
end_line: 25,
start_column: 0,
Expand All @@ -88,7 +88,7 @@ const finishedWithFailures = {
},
{
path:
'tests/email/src/test/java/action/surefire/report/email/EmailAddressTest.java',
'integration-tests/maven/email/src/test/java/action/surefire/report/email/EmailAddressTest.java',
start_line: 66,
end_line: 66,
start_column: 0,
Expand All @@ -101,7 +101,7 @@ const finishedWithFailures = {
},
{
path:
'tests/evil_twins/src/test/java/action/surefire/report/twin/second/TwinTest.java',
'integration-tests/maven/evil_twins/src/test/java/action/surefire/report/twin/second/TwinTest.java',
start_line: 13,
end_line: 13,
start_column: 0,
Expand All @@ -113,7 +113,7 @@ const finishedWithFailures = {
"java.lang.AssertionError: \n\nExpected: \"Good Twin\"\n but: was \"Evil Twin\"\n\tat action.surefire.report.twin.second.TwinTest.should_always_fail(TwinTest.java:13)"
},
{
path: 'tests/utils/src/test/java/action/surefire/report/calc/CalcUtilsTest.kt',
path: 'integration-tests/maven/utils/src/test/java/action/surefire/report/calc/CalcUtilsTest.kt',
start_line: 27,
end_line: 27,
start_column: 0,
Expand All @@ -126,7 +126,7 @@ const finishedWithFailures = {
'java.lang.AssertionError: unexpected exception type thrown; expected:<java.lang.IllegalStateException> but was:<java.lang.IllegalArgumentException>\n\tat action.surefire.report.calc.CalcUtilsTest.test error handling(CalcUtilsTest.kt:27)\nCaused by: java.lang.IllegalArgumentException: Amount must have max 2 non-zero decimal places\n\tat action.surefire.report.calc.CalcUtilsTest.scale(CalcUtilsTest.kt:31)\n\tat action.surefire.report.calc.CalcUtilsTest.access$scale(CalcUtilsTest.kt:9)\n\tat action.surefire.report.calc.CalcUtilsTest.test error handling(CalcUtilsTest.kt:27)'
},
{
path: 'tests/utils/src/test/java/action/surefire/report/calc/CalcUtilsTest.kt',
path: 'integration-tests/maven/utils/src/test/java/action/surefire/report/calc/CalcUtilsTest.kt',
start_line: 15,
end_line: 15,
start_column: 0,
Expand All @@ -138,7 +138,7 @@ const finishedWithFailures = {
'java.lang.AssertionError: \n\nExpected: <100.10>\n but: was <100.11>\n\tat action.surefire.report.calc.CalcUtilsTest.test scale(CalcUtilsTest.kt:15)'
},
{
path: 'tests/utils/src/test/java/action/surefire/report/calc/StringUtilsTest.java',
path: 'integration-tests/maven/utils/src/test/java/action/surefire/report/calc/StringUtilsTest.java',
start_line: 27,
end_line: 27,
start_column: 0,
Expand All @@ -151,7 +151,7 @@ const finishedWithFailures = {
'java.lang.AssertionError: \n\nExpected: (an instance of java.lang.IllegalArgumentException and exception with message a string containing "This is unexpected")\n but: exception with message a string containing "This is unexpected" message was "Input=\'\' didn\'t match condition."\nStacktrace was: java.lang.IllegalArgumentException: Input=\'\' didn\'t match condition.\n\tat action.surefire.report.calc.StringUtils.requireNotBlank(StringUtils.java:25)\n\tat action.surefire.report.calc.StringUtils.requireNotBlank(StringUtils.java:18)\n\tat action.surefire.report.calc.StringUtilsTest.require_fail(StringUtilsTest.java:27)\n\tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n\tat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\n\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n\tat java.lang.reflect.Method.invoke(Method.java:498)\n\tat org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)\n\tat org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)\n\tat org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)\n\tat org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)\n\tat org.junit.rules.ExpectedException$ExpectedExceptionStatement.evaluate(ExpectedException.java:258)\n\tat org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)\n\tat org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)\n\tat org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)\n\tat org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)\n\tat org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)\n\tat org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)\n\tat org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)\n\tat org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)\n\tat org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)\n\tat org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)\n\tat org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)\n\tat org.junit.runners.ParentRunner.run(ParentRunner.java:413)\n\tat org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:365)\n\tat org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:273)\n\tat org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:238)\n\tat org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:159)\n\tat org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:384)\n\tat org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:345)\n\tat org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:126)\n\tat org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:418)'
},
{
path: 'tests/utils/src/test/java/action/surefire/report/calc/StringUtilsTest.java',
path: 'integration-tests/maven/utils/src/test/java/action/surefire/report/calc/StringUtilsTest.java',
start_line: 20,
end_line: 20,
start_column: 0,
Expand Down
44 changes: 28 additions & 16 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36505,24 +36505,24 @@ const resolveFileAndLine = (file, classname, output, isFilenameInOutput) => {
let filenameWithPackage;
if (isFilenameInOutput) {
filename = output.split(':')[0].trim();
filenameWithPackage = filename
filenameWithPackage = filename;
} else {
filename = file ? file : classname.split('.').slice(-1)[0].split('(')[0];
filenameWithPackage = classname.replace(/\./g, "/");
filenameWithPackage = classname.replace(/\./g, '/');
}
const matches = output.match(new RegExp(`${filename}.*?:\\d+`, 'g'));
if (!matches) return { filename: filename, filenameWithPackage: filenameWithPackage, line: 1 };
if (!matches) return {filename: filename, filenameWithPackage: filenameWithPackage, line: 1};

const [lastItem] = matches.slice(-1);
const [, line] = lastItem.split(':');
core.debug(`Resolved file ${filenameWithPackage} with name ${filename} and line ${line}`);

return { filename, filenameWithPackage, line: parseInt(line) };
return {filename, filenameWithPackage, line: parseInt(line)};
};

const resolvePath = async filenameWithPackage => {
core.debug(`Resolving path for ${filenameWithPackage}`);
const globber = await glob.create([`**/${filenameWithPackage}.*`, `**/${filenameWithPackage}`].join('\n'), { followSymbolicLinks: false });
const globber = await glob.create([`**/${filenameWithPackage}.*`, `**/${filenameWithPackage}`].join('\n'), {followSymbolicLinks: false});
const results = await globber.glob();
core.debug(`Matched files: ${results}`);
const searchPath = globber.getSearchPaths()[0];
Expand All @@ -36545,6 +36545,19 @@ const resolvePath = async filenameWithPackage => {
return canonicalPath;
};

function getTestsuites(report) {
if (report.testsuite) {
return [report.testsuite];
}
if (!report.testsuites || !report.testsuites.testsuite) {
return [];
}
if (Array.isArray(report.testsuites.testsuite)) {
return report.testsuites.testsuite;
}
return [report.testsuites.testsuite];
}

async function parseFile(file, isFilenameInStackTrace) {
core.debug(`Parsing file ${file}`);
let count = 0;
Expand All @@ -36553,12 +36566,11 @@ async function parseFile(file, isFilenameInStackTrace) {

const data = await fs.promises.readFile(file);

const report = JSON.parse(parser.xml2json(data, { compact: true }));
const testsuites = report.testsuite
? [report.testsuite]
: Array.isArray(report.testsuites.testsuite)
? report.testsuites.testsuite
: [report.testsuites.testsuite];
const report = JSON.parse(parser.xml2json(data, {compact: true}));
core.debug(`parsed report: ${JSON.stringify(report)}`);

const testsuites = getTestsuites(report);
core.debug(`test suites: ${JSON.stringify(testsuites)}`);

for (const testsuite of testsuites) {
const testcases = Array.isArray(testsuite.testcase)
Expand Down Expand Up @@ -36595,7 +36607,7 @@ async function parseFile(file, isFilenameInStackTrace) {
testcase._attributes.name
).trim();

const { filename, filenameWithPackage, line } = resolveFileAndLine(
const {filename, filenameWithPackage, line} = resolveFileAndLine(
testcase._attributes.file,
testcase._attributes.classname,
stackTrace,
Expand All @@ -36620,22 +36632,22 @@ async function parseFile(file, isFilenameInStackTrace) {
}
}
}
return { count, skipped, annotations };
return {count, skipped, annotations};
}

const parseTestReports = async (reportPaths, isFilenameInStackTrace) => {
const globber = await glob.create(reportPaths, { followSymbolicLinks: false });
const globber = await glob.create(reportPaths, {followSymbolicLinks: false});
let annotations = [];
let count = 0;
let skipped = 0;
for await (const file of globber.globGenerator()) {
const { count: c, skipped: s, annotations: a } = await parseFile(file, isFilenameInStackTrace);
const {count: c, skipped: s, annotations: a} = await parseFile(file, isFilenameInStackTrace);
if (c === 0) continue;
count += c;
skipped += s;
annotations = annotations.concat(a);
}
return { count, skipped, annotations };
return {count, skipped, annotations};
};

module.exports = { resolveFileAndLine, resolvePath, parseFile, parseTestReports };
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
13 changes: 13 additions & 0 deletions tests/pom.xml → integration-tests/maven/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,19 @@
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.22.2</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ public void require_withNullMsg() {
thrown.expectMessage("Input='' didn't match condition.");
StringUtils.requireNotBlank("");
}
}
}
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"@octokit/fixtures": "22.0.6",
"@vercel/ncc": "0.38.1",
"enzyme": "3.11.0",
"eslint": "8.52.0",
"eslint": "8.56.0",
"jest": "29.7.0",
"jest-junit": "16.0.0",
"nock": "14.0.0-beta.1"
Expand Down
Binary file not shown.
Loading

0 comments on commit b080e6d

Please sign in to comment.