diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..6cc56aa --- /dev/null +++ b/.drone.yml @@ -0,0 +1,20 @@ +--- +kind: pipeline +name: tests:latest +clone: + disable: true +steps: +- name: checkout pr + image: alpine/git + commands: + - git clone $DRONE_REMOTE_URL . + - git checkout $DRONE_SOURCE_BRANCH + - mv .env.ci .env +- name: run tests + image: node:alpine + commands: + - yarn + - yarn test:ci +trigger: + event: + - pull_request \ No newline at end of file diff --git a/.env.ci b/.env.ci new file mode 100644 index 0000000..6103f14 --- /dev/null +++ b/.env.ci @@ -0,0 +1,8 @@ +APP_PORT=4010 +DB_TYPE=sqlite +DB_HOST=unused +DB_PORT=unused +DB_USER=unused +DB_PASSWORD=bla +DB_NAME=./test.sqlite +NODE_ENV=production \ No newline at end of file diff --git a/package.json b/package.json index 7ba0e96..6715b59 100644 --- a/package.json +++ b/package.json @@ -1,69 +1,85 @@ -{ - "name": "@lfk/backend", - "version": "1.0.0", - "main": "src/app.ts", - "repository": "https://git.odit.services/lfk/backend", - "author": { - "name": "ODIT.Services", - "email": "info@odit.services", - "url": "https://odit.services" - }, - "contributors": [ - { - "name": "Philipp Dormann", - "email": "philipp@philippdormann.de", - "url": "https://philippdormann.de" - }, - { - "name": "Nicolai Ort", - "email": "info@nicolai-ort.com", - "url": "https://nicolai-ort.com" - } - ], - "license": "CC-BY-NC-SA-4.0", - "dependencies": { - "argon2": "^0.27.0", - "body-parser": "^1.19.0", - "class-transformer": "^0.3.1", - "class-validator": "^0.12.2", - "class-validator-jsonschema": "^2.0.3", - "consola": "^2.15.0", - "cors": "^2.8.5", - "dotenv": "^8.2.0", - "express": "^4.17.1", - "helmet": "^4.2.0", - "jsonwebtoken": "^8.5.1", - "multer": "^1.4.2", - "mysql": "^2.18.1", - "pg": "^8.5.1", - "reflect-metadata": "^0.1.13", - "routing-controllers": "^0.9.0-alpha.6", - "routing-controllers-openapi": "^2.1.0", - "swagger-ui-express": "^4.1.5", - "typeorm": "^0.2.29", - "typeorm-routing-controllers-extensions": "^0.2.0", - "typeorm-seeding": "^1.6.1", - "uuid": "^8.3.1" - }, - "devDependencies": { - "@types/cors": "^2.8.8", - "@types/dotenv": "^8.2.0", - "@types/express": "^4.17.9", - "@types/jsonwebtoken": "^8.5.0", - "@types/multer": "^1.4.4", - "@types/node": "^14.14.9", - "@types/swagger-ui-express": "^4.1.2", - "@types/uuid": "^8.3.0", - "nodemon": "^2.0.6", - "sqlite3": "^5.0.0", - "ts-node": "^9.0.0", - "typedoc": "^0.19.2", - "typescript": "^4.1.2" - }, - "scripts": { - "dev": "nodemon src/app.ts", - "build": "tsc", - "docs": "typedoc --out docs src", - "seed": "ts-node ./node_modules/typeorm-seeding/dist/cli.js seed" - } +{ + "name": "@lfk/backend", + "version": "1.0.0", + "main": "src/app.ts", + "repository": "https://git.odit.services/lfk/backend", + "author": { + "name": "ODIT.Services", + "email": "info@odit.services", + "url": "https://odit.services" + }, + "contributors": [ + { + "name": "Philipp Dormann", + "email": "philipp@philippdormann.de", + "url": "https://philippdormann.de" + }, + { + "name": "Nicolai Ort", + "email": "info@nicolai-ort.com", + "url": "https://nicolai-ort.com" + } + ], + "license": "CC-BY-NC-SA-4.0", + "dependencies": { + "argon2": "^0.27.0", + "body-parser": "^1.19.0", + "class-transformer": "^0.3.1", + "class-validator": "^0.12.2", + "class-validator-jsonschema": "^2.0.3", + "consola": "^2.15.0", + "cors": "^2.8.5", + "dotenv": "^8.2.0", + "express": "^4.17.1", + "helmet": "^4.2.0", + "jsonwebtoken": "^8.5.1", + "multer": "^1.4.2", + "mysql": "^2.18.1", + "pg": "^8.5.1", + "reflect-metadata": "^0.1.13", + "routing-controllers": "^0.9.0-alpha.6", + "routing-controllers-openapi": "^2.1.0", + "swagger-ui-express": "^4.1.5", + "typeorm": "^0.2.29", + "typeorm-routing-controllers-extensions": "^0.2.0", + "typeorm-seeding": "^1.6.1", + "uuid": "^8.3.1" + }, + "devDependencies": { + "@types/cors": "^2.8.8", + "@types/dotenv": "^8.2.0", + "@types/express": "^4.17.9", + "@types/jest": "^26.0.16", + "@types/jsonwebtoken": "^8.5.0", + "@types/multer": "^1.4.4", + "@types/node": "^14.14.9", + "@types/swagger-ui-express": "^4.1.2", + "@types/uuid": "^8.3.0", + "axios": "^0.21.0", + "dotenv-safe": "^8.2.0", + "jest": "^26.6.3", + "nodemon": "^2.0.6", + "sqlite3": "^5.0.0", + "start-server-and-test": "^1.11.6", + "ts-jest": "^26.4.4", + "ts-node": "^9.0.0", + "typedoc": "^0.19.2", + "typescript": "^4.1.2" + }, + "scripts": { + "dev": "nodemon src/app.ts", + "build": "tsc", + "docs": "typedoc --out docs src", + "test": "jest", + "test:watch": "jest --watchAll", + "test:ci": "start-server-and-test dev http://localhost:4010/api/openapi.json test", + "seed": "ts-node ./node_modules/typeorm/cli.js schema:sync && ts-node ./node_modules/typeorm-seeding/dist/cli.js seed" + }, + "nodemonConfig": { + "ignore": [ + "src/tests/*", + "docs/*" + ], + "delay": "2500" + } } \ No newline at end of file