-
Notifications
You must be signed in to change notification settings - Fork 1
/
18762.yml
120 lines (117 loc) · 4.16 KB
/
18762.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
name: WD201 Node.js - L10 Milestone
on:
push:
branches: ["submission-*"]
env:
REVIEW_END_POINT: ${{ secrets.REVIEW_END_POINT }}
REVIEW_BOT_USER_TOKEN: ${{ secrets.REVIEW_BOT_USER_TOKEN }}
PG_DATABASE: todo_db_test
PG_USER: postgres
PG_PASSWORD: postgres
jobs:
tests:
runs-on: ubuntu-latest
timeout-minutes: 10
services:
postgres:
image: postgres:11.7
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: todo_db_test
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
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-world/*
http-server/*
todo-cli/*
todo-app/__tests__/todos.js
todo-app/.husky/pre-commit
todo-app/models/index.js
todo-app/models/todo.js
todo-app/models/user.js
todo-app/config/config.json
todo-app/migrations/*-create-todo.js
todo-app/migrations/*-create-user.js
todo-app/migrations/*-add-user-id-in-todos.js
todo-app/public/css/styles.css
todo-app/views/footer.ejs
todo-app/views/header.ejs
todo-app/views/index.ejs
todo-app/views/login.ejs
todo-app/views/signup.ejs
todo-app/views/todo.ejs
todo-app/views/todos.ejs
todo-app/app.js
todo-app/index.js
todo-app/package.json
todo-app/package-lock.json
- name: Report to LMS tests in progress
if: steps.check-student-repo.outputs.result == 'success'
uses: pupilfirst/report-action@v1
with:
status: "in_progress"
description: "The automated tests are in progress"
- 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/wd201-tests
path: solution
- name: Copy submission test files to solution
if: steps.checkout-solutions-repo.outcome == 'success'
id: copy-submission-files
run: |
rm -rf solution/l10/__tests__
cp -r submission/todo-app/__tests__ solution/l10
cp submission/todo-app/app.js solution/l10/app.js
rm -rf solution/l10/migrations solution/l10/models solution/l10/views
cp -r submission/todo-app/migrations solution/l10
cp -r submission/todo-app/models solution/l10
cp -r submission/todo-app/views solution/l10
- name: Run tests in the solution repo
if: steps.copy-submission-files.outcome == 'success'
continue-on-error: true
id: run-jest-test
timeout-minutes: 2
run: |
cd solution/l10
npm install
npm run test
- name: Use Node.js to generate report
if: steps.copy-submission-files.outcome == 'success'
id: generate-report
run: |
cd solution/l10 && 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: "solution/l10/report.json"
- name: Grade the submission based on test results
if: steps.generate-report.outcome == 'success'
uses: pupilfirst/grade-action@v1
with:
report_file_path: "solution/l10/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.