Skip to content

Commit d43f0f2

Browse files
committed
ci: add GitHub Classroom autograding workflow
- Include steps to run tests and parse JUnit results - Report test scores back to Classroom
1 parent 1e64323 commit d43f0f2

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# .github/workflows/classroom-maven.yml
2+
name: Autograde
3+
4+
on:
5+
push:
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout repository
13+
uses: actions/checkout@v4
14+
15+
- name: Set up JDK 19 and cache Maven
16+
uses: actions/setup-java@v4
17+
with:
18+
distribution: temurin
19+
java-version: '19'
20+
cache: maven
21+
22+
- name: Run tests with Maven Wrapper
23+
run: |
24+
chmod +x mvnw
25+
./mvnw test -B
26+
continue-on-error: true
27+
28+
- name: Parse JUnit results
29+
id: parse
30+
if: always()
31+
uses: dorny/test-reporter@v2
32+
with:
33+
name: JUnit Results
34+
path: target/surefire-reports/**/*.xml
35+
# use 'maven-surefire' or 'junit5-junitxml' depending on your surefire configuration
36+
reporter: maven-surefire
37+
38+
- name: Report score back to Classroom
39+
uses: github-education-resources/autograding-command-grader@v1
40+
with:
41+
test-name: JUnit-Suite
42+
command: echo "Passed ${{ steps.parse.outputs.passed }} of ${{ steps.parse.outputs.total }} tests"
43+
max-score: ${{ steps.parse.outputs.total }}

0 commit comments

Comments
 (0)