Skip to content

Commit fd250d0

Browse files
Create GitHub Classroom Autograding Workflow
1 parent 5cf7097 commit fd250d0

File tree

1 file changed

+130
-0
lines changed

1 file changed

+130
-0
lines changed

.github/workflows/classroom.yml

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
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: Works with an empty array
17+
id: works-with-an-empty-array
18+
uses: classroom-resources/autograding-command-grader@v1
19+
with:
20+
test-name: Works with an empty array
21+
setup-command: ''
22+
command: "./gradlew test --tests assignment.MergeSortTest.testEmptyArray"
23+
timeout: 1
24+
max-score: 1
25+
- name: Works with an array with 1 element
26+
id: works-with-an-array-with-1-element
27+
uses: classroom-resources/autograding-command-grader@v1
28+
with:
29+
test-name: Works with an array with 1 element
30+
setup-command: ''
31+
command: "./gradlew test --tests assignment.MergeSortTest.testSingleElement"
32+
timeout: 1
33+
max-score: 1
34+
- name: Works with an already sorted array
35+
id: works-with-an-already-sorted-array
36+
uses: classroom-resources/autograding-command-grader@v1
37+
with:
38+
test-name: Works with an already sorted array
39+
setup-command: ''
40+
command: "./gradlew test --tests assignment.MergeSortTest.testAlreadySorted"
41+
timeout: 1
42+
max-score: 1
43+
- name: Works with an array sorted in descending order
44+
id: works-with-an-array-sorted-in-descending-order
45+
uses: classroom-resources/autograding-command-grader@v1
46+
with:
47+
test-name: Works with an array sorted in descending order
48+
setup-command: ''
49+
command: "./gradlew test --tests assignment.MergeSortTest.testReverseSorted"
50+
timeout: 1
51+
max-score: 1
52+
- name: Works with an unsorted array
53+
id: works-with-an-unsorted-array
54+
uses: classroom-resources/autograding-command-grader@v1
55+
with:
56+
test-name: Works with an unsorted array
57+
setup-command: ''
58+
command: "./gradlew test --tests assignment.MergeSortTest.testRandomUnsorted"
59+
timeout: 1
60+
max-score: 1
61+
- name: Works when array contains duplicate values
62+
id: works-when-array-contains-duplicate-values
63+
uses: classroom-resources/autograding-command-grader@v1
64+
with:
65+
test-name: Works when array contains duplicate values
66+
setup-command: ''
67+
command: "./gradlew test --tests assignment.MergeSortTest.testWithDuplicates"
68+
timeout: 1
69+
max-score: 1
70+
- name: Works with negative numbers
71+
id: works-with-negative-numbers
72+
uses: classroom-resources/autograding-command-grader@v1
73+
with:
74+
test-name: Works with negative numbers
75+
setup-command: ''
76+
command: "./gradlew test --tests assignment.MergeSortTest.testWithNegativeNumbers"
77+
timeout: 1
78+
max-score: 1
79+
- name: Works with an array with 2 elements
80+
id: works-with-an-array-with-2-elements
81+
uses: classroom-resources/autograding-command-grader@v1
82+
with:
83+
test-name: Works with an array with 2 elements
84+
setup-command: ''
85+
command: "./gradlew test --tests assignment.MergeSortTest.testTwoElements"
86+
timeout: 1
87+
max-score: 1
88+
- name: Works with an array of all the same value
89+
id: works-with-an-array-of-all-the-same-value
90+
uses: classroom-resources/autograding-command-grader@v1
91+
with:
92+
test-name: Works with an array of all the same value
93+
setup-command: ''
94+
command: "./gradlew test --tests assignment.MergeSortTest.testAllSameElements"
95+
timeout: 1
96+
max-score: 1
97+
- name: Works with an array with 1000 elements
98+
id: works-with-an-array-with-1000-elements
99+
uses: classroom-resources/autograding-command-grader@v1
100+
with:
101+
test-name: Works with an array with 1000 elements
102+
setup-command: ''
103+
command: "./gradlew test --tests assignment.MergeSortTest.testLargeArray"
104+
timeout: 1
105+
max-score: 1
106+
- name: Works with an array with multiple duplicates
107+
id: works-with-an-array-with-multiple-duplicates
108+
uses: classroom-resources/autograding-command-grader@v1
109+
with:
110+
test-name: Works with an array with multiple duplicates
111+
setup-command: ''
112+
command: "./gradlew test --tests assignment.MergeSortTest.testStability"
113+
timeout: 1
114+
max-score: 1
115+
- name: Autograding Reporter
116+
uses: classroom-resources/autograding-grading-reporter@v1
117+
env:
118+
WORKS-WITH-AN-EMPTY-ARRAY_RESULTS: "${{steps.works-with-an-empty-array.outputs.result}}"
119+
WORKS-WITH-AN-ARRAY-WITH-1-ELEMENT_RESULTS: "${{steps.works-with-an-array-with-1-element.outputs.result}}"
120+
WORKS-WITH-AN-ALREADY-SORTED-ARRAY_RESULTS: "${{steps.works-with-an-already-sorted-array.outputs.result}}"
121+
WORKS-WITH-AN-ARRAY-SORTED-IN-DESCENDING-ORDER_RESULTS: "${{steps.works-with-an-array-sorted-in-descending-order.outputs.result}}"
122+
WORKS-WITH-AN-UNSORTED-ARRAY_RESULTS: "${{steps.works-with-an-unsorted-array.outputs.result}}"
123+
WORKS-WHEN-ARRAY-CONTAINS-DUPLICATE-VALUES_RESULTS: "${{steps.works-when-array-contains-duplicate-values.outputs.result}}"
124+
WORKS-WITH-NEGATIVE-NUMBERS_RESULTS: "${{steps.works-with-negative-numbers.outputs.result}}"
125+
WORKS-WITH-AN-ARRAY-WITH-2-ELEMENTS_RESULTS: "${{steps.works-with-an-array-with-2-elements.outputs.result}}"
126+
WORKS-WITH-AN-ARRAY-OF-ALL-THE-SAME-VALUE_RESULTS: "${{steps.works-with-an-array-of-all-the-same-value.outputs.result}}"
127+
WORKS-WITH-AN-ARRAY-WITH-1000-ELEMENTS_RESULTS: "${{steps.works-with-an-array-with-1000-elements.outputs.result}}"
128+
WORKS-WITH-AN-ARRAY-WITH-MULTIPLE-DUPLICATES_RESULTS: "${{steps.works-with-an-array-with-multiple-duplicates.outputs.result}}"
129+
with:
130+
runners: works-with-an-empty-array,works-with-an-array-with-1-element,works-with-an-already-sorted-array,works-with-an-array-sorted-in-descending-order,works-with-an-unsorted-array,works-when-array-contains-duplicate-values,works-with-negative-numbers,works-with-an-array-with-2-elements,works-with-an-array-of-all-the-same-value,works-with-an-array-with-1000-elements,works-with-an-array-with-multiple-duplicates

0 commit comments

Comments
 (0)