forked from keystonejs/keystone
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.yml
153 lines (140 loc) · 4.68 KB
/
config.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
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
# Javascript Node CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
#
version: 2
x-job-setup: &job-setup
docker:
# specify the version you desire here
- image: circleci/node:dubnium-browsers
environment:
TEST_DATABASE_URL: postgresql://root@localhost/circle_test
KNEX_URI: 'postgres://keystone5:k3yst0n3@localhost:5432/circle_test'
- image: mongo:4.0.0
- image: circleci/postgres:9.6.5-alpine-ram
working_directory: /home/circleci/repo
# Download and cache dependencies
x-restore-cache: &restore-cache
keys:
- v15-dependencies-{{ checksum "yarn.lock" }}
# fallback to using the latest cache if no exact match is found
- v15-dependencies-
x-save-cache: &save-cache
paths:
- node_modules
key: v15-dependencies-{{ checksum "yarn.lock" }}
x-integration-steps: &integration-steps
steps:
- checkout
- run:
name: Yarn - Install packages
command: CYPRESS_CACHE_FOLDER=$CIRCLE_WORKING_DIRECTORY/node_modules/cypress/.cache/ yarn
- save_cache: *save-cache
- run:
name: 'Is test required'
command: node ./.circleci/run-or-bail.js
- run:
name: E2E Cypress tests
command: CYPRESS_CACHE_FOLDER=$CIRCLE_WORKING_DIRECTORY/node_modules/cypress/.cache/ yarn --cwd $PROJECT_DIRECTORY cypress:run:ci
- run:
name: Prepare artifacts
command: |
mv "$PROJECT_DIRECTORY"/cypress/{videos,screenshots} /tmp || true
when: always
- run:
name: Prepare reports
command: |
cd "$PROJECT_DIRECTORY"
[ -d cypress/reports ] && `yarn bin`/junit-merge -d cypress/reports -C -o /tmp/reports/cypress/report.xml || true
when: always
- store_test_results:
path: /tmp/reports
- store_artifacts:
path: /tmp/reports
- store_artifacts:
path: /tmp/videos
- store_artifacts:
path: /tmp/screenshots
x-simple-tests: &simple-tests
steps:
- checkout
# Set Cypress cache dir here, in case this job runs/completes first, and
# hence clobbers the `node_modules` cache with a non-cypress version,
# causing the other job to fail with a "Missing Cypress" error.
- run: CYPRESS_CACHE_FOLDER=$CIRCLE_WORKING_DIRECTORY/node_modules/cypress/.cache/ yarn
- save_cache: *save-cache
- run: yarn lint:eslint --format junit -o reports/junit/js-lint-results.xml
- run: yarn lint:prettier
- run: yarn lint:markdown
- run:
name: 'Is test required'
command: node ./.circleci/run-or-bail.js
- run: sudo apt-get update
- run: sudo apt-get install postgresql-client-9.6
- run: psql -d $TEST_DATABASE_URL -c "CREATE SCHEMA keystone;"
- run: psql -d $TEST_DATABASE_URL -c "CREATE USER keystone5 PASSWORD 'k3yst0n3';"
- run: psql -d $TEST_DATABASE_URL -c "GRANT ALL ON SCHEMA keystone TO keystone5;"
# run tests!
- run:
name: Unit tests
command: yarn jest --ci --reporters=default --reporters=jest-junit --maxWorkers=1
environment:
JEST_JUNIT_OUTPUT: 'reports/junit/js-test-results.xml'
- store_test_results:
path: reports/junit
- store_artifacts:
path: reports/junit
jobs:
simple_tests:
<<: *job-setup
<<: *restore-cache
<<: *simple-tests
integration_tests_basic:
environment:
PROJECT_DIRECTORY: test-projects/basic
CLOUDINARY_CLOUD_NAME: $CLOUDINARY_CLOUD_NAME
CLOUDINARY_KEY: $CLOUDINARY_KEY
CLOUDINARY_SECRET: $CLOUDINARY_SECRET
PORT: 3000
<<: *job-setup
<<: *restore-cache
<<: *integration-steps
integration_tests_login:
environment:
PROJECT_DIRECTORY: test-projects/login
PORT: 3000
<<: *job-setup
<<: *restore-cache
<<: *integration-steps
integration_tests_accesscontrol:
environment:
PROJECT_DIRECTORY: test-projects/access-control
PROJECT_NAME: 'Cypress Test Project For Access Control'
PORT: 3000
<<: *job-setup
<<: *restore-cache
<<: *integration-steps
integration_tests_clientvalidation:
environment:
PROJECT_DIRECTORY: test-projects/client-validation
PROJECT_NAME: 'Cypress Test Project For Client Validation'
PORT: 3000
<<: *job-setup
<<: *restore-cache
<<: *integration-steps
# integration_tests_twitterlogin:
# environment:
# PROJECT_DIRECTORY: test-projects/twitter-login
# PORT: 3000
# <<: *job-setup
# <<: *integration-steps
workflows:
version: 2
tests:
jobs:
- simple_tests
- integration_tests_basic
- integration_tests_login
# - integration_tests_twitterlogin
- integration_tests_accesscontrol
- integration_tests_clientvalidation