forked from typeorm/typeorm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'typeorm-0.2.30' into zs/merge-typeorm-0.2.30
* typeorm-0.2.30: (212 commits) version bump docs: fix javascript usage examples (typeorm#7031) fix: resolve migration for UpdateDateColumn without ON UPDATE clause (typeorm#7057) fix: Error when sorting by an embedded entity while using join and skip/take (typeorm#7082) fix: resolves Postgres sequence identifier length error (typeorm#7115) feat: closure table custom naming (typeorm#7120) feat: relations: Orphaned row action (typeorm#7105) docs: fix invalid code block in "find many options" (typeorm#7268) docs: Embodying the example (typeorm#7116) docs: document withDeleted option (typeorm#7132) fix: return 'null' (instead of 'undefined') on lazy relations that have no results (typeorm#7146) (typeorm#7147) docs: update cascade options (typeorm#7140) docs: add .ts to supported ormconfig formats (typeorm#7139) fix: improve stack traces when using persist executor (typeorm#7218) refactor: remove Oracle multirow insert workaround (since typeorm#6927) (typeorm#7083) feat: add NOWAIT and SKIP LOCKED lock support for MySQL (typeorm#7236) docs: update OneToMany grammar (typeorm#7252) feat: JavaScript file migrations output (typeorm#7253) docs: update Repository.ts (typeorm#7254) chore: update dependency cli-highlight to v2.1.10 (typeorm#7265) ...
- Loading branch information
Showing
473 changed files
with
16,611 additions
and
6,657 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,114 +1,215 @@ | ||
# Javascript Node CircleCI 2.0 configuration file | ||
# Check https://circleci.com/docs/2.0/language-javascript/ for more details | ||
version: 2 | ||
jobs: | ||
common: | ||
working_directory: ~/typeorm | ||
docker: | ||
- image: circleci/node:10.16.0 | ||
- 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 | ||
environment: | ||
POSTGRES_USER: "test" | ||
POSTGRES_PASSWORD: "test" | ||
POSTGRES_DB: "test" | ||
- image: circleci/mongo:3.4.18 | ||
# - image: mcr.microsoft.com/mssql/server:2017-latest-ubuntu | ||
# environment: | ||
# SA_PASSWORD: "Admin12345" | ||
# ACCEPT_EULA: "Y" | ||
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: | ||
- checkout | ||
- run: cp ormconfig.circleci-common.json ormconfig.json | ||
# Download and cache dependencies | ||
- restore_cache: | ||
keys: | ||
- v1-dependencies-{{ checksum "package.json" }} | ||
# fallback to using the latest cache if no exact match is found | ||
- v1-dependencies- | ||
- run: npm install | ||
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 | ||
- run: | ||
# This is pretty terrible but OracleDB requires you to grab the binaries OOB | ||
# from the normal installation, place them in the LD Path | ||
# also - not super well documented - grab `libaio` as well | ||
# Because this is technically the same image as the runner we'll snag | ||
# the libaio1 and place them in the same instantclient directory. | ||
name: Download Required OracleDB Binaries | ||
command: | | ||
if [ ! -d node_modules/oracledb/instantclient_19_8 ]; then | ||
curl -sf -o node_modules/oracledb/instantclient.zip $BLOB_URL | ||
unzip -qqo node_modules/oracledb/instantclient.zip -d node_modules/oracledb/ | ||
rm node_modules/oracledb/instantclient.zip | ||
DEBIAN_FRONTEND=noninteractive sudo apt-get -qq -y install libaio1 | ||
cp /lib/*/libaio.so.* node_modules/oracledb/instantclient_19_8/ | ||
fi | ||
environment: | ||
BLOB_URL: https://download.oracle.com/otn_software/linux/instantclient/19800/instantclient-basiclite-linux.x64-19.8.0.0.0dbru.zip | ||
- save_cache: | ||
name: Save node_modules cache | ||
key: node_modules-{{ checksum "package-lock.json" }} | ||
paths: | ||
- node_modules | ||
key: v1-dependencies-{{ checksum "package.json" }} | ||
|
||
jobs: | ||
lint: | ||
working_directory: ~/typeorm | ||
docker: | ||
- image: circleci/node:12 | ||
steps: | ||
- checkout | ||
- install-packages: | ||
cache-key: node12 | ||
- run: npm run lint | ||
- run: npm test | ||
|
||
cockroachdb: | ||
build: | ||
working_directory: ~/typeorm | ||
docker: | ||
- image: circleci/node:10.15.0 | ||
- image: cockroachdb/cockroach:latest | ||
command: start --insecure | ||
- image: circleci/node:12 | ||
steps: | ||
- checkout | ||
- run: cp ormconfig.circleci-cockroach.json ormconfig.json | ||
# Download and cache dependencies | ||
- restore_cache: | ||
keys: | ||
- v1-dependencies-{{ checksum "package.json" }} | ||
# fallback to using the latest cache if no exact match is found | ||
- v1-dependencies- | ||
- run: npm install | ||
- save_cache: | ||
- install-packages: | ||
cache-key: node12 | ||
- run: npm run compile | ||
- persist_to_workspace: | ||
root: ~/typeorm | ||
paths: | ||
- node_modules | ||
key: v1-dependencies-{{ checksum "package.json" }} | ||
- run: npm run lint | ||
- run: | ||
npm test | ||
oracle: | ||
- build/ | ||
|
||
test: | ||
parameters: | ||
databases: | ||
type: string | ||
default: "" | ||
node-version: | ||
type: string | ||
default: "10" | ||
working_directory: ~/typeorm | ||
docker: | ||
- image: circleci/node:10.16.0 | ||
- image: "store/oracle/database-enterprise:12.2.0.1-slim" | ||
auth: | ||
username: $DOCKER_USER | ||
password: $DOCKER_PASSWORD | ||
environment: | ||
DB_SID: "sys" | ||
SYS_PASSWORD: "ORCLCDB" | ||
- image: circleci/node:<< parameters.node-version >> | ||
steps: | ||
- run: if [ -z "$DOCKER_USER" ]; then echo "DOCKER_USER is unset"; circleci step halt; fi | ||
- checkout | ||
- run: sudo npm install -g npm@latest | ||
- run: cp ormconfig.circleci-oracle.json ormconfig.json | ||
- setup_remote_docker | ||
- attach_workspace: | ||
at: ~/typeorm | ||
- create-typeorm-config: | ||
databases: << parameters.databases >> | ||
- run: | ||
name: Start all Relevant Services | ||
command: | | ||
SERVICES=$( | ||
npx js-yaml ./docker-compose.yml \ | ||
| jq -r '.services | keys | map(select(. | IN($ARGS.positional[]))) | join(" ")' --args << parameters.databases >> | ||
) | ||
docker-compose --project-name typeorm --no-ansi up --detach $SERVICES | ||
- install-packages: | ||
cache-key: node<< parameters.node-version >> | ||
- run: | ||
name: Set up TypeORM Test Runner | ||
command: | | ||
docker run \ | ||
--volume /typeorm \ | ||
--name typeorm-code \ | ||
--workdir /typeorm \ | ||
circleci/node:<< parameters.node-version >> \ | ||
/bin/bash -c "sudo chmod 777 /typeorm && sudo chown circleci /typeorm" | ||
docker cp ./ typeorm-code:/typeorm | ||
- run: | ||
name: Wait for Services to be Available | ||
command: | | ||
COMMANDS=$( | ||
cat ormconfig.json \ | ||
| jq -r ' | ||
map(select(.skip == false) | ||
| select(.host) | ||
| select(.port) | ||
| "nc -z " + .host + " " + (.port|tostring) + " && echo " + .host + " " + (.port|tostring) + " is up") | ||
| join(" && ") | ||
' | ||
) | ||
echo "Running '$COMMANDS'" | ||
docker run \ | ||
--network typeorm_default \ | ||
--tty \ | ||
ubuntu:trusty \ | ||
timeout 60 sh -c "until ($COMMANDS); do echo \"Waiting for Services to be Available ...\"; sleep 5; done" | ||
# Download and cache dependencies | ||
- restore_cache: | ||
keys: | ||
- v1-dependencies-{{ checksum "package.json" }} | ||
# fallback to using the latest cache if no exact match is found | ||
- v1-dependencies- | ||
- run: npm install | ||
- save_cache: | ||
paths: | ||
- node_modules | ||
key: v1-dependencies-{{ checksum "package.json" }} | ||
- run: wget https://download.oracle.com/otn_software/linux/instantclient/195000/instantclient-basiclite-linux.x64-19.5.0.0.0dbru.zip | ||
- run: unzip instantclient-basiclite-linux.x64-19.5.0.0.0dbru.zip -d /tmp/oracle | ||
- run: wget https://download.oracle.com/otn_software/linux/instantclient/195000/instantclient-sqlplus-linux.x64-19.5.0.0.0dbru.zip | ||
- run: unzip instantclient-sqlplus-linux.x64-19.5.0.0.0dbru.zip -d /tmp/oracle | ||
- run: echo "export LD_LIBRARY_PATH=/tmp/oracle/instantclient_19_5" >> $BASH_ENV | ||
- run: sudo sh -c "echo /tmp/oracle/instantclient_19_5 > /etc/ld.so.conf.d/oracle-instantclient.conf";sudo ldconfig | ||
- run: sh -c 'echo WHENEVER SQLERROR EXIT FAILURE > /tmp/user.sql; echo CREATE USER typeorm IDENTIFIED BY Passw0rd\; >> /tmp/user.sql; echo GRANT CONNECT TO typeorm\; >> /tmp/user.sql; echo GRANT UNLIMITED TABLESPACE TO typeorm\; >> /tmp/user.sql; echo exit >> /tmp/user.sql' | ||
- run: sudo apt install libaio1 | ||
- run: until /tmp/oracle/instantclient_19_5/sqlplus -L -S sys/Oradoc_db1@//localhost:1521/orclpdb1.localdomain as sysdba @/tmp/user.sql ; do echo waiting for oracle; sleep 10; done; | ||
- run: npm install oracledb --no-save | ||
- run: npm run lint | ||
- run: npm test | ||
- run: | ||
name: "Run Tests with Coverage" | ||
command: | | ||
docker run \ | ||
--env LD_LIBRARY_PATH='/typeorm/node_modules/oracledb/instantclient_19_8/:$LD_LIBRARY_PATH' \ | ||
--volumes-from typeorm-code \ | ||
--network typeorm_default \ | ||
--tty \ | ||
--workdir /typeorm \ | ||
--name typeorm-testrunner \ | ||
circleci/node:<< parameters.node-version >> \ | ||
npx nyc npm run test-fast | ||
docker cp typeorm-testrunner:/typeorm/coverage/ ./ | ||
- run: | ||
name: Stop all Relevant Services | ||
command: docker-compose down | ||
- store_artifacts: | ||
path: coverage | ||
- codecov/upload | ||
|
||
workflows: | ||
version: 2 | ||
test: | ||
jobs: | ||
- common | ||
- cockroachdb | ||
# - oracle | ||
- lint | ||
- build | ||
- test: | ||
name: test (mysql mariadb postgres mssql mongodb sqlite better-sqlite3 sqljs) - Node v<< matrix.node-version >> | ||
requires: | ||
- lint | ||
- build | ||
databases: "mysql mariadb postgres mssql mongodb sqlite better-sqlite3 sqljs" | ||
matrix: | ||
parameters: | ||
node-version: | ||
- "10" | ||
- "12" | ||
- "13" | ||
- test: | ||
name: test (cockroachdb) - Node v12 | ||
requires: | ||
- lint | ||
- build | ||
databases: "cockroachdb" | ||
node-version: "12" | ||
- test: | ||
name: test (oracle) - Node v12 | ||
requires: | ||
- lint | ||
- build | ||
databases: "oracle" | ||
node-version: "12" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
module.exports = { | ||
"env": { | ||
"node": true | ||
}, | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"project": "tsconfig.json", | ||
"sourceType": "module" | ||
}, | ||
"plugins": [ | ||
"@typescript-eslint" | ||
], | ||
"rules": { | ||
"@typescript-eslint/no-unused-vars": [ | ||
"error", | ||
{ | ||
"args": "none" | ||
} | ||
], | ||
"@typescript-eslint/prefer-namespace-keyword": "error", | ||
"@typescript-eslint/quotes": [ | ||
"error", | ||
"double", | ||
{ | ||
"avoidEscape": true, | ||
"allowTemplateLiterals": true | ||
} | ||
], | ||
"@typescript-eslint/semi": [ | ||
"error" | ||
], | ||
"@typescript-eslint/type-annotation-spacing": "error", | ||
"@typescript-eslint/no-redeclare": "error", | ||
"eqeqeq": [ | ||
"error", | ||
"smart" | ||
], | ||
"id-blacklist": [ | ||
"error", | ||
"any", | ||
"Number", | ||
"number", | ||
"String", | ||
"string", | ||
"Boolean", | ||
"boolean", | ||
"Undefined", | ||
"undefined" | ||
], | ||
"id-match": "error", | ||
"no-eval": "error", | ||
"no-var": "error" | ||
} | ||
}; |
Oops, something went wrong.