-
Notifications
You must be signed in to change notification settings - Fork 1
/
18761.yml
111 lines (108 loc) · 3.72 KB
/
18761.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
name: WD201 Node.js - L9 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:15.2
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/migrations/*-create-todo.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/todo*
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: "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/l9/__tests__
cp -r submission/todo-app/__tests__ solution/l9
cp submission/todo-app/app.js solution/l9/app.js
cp -r submission/todo-app/models solution/l9
cp -r submission/todo-app/views solution/l9
- name: Run tests in the solution repo
if: steps.copy-submission-files.outcome == 'success'
continue-on-error: true
timeout-minutes: 2
id: run-jest-test
run: |
cd solution/l9
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/l9 && 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/l9/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/l9/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.