Skip to content

Commit dcc8d93

Browse files
authored
Merge pull request #613 from modelix/feature/MODELIX-792-Enable-test-result-reporting-in-PR-pipelines
MODELIX-792: enable test result reporting in PR pipelines
2 parents a2afbed + 9fa3d6e commit dcc8d93

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

.github/workflows/build.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ jobs:
1313

1414
runs-on: ubuntu-latest
1515

16+
# Cf. https://github.com/marketplace/actions/publish-test-results#permissions
17+
permissions:
18+
checks: write
19+
pull-requests: write
20+
1621
steps:
1722
- uses: actions/checkout@v4
1823
- name: Set up JDK 11
@@ -26,8 +31,16 @@ jobs:
2631
env:
2732
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2833
run: ./gradlew --build-cache build detekt -PciBuild=true
34+
- name: Publish test results
35+
uses: EnricoMi/publish-unit-test-result-action@v2
36+
# Also report in case the build failed
37+
if: always()
38+
with:
39+
files: |
40+
**/test-results/**/*.xml
2941
- name: Archive test report
3042
uses: actions/upload-artifact@v4
43+
# Archive test reports for introspection even if the build failed. They are most useful in this situation.
3144
if: always()
3245
with:
3346
name: test-report

model-server/build.gradle.kts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,18 @@ val cucumber = task("cucumber") {
114114
javaexec {
115115
mainClass.set("io.cucumber.core.cli.Main")
116116
classpath = cucumberRuntime + sourceSets.main.get().output + sourceSets.test.get().output
117-
// Change glue for your project package where the step definitions are.
118-
// And where the feature files are.
119-
args = listOf("--plugin", "pretty", "--glue", "org.modelix.model.server.functionaltests", "src/test/resources/functionaltests")
117+
args = listOf(
118+
"--plugin",
119+
"pretty",
120+
// Enable junit reporting so that GitHub actions can report on these tests, too
121+
"--plugin",
122+
"junit:${project.layout.buildDirectory.dir("test-results/cucumber.xml").get()}",
123+
// Change glue for your project package where the step definitions are.
124+
"--glue",
125+
"org.modelix.model.server.functionaltests",
126+
// Specify where the feature files are.
127+
"src/test/resources/functionaltests",
128+
)
120129
}
121130
}
122131
}

0 commit comments

Comments
 (0)