Skip to content

Commit f8b5987

Browse files
authored
Update classroom-autograding.yml
1 parent 1665ce8 commit f8b5987

File tree

1 file changed

+29
-9
lines changed

1 file changed

+29
-9
lines changed

.github/workflows/classroom-autograding.yml

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,38 @@ jobs:
3232
uses: dorny/test-reporter@v2
3333
with:
3434
name: JUnit Results
35-
path: "**/target/surefire-reports/**/*.xml"
35+
path: "**/target/surefire-reports/*.xml"
3636
reporter: java-junit
3737
fail-on-empty: false
38+
fail-on-error: false
3839

39-
- name: Report score back to Classroom
40-
uses: github-education-resources/autograding-command-grader@v1
40+
- name: Calculate total tests
41+
id: calc-total
42+
run: |
43+
passed=${{ steps.parse.outputs.passed || 0 }}
44+
failed=${{ steps.parse.outputs.failed || 0 }}
45+
skipped=${{ steps.parse.outputs.skipped || 0 }}
46+
total=$((passed + failed + skipped))
47+
echo "total=$total" >> $GITHUB_OUTPUT
48+
49+
- name: Grade JUnit test scores
50+
id: grade-junit
51+
uses: cbfacademy/autograding-command-grader@dev
4152
with:
4253
test-name: JUnit-Suite
4354
command: |
44-
if [ -z "$(find . -path '**/target/surefire-reports/**/*.xml' -type f)" ]; then
45-
echo "Passed 0 of 0 tests"
46-
else
47-
echo "Passed ${{ steps.parse.outputs.passed }} of ${{ steps.parse.outputs.total }} tests"
48-
fi
49-
max-score: ${{ steps.parse.outputs.total || 0 }}
55+
./.github/workflows/grade-junit.sh ${{ steps.parse.outputs.passed || 0 }} ${{ steps.parse.outputs.failed || 0 }} ${{ steps.parse.outputs.skipped || 0 }}
56+
max-score: 70
57+
58+
- name: Test output
59+
run: |
60+
result=$(echo "${{steps.grade-junit.outputs.result}}" | base64 -d)
61+
echo "GRADE-JUNIT_RESULTS: $result"
62+
63+
- name: Autograding Reporter
64+
uses: cbfacademy/autograding-grading-reporter@dev
65+
env:
66+
GRADE-JUNIT_RESULTS: "${{steps.grade-junit.outputs.result}}"
67+
with:
68+
runners: grade-junit
69+

0 commit comments

Comments
 (0)