File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66
77permissions :
88 checks : write
9+ actions : read
10+ contents : read
911
1012jobs :
1113 report :
1214 runs-on : ubuntu-latest
1315 steps :
14- - name : Report score to Classroom
16+ - name : Build grader result
17+ env :
18+ POINTS : ${{ github.event.client_payload.points }}
19+ MAX : ${{ github.event.client_payload.max }}
1520 run : |
16- echo "::notice title=Autograding complete::Points ${{ github.event.client_payload.points }}/${{ github.event.client_payload.max }}"
17- echo '::notice title=Autograding report::{"totalPoints":${{ github.event.client_payload.points }},"maxPoints":${{ github.event.client_payload.max }}}'
21+ RESULT=$(python3 -c "
22+ import json, base64, os
23+ pts = int(os.environ.get('POINTS') or '0')
24+ mx = int(os.environ.get('MAX') or '50')
25+ r = {
26+ 'version': 1,
27+ 'status': 'pass' if pts == mx else 'fail',
28+ 'max_score': mx,
29+ 'tests': [{
30+ 'name': 'Lab1 Autograding',
31+ 'status': 'pass' if pts == mx else 'fail',
32+ 'score': pts,
33+ 'max_score': mx,
34+ 'message': f'{pts}/{mx}',
35+ 'test_code': '',
36+ 'filename': '',
37+ 'line_no': 0,
38+ 'duration': 0
39+ }]
40+ }
41+ print(base64.b64encode(json.dumps(r).encode()).decode())
42+ ")
43+ echo "GRADE_RESULTS=$RESULT" >> "$GITHUB_ENV"
44+
45+ - name : Autograding Reporter
46+ uses : classroom-resources/autograding-grading-reporter@v1
47+ env :
48+ GRADE_RESULTS : ${{ env.GRADE_RESULTS }}
49+ with :
50+ runners : grade
51+
1852 - name : Show detailed results
1953 env :
2054 REPORT : ${{ github.event.client_payload.summary }}
You can’t perform that action at this time.
0 commit comments