ci: add test & benchmark

This commit is contained in:
undefined committed 2022-04-04 21:50:33 +08:00
1 parent 5c1217dc60
commit d589217a75
20 files changed
+155 -52

No files matched your search

+13 -14
View File
@@ -12,20 +12,20 @@
},
"preferUnplugged": true,
"dependencies": {
"@graphql-tools/schema": "^8.3.2",
"@graphql-tools/schema": "^8.3.6",
"@hydrooj/utils": "workspace:*",
"adm-zip": "0.5.5",
"ajv": "^8.10.0",
"ajv": "^8.11.0",
"ansi_up": "^5.1.0",
"cac": "^6.7.12",
"cookies": "^0.8.0",
"detect-browser": "^5.3.0",
"emoji-regex": "^10.0.1",
"emoji-regex": "^10.1.0",
"emojis-list": "2.1.0",
"esbuild": "0.14.3",
"fs-extra": "^10.0.1",
"graphql": "^16.3.0",
"graphql-scalars": "1.15.0",
"graphql-scalars": "1.17.0",
"js-yaml": "^4.1.0",
"koa": "^2.13.4",
"koa-body": "^4.2.0",
@@ -34,40 +34,39 @@
"koa-router": "^10.1.1",
"koa-static-cache": "^5.1.4",
"lodash": "^4.17.21",
"lru-cache": "7.4.4",
"mime-types": "^2.1.34",
"lru-cache": "7.7.3",
"mime-types": "^2.1.35",
"minio": "7.0.25",
"moment-timezone": "^0.5.34",
"mongodb": "^3.7.3",
"nanoid": "^3.3.1",
"nodemailer": "^6.7.2",
"nanoid": "^3.3.2",
"nodemailer": "^6.7.3",
"notp": "^2.0.3",
"p-queue": "^7.2.0",
"reflect-metadata": "^0.1.13",
"require-resolve-hook": "^1.1.0",
"semver": "^7.3.5",
"serialize-javascript": "^6.0.0",
"sockjs": "^0.3.24",
"source-map-support": "^0.5.21",
"superagent": "^7.1.1",
"superagent": "^7.1.2",
"thirty-two": "^1.0.2",
"tx2": "^1.0.5"
},
"devDependencies": {
"@types/adm-zip": "^0.4.34",
"@types/adm-zip": "^0.5.0",
"@types/fs-extra": "^9.0.13",
"@types/js-yaml": "^4.0.5",
"@types/koa": "^2.13.4",
"@types/koa-compress": "^4.0.3",
"@types/koa-router": "^7.4.4",
"@types/koa-static-cache": "^5.1.1",
"@types/lodash": "^4.14.179",
"@types/lru-cache": "^7.4.0",
"@types/lodash": "^4.14.181",
"@types/lru-cache": "^7.6.1",
"@types/mime-types": "^2.1.1",
"@types/minio": "^7.0.12",
"@types/mongodb": "^3.6.20",
"@types/nodemailer": "^6.4.4",
"@types/notp": "^2.0.1",
"@types/notp": "^2.0.2",
"@types/semver": "^7.3.9",
"@types/serialize-javascript": "^5.0.2",
"@types/sockjs": "^0.3.33",
+1 -1
View File
@@ -39,7 +39,7 @@ export function registerResolver(
registerValue(typeName, key, value, description);
const wrappedFunc = async (arg, ctx, info) => {
const res = await func(arg, ctx, info);
if (typeof res !== 'object') return res;
if (typeof res !== 'object' || res === null) return res;
const node = value.includes('!') ? value.split('!')[0] : value;
if (handlers[node]) Object.assign(res, handlers[node]);
ctx.parent = res;
-1
View File
@@ -1,7 +1,6 @@
/* eslint-disable simple-import-sort/imports */
/* eslint-disable no-await-in-loop */
/* eslint-disable no-eval */
import 'reflect-metadata';
import './init';
import './interface';
import path from 'path';
+1
View File
@@ -12,6 +12,7 @@ const coll = db.collection('task');
const collEvent = db.collection('event');
async function getFirst(query: FilterQuery<Task>) {
if (process.env.CI) return null;
const q = { ...query };
q.executeAfter = q.executeAfter || { $lt: new Date() };
const res = await coll.findOneAndDelete(q, { sort: { priority: -1 } });
+6 -1
View File
@@ -34,8 +34,13 @@ class MongoService implements BaseService {
}
async start(opts: MongoConfig) {
let mongourl = MongoService.buildUrl(opts);
if (process.env.CI) {
const { MongoMemoryServer } = require('mongodb-memory-server');
const mongod = await MongoMemoryServer.create();
mongourl = mongod.getUri();
}
this.opts = opts;
const mongourl = MongoService.buildUrl(opts);
this.client = await MongoClient.connect(mongourl, { useNewUrlParser: true, useUnifiedTopology: true });
this.db = this.client.db(opts.name);
await bus.parallel('database/connect', this.db);