Skip to content

Commit 8632ddd

Browse files
committed
Test base and edge case
1 parent 7fd368b commit 8632ddd

File tree

1 file changed

+56
-30
lines changed

1 file changed

+56
-30
lines changed

.github/workflows/classroom.yml

Lines changed: 56 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -26,48 +26,74 @@ jobs:
2626
# 🧪 Compilation
2727
- name: Compilation Check
2828
id: compile
29-
run: mvn -ntp compile
29+
run: |
30+
mvn -ntp compile
31+
if [ $? -eq 0 ]; then
32+
echo "result=1/1" >> $GITHUB_OUTPUT
33+
else
34+
echo "result=0/1" >> $GITHUB_OUTPUT
35+
fi
3036
3137
# ✅ Basic functionality
3238
- name: Basic Tests
3339
id: basic
34-
run: mvn -ntp test -Dtest=BasicTest
40+
run: |
41+
mvn -ntp test -Dtest=BasicTest
42+
if [ $? -eq 0 ]; then
43+
echo "result=1/1" >> $GITHUB_OUTPUT
44+
else
45+
echo "result=0/1" >> $GITHUB_OUTPUT
46+
fi
3547
3648
# ⚠️ Optional edge cases
3749
- name: Edge Case Tests
3850
id: edge
3951
continue-on-error: true
4052
run: |
41-
echo "exit_code=0" >> $GITHUB_ENV
42-
mvn -ntp test -Dtest=EdgeCaseTest || echo "exit_code=1" >> $GITHUB_ENV
43-
44-
# 🧮 Scoring and conditional failure
45-
- name: Calculate and Report Points
46-
run: |
47-
POINTS=0
48-
MAX=3
49-
50-
if [ "${{ steps.compile.outcome }}" == "success" ]; then
51-
POINTS=$((POINTS + 1))
53+
# echo "exit_code=0" >> $GITHUB_ENV
54+
mvn -ntp test -Dtest=EdgeCaseTest
55+
if [ $? -eq 0 ]; then
56+
echo "result=1/1" >> $GITHUB_OUTPUT
5257
else
53-
echo "❌ Compilation failed"
58+
echo "result=0/1" >> $GITHUB_OUTPUT
5459
fi
55-
56-
if [ "${{ steps.basic.outcome }}" == "success" ]; then
57-
POINTS=$((POINTS + 1))
58-
else
59-
echo "❌ Basic tests failed"
60-
fi
61-
62-
if [ "$exit_code" -eq 0 ]; then
63-
POINTS=$((POINTS + 1))
64-
else
65-
echo "⚠️ Edge case tests failed (optional)"
66-
fi
67-
68-
echo "::notice title=Autograding complete::Points ${POINTS}/${MAX}"
69-
echo "::notice title=Autograding report::{\"totalPoints\":${POINTS},\"maxPoints\":${MAX}}"
70-
exit 0
60+
- name: Autograding Reporter
61+
uses: classroom-resources/autograding-grading-reporter@v1
62+
env:
63+
COMPILATION_RESULTS: "${{ steps.compile.outputs.result }}"
64+
BASIC_RESULTS: "${{ steps.basic.outputs.result }}"
65+
EDGE_RESULTS: "${{ steps.edge.outputs.result }}"
66+
with:
67+
runners: compile,basic,edge
68+
69+
# 🧮 Scoring and conditional failure
70+
# - name: Calculate and Report Points
71+
# run: |
72+
# POINTS=0
73+
# MAX=3
74+
#
75+
# if [ "${{ steps.compile.outcome }}" == "success" ]; then
76+
# POINTS=$((POINTS + 1))
77+
# else
78+
# echo "❌ Compilation failed"
79+
# fi
80+
#
81+
# if [ "${{ steps.basic.outcome }}" == "success" ]; then
82+
# POINTS=$((POINTS + 1))
83+
# else
84+
# echo "❌ Basic tests failed"
85+
# fi
86+
#
87+
# if [ "$exit_code" -eq 0 ]; then
88+
# POINTS=$((POINTS + 1))
89+
# else
90+
# echo "⚠️ Edge case tests failed (optional)"
91+
# fi
92+
#
93+
# echo "::notice title=Autograding complete::Points ${POINTS}/${MAX}"
94+
# echo "::notice title=Autograding report::{\"totalPoints\":${POINTS},\"maxPoints\":${MAX}}"
95+
# exit 0
96+
7197
ai_feedback:
7298
name: AI-Powered Feedback
7399
needs: autograding

0 commit comments

Comments
 (0)