-
Notifications
You must be signed in to change notification settings - Fork 1
/
18739.yml
98 lines (95 loc) · 3.59 KB
/
18739.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
name: W101 - Capstone
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@v5
id: get-submission-url
continue-on-error: true
with:
script: |
const submission = require('./submission.json')
const gitURL = submission.checklist[1].result
if ((gitURL.split("/").length >= 2) && gitURL.includes("github.io")) {
return gitURL
} 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
GitHub pages URL. Please make sure that you submit a GitHub Pages
URL, which should look something like this: `https://USERNAME.github.io/wd101`.
tests:
needs: repo_check
if: needs.repo_check.outputs.outcome == 'success'
runs-on: ubuntu-latest
strategy:
matrix:
ruby: ["3.2.1"]
steps:
- name: Checkout student repo and verify its structure
id: check-student-repo
uses: pupilfirst/check-repo-action@v1
with:
repoPath: submission
globs: |-
index.html
index.js
- name: Check out the repository with solutions and tests
if: ${{ steps.check-student-repo.outputs.result == 'success' }}
id: checkout-solutions-repo
uses: actions/checkout@v2
with:
repository: "pupilfirst/wd101-capstone-test"
path: solution
- name: Report to LMS tests in progress
if: steps.checkout-solutions-repo.outcome == 'success'
uses: pupilfirst/report-action@v1
with:
status: "in_progress"
description: "The automated tests are in progress"
- name: Hack to run cypress on root
if: steps.checkout-solutions-repo.outcome == 'success'
run: |
cp solution/package.json package.json
cp solution/package-lock.json package-lock.json
- name: Cypress run with env
if: steps.checkout-solutions-repo.outcome == 'success'
uses: cypress-io/github-action@v4
continue-on-error: true
with:
browser: chrome
project: ./solution
env: STUDENT_SUBMISSION_URL=${{needs.repo_check.outputs.submissionUrl}}
- name: Use Node.js to generate report
if: steps.checkout-solutions-repo.outcome == 'success'
run: |
cd solution && node generateReportFromResults.js
- name: Grade the submission based on test results
if: steps.checkout-solutions-repo.outcome == 'success'
uses: pupilfirst/grade-action@v1
with:
report_file_path: "solution/report.json"
- name: Report to LMS the outcome of tests.
if: steps.checkout-solutions-repo.outcome == 'success'
uses: pupilfirst/report-action@v1
with:
report_file_path: "solution/report.json"