-
Notifications
You must be signed in to change notification settings - Fork 24
325 lines (251 loc) · 12.9 KB
/
makeTest.yml
File metadata and controls
325 lines (251 loc) · 12.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
name: Make Test
on:
repository_dispatch:
types:
[test_pr]
jobs:
runTests:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Setup Node.js environment
uses: actions/setup-node@v2.1.5
- name: Install octokit/core.js
run: npm install @octokit/core
- name: Install xmlhttprequest
run: npm install xmlhttprequest
#Get Repository that isn't currently being checked
- name: Get a Pull Request's Repo Name that isn't already being checked
run: node .cbc/getRepoInfo.js ${{ secrets.AUTH_TOKEN }} full_name > repo.txt
- name: Save Repository name as Output Variable
id: repo
uses: juliangruber/read-file-action@v1
with:
path: repo.txt
- name: Get the Pull Request's Number
run: node .cbc/getRepoInfo.js ${{ secrets.AUTH_TOKEN }} number > number.txt
- name: Save Repository Number as Output Variable
id: number
uses: juliangruber/read-file-action@v1
with:
path: number.txt
- name: Add "currentlyBeingChecked" label
run: node .cbc/addLabel.js ${{ secrets.AUTH_TOKEN }} ${{ steps.number.outputs.content }} currentlyBeingChecked
#Problem 1 Testing
- name: Get Make File for Problem 1
id: getMakeFile1
run: node .cbc/getFile.js ${{ secrets.AUTH_TOKEN }} ${{ steps.repo.outputs.content }} MakeFiles/MakeFile1.txt > Makefile
- name: Comment
run: node .cbc/makeComment.js ${{ secrets.AUTH_TOKEN }} ${{ steps.number.outputs.content }} "Makefile1.txt found"
- name: Run Make
id: runMake
run: make
- name: Comment
run: node .cbc/makeComment.js ${{ secrets.AUTH_TOKEN }} ${{ steps.number.outputs.content }} "Makefile1.txt ran"
- name: Run program
id: runProgram
run: ./tree > output.log
- name: Comment
run: node .cbc/makeComment.js ${{ secrets.AUTH_TOKEN }} ${{ steps.number.outputs.content }} "Problem 1 tree executable ran"
- name: Read Output
id: output
uses: juliangruber/read-file-action@v1
with:
path: output.log
- name: Assert Proper Output
id: properOutput
uses: therussiankid92/gat@v1.5
with:
assertion: should.equal
actual: ${{ steps.output.outputs.content }}
expected: ${{ secrets.PROGRAM_OUTPUT }}
- name: Comment
run: node .cbc/makeComment.js ${{ secrets.AUTH_TOKEN }} ${{ steps.number.outputs.content }} "Problem 1 tree executable output is correct"
- name: Make clean
id: makeClean
run: make clean
- name: Comment
run: node .cbc/makeComment.js ${{ secrets.AUTH_TOKEN }} ${{ steps.number.outputs.content }} "Makefile1.txt clean function ran"
- name: Find File
continue-on-error: true
run: |
echo "Found? " > clean.txt
test -f tree && echo "Yes" >> clean.txt
- name: Read Find Output
id: find
uses: juliangruber/read-file-action@v1
with:
path: clean.txt
- name: Assert File Gone
id: fileGone
uses: therussiankid92/gat@v1.5
with:
assertion: should.equal
actual: ${{ steps.find.outputs.content }}
expected: Found?
- name: Comment
run: node .cbc/makeComment.js ${{ secrets.AUTH_TOKEN }} ${{ steps.number.outputs.content }} "Makefile1.txt clean function deleted the tree executable"
- name: Assert No Variables, Automatic Variables, Pattern Matching, or Makefile Functions in MakeFile1.txt
id: assertNoVariables
run: node .cbc/assertDoesNotContain.js Makefile "$,@,<,%,="
- name: Comment
run: node .cbc/makeComment.js ${{ secrets.AUTH_TOKEN }} ${{ steps.number.outputs.content }} "Makefile1.txt doesn't contain Variables, Automatic Variables, Pattern Matching, or Makefile Functions"
#Problem 2 Testing
- name: Get Make File for Problem 2
id: getMakeFile2
run: node .cbc/getFile.js ${{ secrets.AUTH_TOKEN }} ${{ steps.repo.outputs.content }} MakeFiles/MakeFile2.txt > Makefile
- name: Comment
run: node .cbc/makeComment.js ${{ secrets.AUTH_TOKEN }} ${{ steps.number.outputs.content }} "Makefile2.txt found"
- name: Run Make
id: runMake2
run: make
- name: Comment
run: node .cbc/makeComment.js ${{ secrets.AUTH_TOKEN }} ${{ steps.number.outputs.content }} "Makefile2.txt ran"
- name: Run program
id: runProgram2
run: ./tree > output.log
- name: Comment
run: node .cbc/makeComment.js ${{ secrets.AUTH_TOKEN }} ${{ steps.number.outputs.content }} "Problem 2 tree executable ran"
- name: Read Output
id: output2
uses: juliangruber/read-file-action@v1
with:
path: output.log
- name: Assert Proper Output
id: properOutput2
uses: therussiankid92/gat@v1.5
with:
assertion: should.equal
actual: ${{ steps.output2.outputs.content }}
expected: ${{ secrets.PROGRAM_OUTPUT }}
- name: Comment
run: node .cbc/makeComment.js ${{ secrets.AUTH_TOKEN }} ${{ steps.number.outputs.content }} "Problem 2 tree executable output is correct"
- name: Assert compiled.txt contains all files used
id: assertCompiled
run: node .cbc/assertContains.js compiled.txt ${{ secrets.COMPILED_TXT }}
- name: Comment
run: node .cbc/makeComment.js ${{ secrets.AUTH_TOKEN }} ${{ steps.number.outputs.content }} "compiled.txt contains proper file names"
- name: Make clean
id: makeClean2
run: make clean
- name: Comment
run: node .cbc/makeComment.js ${{ secrets.AUTH_TOKEN }} ${{ steps.number.outputs.content }} "Makefile2.txt clean function ran"
- name: Check that Files are gone
continue-on-error: true
run: |
echo "Found? " > clean.txt
test -f tree && echo "Yes" >> clean.txt
test -f compiled.txt && echo "Yes" >> clean.txt
test -f *.o && echo "Yes" >> clean.txt
- name: Read Find Output
id: find2
uses: juliangruber/read-file-action@v1
with:
path: clean.txt
- name: Assert File Gone
id: fileGone2
uses: therussiankid92/gat@v1.5
with:
assertion: should.equal
actual: ${{ steps.find2.outputs.content }}
expected: Found?
- name: Comment
run: node .cbc/makeComment.js ${{ secrets.AUTH_TOKEN }} ${{ steps.number.outputs.content }} "Makefile2.txt clean function deleted the tree executable, compiled.txt, and .o files"
- name: Assert %.o rule
id: assertORule
run: node .cbc/assertContains.js Makefile "%.o:"
- name: Comment
run: node .cbc/makeComment.js ${{ secrets.AUTH_TOKEN }} ${{ steps.number.outputs.content }} "Makefile2txt contains a %.o rule"
- name: Assert no "main", "leaves", "Leaves", "roots", "Roots", "branches", or "Branches" found in Makefile2.txt
id: assertNoClassNames
run: node .cbc/assertDoesNotContain.js Makefile "main,leaves,Leaves,roots,Roots,branches,Branches"
- name: Comment
run: node .cbc/makeComment.js ${{ secrets.AUTH_TOKEN }} ${{ steps.number.outputs.content }} "Makefile2txt doesn't have main, leaves, Leaves, roots, Roots, branches, or Branches in it"
#Issue Badge
- name: Get email.txt
id: getEmail
run: node .cbc/getFile.js ${{ secrets.AUTH_TOKEN }} ${{ steps.repo.outputs.content }} email.txt > email.txt
- name: Save Email as Output Variable
id: userEmail
uses: juliangruber/read-file-action@v1
with:
path: email.txt
- name: Comment
run: node .cbc/makeComment.js ${{ secrets.AUTH_TOKEN }} ${{ steps.number.outputs.content }} "Email found - ${{ steps.userEmail.outputs.content }}"
- name: Issue Badge
id: issueBadge
run: node .cbc/badgeAPI.js ${{secrets.USERNAME}} ${{secrets.PASSWORD}} ${{ steps.userEmail.outputs.content }}
- name: Comment
run: node .cbc/makeComment.js ${{ secrets.AUTH_TOKEN }} ${{ steps.number.outputs.content }} "Badge Issued. Congratulations!"
#Failure Output for Problem 1
- name: Failure Comment
if: always() && steps.getMakeFile1.outcome == 'failure'
run: node .cbc/makeComment.js ${{ secrets.AUTH_TOKEN }} ${{ steps.number.outputs.content }} "Error - No Makefile1.txt found"
- name: Failure Comment
if: always() && steps.runMake.outcome == 'failure'
run: node .cbc/makeComment.js ${{ secrets.AUTH_TOKEN }} ${{ steps.number.outputs.content }} "Error - Makefile1.txt didn't run"
- name: Failure Comment
if: always() && steps.runProgram.outcome == 'failure'
run: node .cbc/makeComment.js ${{ secrets.AUTH_TOKEN }} ${{ steps.number.outputs.content }} "Error - Problem 1 tree executable crashed"
- name: Failure Comment
if: always() && steps.properOutput.outcome == 'failure'
run: node .cbc/makeComment.js ${{ secrets.AUTH_TOKEN }} ${{ steps.number.outputs.content }} "Error - Problem 1 tree executable output was incorrect"
- name: Failure Comment
if: always() && steps.makeClean.outcome == 'failure'
run: node .cbc/makeComment.js ${{ secrets.AUTH_TOKEN }} ${{ steps.number.outputs.content }} "Error - Makefile1.txt clean didn't run"
- name: Failure Comment
if: always() && steps.fileGone.outcome == 'failure'
run: node .cbc/makeComment.js ${{ secrets.AUTH_TOKEN }} ${{ steps.number.outputs.content }} "Error - Makefile1.txt clean didn't delete the tree executable"
- name: Failure Comment
if: always() && steps.assertNoVariables.outcome == 'failure'
run: node .cbc/makeComment.js ${{ secrets.AUTH_TOKEN }} ${{ steps.number.outputs.content }} "Error - Makefile1.txt has Variables, Automatic Variables, Pattern Matching, or Makefile Functions"
#Failure Output for Problem 2
- name: Failure Comment
if: always() && steps.getMakeFile2.outcome == 'failure'
run: node .cbc/makeComment.js ${{ secrets.AUTH_TOKEN }} ${{ steps.number.outputs.content }} "Error - No Makefile2.txt found"
- name: Failure Comment
if: always() && steps.runMake2.outcome == 'failure'
run: node .cbc/makeComment.js ${{ secrets.AUTH_TOKEN }} ${{ steps.number.outputs.content }} "Error - Makefile2.txt didn't run"
- name: Failure Comment
if: always() && steps.runProgram2.outcome == 'failure'
run: node .cbc/makeComment.js ${{ secrets.AUTH_TOKEN }} ${{ steps.number.outputs.content }} "Error - Problem 2 tree executable crashed"
- name: Failure Comment
if: always() && steps.properOutput2.outcome == 'failure'
run: node .cbc/makeComment.js ${{ secrets.AUTH_TOKEN }} ${{ steps.number.outputs.content }} "Error - Problem 2 tree executable output was incorrect"
- name: Failure Comment
if: always() && steps.assertCompiled.outcome == 'failure'
run: node .cbc/makeComment.js ${{ secrets.AUTH_TOKEN }} ${{ steps.number.outputs.content }} "Error - compiled.txt doesn't exist, or doesn't contain all files used"
- name: Failure Comment
if: always() && steps.makeClean2.outcome == 'failure'
run: node .cbc/makeComment.js ${{ secrets.AUTH_TOKEN }} ${{ steps.number.outputs.content }} "Error - Makefile2.txt clean didn't run"
- name: Failure Comment
if: always() && steps.fileGone2.outcome == 'failure'
run: node .cbc/makeComment.js ${{ secrets.AUTH_TOKEN }} ${{ steps.number.outputs.content }} "Error - Makefile2.txt clean didn't delete the tree executable, compiled.txt, or all of the .o files"\
- name: Failure Comment
if: always() && steps.assertORule.outcome == 'failure'
run: node .cbc/makeComment.js ${{ secrets.AUTH_TOKEN }} ${{ steps.number.outputs.content }} "Error - Makefile2txt doesn't contain a %.o rule"
- name: Failure Comment
if: always() && steps.assertNoClassNames.outcome == 'failure'
run: node .cbc/makeComment.js ${{ secrets.AUTH_TOKEN }} ${{ steps.number.outputs.content }} "Error - Makefile2txt contains main, leaves, Leaves, roots, Roots, branches, or Branches"
#Failure Output for Issue Badge
- name: Failure Comment
if: always() && steps.getEmail.outcome == 'failure'
run: node .cbc/makeComment.js ${{ secrets.AUTH_TOKEN }} ${{ steps.number.outputs.content }} "Error - No email.txt found"
- name: Failure Comment
if: always() && steps.issueBadge.outcome == 'failure'
run: node .cbc/makeComment.js ${{ secrets.AUTH_TOKEN }} ${{ steps.number.outputs.content }} "Error - Badge issue failed - Email Address wasn't valid"
#Close Pull Request
- name: Close Pull Request
if: always()
uses: peter-evans/close-pull@v1
with:
pull-request-number: ${{ steps.number.outputs.content }}
comment: Auto-closing pull request after submission
delete-branch: false
- name: Remove Previous Labels
if: always()
run: node .cbc/removeAllLabels.js ${{ secrets.AUTH_TOKEN }} ${{ steps.number.outputs.content }}
- name: Add "checkComplete" label
if: always()
run: node .cbc/addLabel.js ${{ secrets.AUTH_TOKEN }} ${{ steps.number.outputs.content }} checkComplete