-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path19533.yml
122 lines (119 loc) · 4.62 KB
/
19533.yml
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
name: WD301 - L5 Milestone
on:
push:
branches: ["submission-*"]
env:
REVIEW_END_POINT: ${{ secrets.REVIEW_END_POINT }}
REVIEW_BOT_USER_TOKEN: ${{ secrets.REVIEW_BOT_USER_TOKEN }}
jobs:
repo_check:
runs-on: ubuntu-latest
outputs:
outcome: ${{steps.get-submission-url.outcome}}
submissionUrl: ${{steps.get-submission-url.outputs.result}}
steps:
- name: Check out the parent repository with student submission data
uses: actions/checkout@v2
- name: Extract the student submission repo from URL
uses: actions/github-script@v6
id: get-submission-url
continue-on-error: true
with:
script: |
const submission = require('./submission.json')
const netlifyUrl = submission.checklist[1].result
if (netlifyUrl.includes("netlify.app")) {
return netlifyUrl
} else {
throw "The submitted webpage URL seems to be invalid."
}
result-encoding: string
- name: Report invalid webpage URL in submission
if: steps.get-submission-url.outcome != 'success'
uses: pupilfirst/grade-action@v1
with:
fail_submission: true
feedback: |
The URL you submitted is either invalid or does not look like a
Netlify app URL. Please make sure that you submit the URL of an
app hosted using Netlify, which should look something like this:
`https://NAME.netlify.app`.
tests:
needs: repo_check
if: needs.repo_check.outputs.outcome == 'success'
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout student repo and verify its structure
id: check-student-repo
uses: pupilfirst/check-repo-action@v1
with:
repoPath: submission
globs: |-
.gitignore
hello-react/*
smarter-tasks/public/*
smarter-tasks/src/hooks/useLocalStorage.ts
smarter-tasks/src/App.tsx
smarter-tasks/src/Header.tsx
smarter-tasks/src/HomePage.tsx
smarter-tasks/src/index.tsx
smarter-tasks/src/NotFound.tsx
smarter-tasks/src/ProtectedRoute.tsx
smarter-tasks/src/Signin.tsx
smarter-tasks/src/Task.tsx
smarter-tasks/src/TaskApp.tsx
smarter-tasks/src/TaskCard.css
smarter-tasks/src/TaskDetailsPage.tsx
smarter-tasks/src/TaskForm.tsx
smarter-tasks/src/TaskList.tsx
smarter-tasks/package.json
smarter-tasks/package-lock.json
- name: Report to LMS that tests are in progress
if: steps.check-student-repo.outputs.result == 'success'
uses: pupilfirst/report-action@v1
with:
status: in_progress
description: Automated tests are in progress
- name: Check out the tests repo
if: steps.check-student-repo.outputs.result == 'success'
uses: actions/checkout@v2
id: checkout-tests-repo
with:
repository: pupilfirst/wd301-tests
path: tests
- name: Copy submission files to tests folder
if: steps.checkout-tests-repo.outcome == 'success'
id: copy-report-generator
run: cp tests/helpers/generateReportFromResults.js tests/l5/generateReportFromResults.js
- name: Run cypress tests
continue-on-error: true
if: steps.copy-report-generator.outcome == 'success'
timeout-minutes: 2
run: |
cd tests/l5
npm install
npm run cy:run -- --env STUDENT_SUBMISSION_URL="${{needs.repo_check.outputs.submissionUrl}}"
- name: Use Node.js to generate report
if: steps.copy-report-generator.outcome == 'success'
id: generate-report
run: cd tests/l5 && node generateReportFromResults.js
- name: Report to LMS the outcome of tests.
if: steps.generate-report.outcome == 'success'
uses: pupilfirst/report-action@v1
id: report-test-results
with:
report_file_path: tests/l5/report.json
- name: Grade the submission based on test results
uses: pupilfirst/grade-action@v1
if: steps.generate-report.outcome == 'success'
with:
report_file_path: tests/l5/report.json
- name: Report error to LMS
if: steps.report-test-results.outcome == 'skipped'
uses: pupilfirst/report-action@v1
with:
status: "error"
description: |
Automated tests could not be run successfully. Please ask a member
of the Pupilfirst team to look into this submission's VTA logs.