Skip to content

Commit 6fc0053

Browse files
Create GitHub Classroom Autograding Workflow
1 parent dfcf38c commit 6fc0053

File tree

1 file changed

+100
-0
lines changed

1 file changed

+100
-0
lines changed

.github/workflows/classroom.yml

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
name: Autograding Tests
2+
'on':
3+
- push
4+
- repository_dispatch
5+
permissions:
6+
checks: write
7+
actions: read
8+
contents: read
9+
jobs:
10+
run-autograding-tests:
11+
runs-on: ubuntu-latest
12+
if: github.actor != 'github-classroom[bot]'
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
- name: "#contains() returns false when set is empty"
17+
id: contains-returns-false-when-set-is-empty
18+
uses: classroom-resources/autograding-command-grader@v1
19+
with:
20+
test-name: "#contains() returns false when set is empty"
21+
setup-command: ''
22+
command: ./gradlew test --tests "assignment.SetTest.testContainsWhenEmpty"
23+
timeout: 1
24+
max-score: 1
25+
- name: "#contains() works when set has 1 item"
26+
id: contains-works-when-set-has-1-item
27+
uses: classroom-resources/autograding-command-grader@v1
28+
with:
29+
test-name: "#contains() works when set has 1 item"
30+
setup-command: ''
31+
command: ./gradlew test --tests "assignment.SetTest.testContainsWhenNotEmpty"
32+
timeout: 1
33+
max-score: 1
34+
- name: Add multiple elements to set
35+
id: add-multiple-elements-to-set
36+
uses: classroom-resources/autograding-command-grader@v1
37+
with:
38+
test-name: Add multiple elements to set
39+
setup-command: ''
40+
command: ./gradlew test --tests "assignment.SetTest.testAddMultiple"
41+
timeout: 1
42+
max-score: 1
43+
- name: Remove items from set
44+
id: remove-items-from-set
45+
uses: classroom-resources/autograding-command-grader@v1
46+
with:
47+
test-name: Remove items from set
48+
setup-command: ''
49+
command: ./gradlew test --tests "assignment.SetTest.testRemove"
50+
timeout: 1
51+
max-score: 1
52+
- name: Remove non-existing elements from set
53+
id: remove-non-existing-elements-from-set
54+
uses: classroom-resources/autograding-command-grader@v1
55+
with:
56+
test-name: Remove non-existing elements from set
57+
setup-command: ''
58+
command: ./gradlew test --tests "assignment.SetTest.testRemoveNonExistingElement"
59+
timeout: 1
60+
max-score: 1
61+
- name: Add duplicate elements to set
62+
id: add-duplicate-elements-to-set
63+
uses: classroom-resources/autograding-command-grader@v1
64+
with:
65+
test-name: Add duplicate elements to set
66+
setup-command: ''
67+
command: ./gradlew test --tests "assignment.SetTest.testAddDuplicateElement"
68+
timeout: 1
69+
max-score: 1
70+
- name: Remove non-existing elements from empty set
71+
id: remove-non-existing-elements-from-empty-set
72+
uses: classroom-resources/autograding-command-grader@v1
73+
with:
74+
test-name: Remove non-existing elements from empty set
75+
setup-command: ''
76+
command: ./gradlew test --tests "assignment.SetTest.testRemoveFromEmptySet"
77+
timeout: 1
78+
max-score: 1
79+
- name: Set works with non-string types
80+
id: set-works-with-non-string-types
81+
uses: classroom-resources/autograding-command-grader@v1
82+
with:
83+
test-name: Set works with non-string types
84+
setup-command: ''
85+
command: ./gradlew test --tests "assignment.SetTest.testWithDifferentTypes"
86+
timeout: 1
87+
max-score: 1
88+
- name: Autograding Reporter
89+
uses: classroom-resources/autograding-grading-reporter@v1
90+
env:
91+
CONTAINS-RETURNS-FALSE-WHEN-SET-IS-EMPTY_RESULTS: "${{steps.contains-returns-false-when-set-is-empty.outputs.result}}"
92+
CONTAINS-WORKS-WHEN-SET-HAS-1-ITEM_RESULTS: "${{steps.contains-works-when-set-has-1-item.outputs.result}}"
93+
ADD-MULTIPLE-ELEMENTS-TO-SET_RESULTS: "${{steps.add-multiple-elements-to-set.outputs.result}}"
94+
REMOVE-ITEMS-FROM-SET_RESULTS: "${{steps.remove-items-from-set.outputs.result}}"
95+
REMOVE-NON-EXISTING-ELEMENTS-FROM-SET_RESULTS: "${{steps.remove-non-existing-elements-from-set.outputs.result}}"
96+
ADD-DUPLICATE-ELEMENTS-TO-SET_RESULTS: "${{steps.add-duplicate-elements-to-set.outputs.result}}"
97+
REMOVE-NON-EXISTING-ELEMENTS-FROM-EMPTY-SET_RESULTS: "${{steps.remove-non-existing-elements-from-empty-set.outputs.result}}"
98+
SET-WORKS-WITH-NON-STRING-TYPES_RESULTS: "${{steps.set-works-with-non-string-types.outputs.result}}"
99+
with:
100+
runners: contains-returns-false-when-set-is-empty,contains-works-when-set-has-1-item,add-multiple-elements-to-set,remove-items-from-set,remove-non-existing-elements-from-set,add-duplicate-elements-to-set,remove-non-existing-elements-from-empty-set,set-works-with-non-string-types

0 commit comments

Comments
 (0)