/
config.yml
160 lines (152 loc) · 4.28 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
154
155
156
157
158
159
160
version: 2.1
orbs:
codecov: codecov/codecov@1.1.1
commands:
create-typeorm-config:
parameters:
databases:
type: string
default: ""
steps:
- when:
condition:
equal: [ << parameters.databases >>, "" ]
steps:
- run:
name: "Enabling Databases in ORM config"
command: cp ormconfig.circleci-common.json ./ormconfig.json
- unless:
condition:
equal: [ << parameters.databases >>, "" ]
steps:
- run:
name: "Enabling Databases in ORM config"
command: >
cat ormconfig.circleci-common.json \
| jq 'map(.skip = if (.name | IN($ARGS.positional[])) then false else true end)' --args << parameters.databases >> \
> ormconfig.json
- run:
name: Check ORMConfig
command: cat ormconfig.json
install-packages:
parameters:
cache-key:
type: string
default: ""
steps:
- restore_cache:
name: Restore node_modules cache
key: node_modules-<< parameters.cache-key >>-{{ checksum "package-lock.json" }}
- run:
name: Verify `package.json` and `package-lock.json` are in sync
command: npx lock-verify
- run:
# This uses `npm install` instead of `npm ci`
# because of https://github.com/npm/cli/issues/558
name: Install Node Packages
command: |
if [ ! -d node_modules ]; then
npm install
fi
- save_cache:
name: Save node_modules cache
key: node_modules-{{ checksum "package-lock.json" }}
paths:
- node_modules
jobs:
lint:
working_directory: ~/typeorm
docker:
- image: circleci/node:12
steps:
- checkout
- install-packages:
cache-key: node12
- run: npm run lint
build:
working_directory: ~/typeorm
docker:
- image: circleci/node:12
steps:
- checkout
- install-packages:
cache-key: node12
- run: npm run compile
- persist_to_workspace:
root: ~/typeorm
paths:
- build/
test:
parameters:
databases:
type: string
default: ""
node-version:
type: string
default: "10"
working_directory: ~/typeorm
docker:
- image: circleci/node:<< parameters.node-version >>
- image: mysql:5.7.24
environment:
MYSQL_ROOT_PASSWORD: "admin"
MYSQL_DATABASE: "test"
- image: mariadb:10.1.37
name: mariadb
environment:
MYSQL_ROOT_PASSWORD: "admin"
MYSQL_DATABASE: "test"
- image: circleci/postgres:9.6.11-postgis
name: postgres
environment:
POSTGRES_USER: "test"
POSTGRES_PASSWORD: "test"
POSTGRES_DB: "test"
- image: cockroachdb/cockroach:v20.1.3
name: cockroachdb
command: start-single-node --insecure
- image: circleci/mongo:3.4.18
name: mongodb
- image: mcr.microsoft.com/mssql/server:2017-latest
name: mssql
environment:
SA_PASSWORD: "Admin123"
ACCEPT_EULA: "Y"
steps:
- checkout
- attach_workspace:
at: ~/typeorm
- create-typeorm-config:
databases: << parameters.databases >>
# Download and cache dependencies
- install-packages:
cache-key: node<< parameters.node-version >>
- run: npx nyc npm run test-fast
- store_artifacts:
path: coverage
- codecov/upload
workflows:
version: 2
test:
jobs:
- lint
- build
- test:
name: test (mysql mariadb sqlite better-sqlite3 postgres sqljs mssql mongodb) - Node v<< matrix.node-version >>
requires:
- lint
- build
matrix:
databases: "mysql mariadb sqlite better-sqlite3 postgres sqljs mssql mongodb"
parameters:
node-version:
- "10"
- "12"
- "13"
- test:
name: test (cockroachdb) - Node v12
requires:
- lint
- build
databases: "cockroachdb"
node-version: "12"