Skip to content

Commit 57a6f8c

Browse files
committed
update github action
1 parent 6a08b5b commit 57a6f8c

File tree

8 files changed

+34
-44
lines changed

8 files changed

+34
-44
lines changed

.github/workflows/node.js.yml

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -60,24 +60,11 @@ jobs:
6060
with:
6161
java-version: 21
6262
- run: npm install
63-
- run: npm install clickhouse
64-
- run: npm install redis
65-
- run: npm install mongodb
66-
- run: npm install pg-promise
67-
- run: npm install sqlite3
68-
- run: npm run build:compact --if-present
69-
- run: npm run build:module:compact --if-present
70-
- run: npm run build:light --if-present
71-
- run: npm run build:module:light --if-present
63+
- run: npm run build:compact
64+
- run: npm run build:module:compact
65+
- run: npm run build:light
66+
- run: npm run build:module:light
7267
- run: npm install
7368
working-directory: test
74-
- run: npm run test:github-1
75-
working-directory: test
76-
- run: npm run test:github-2
77-
working-directory: test
78-
- run: npm run test:github-3
79-
working-directory: test
80-
- run: npm run test:github-4
81-
working-directory: test
82-
- run: npm run test:github-5
69+
- run: npm run test:github
8370
working-directory: test

test/package.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,7 @@
44
"scripts": {
55
"test": "mocha ./*.js --exit",
66
"test:ts": "npx tsc --noEmit --lib esnext ./types.ts",
7-
"test:github-1": "npm run test:ts ",
8-
"test:github-2": "mocha ./*.js --exit flexsearch.light.min",
9-
"test:github-3": "mocha ./*.js --exit flexsearch.light.module.min",
10-
"test:github-4": "mocha ./*.js --exit flexsearch.compact.min",
11-
"test:github-5": "mocha ./*.js --exit flexsearch.compact.module.min",
7+
"test:github": "npm run test:ts && mocha ./*.js --exit flexsearch.light.min && mocha ./*.js --exit flexsearch.light.module.min && mocha ./*.js --exit flexsearch.compact.min && mocha ./*.js --exit flexsearch.compact.module.min",
128
"test:coverage": "c8 -c ./.c8rc.json mocha ./*.js --exit",
139
"test:keystore": "set NODE_OPTIONS=--max-old-space-size=16000 && c8 -c ./.c8rc.json mocha ./keystore.js --exit",
1410
"test:db": "c8 -c ./.c8rc.json mocha ./persistent.*.js --exit",

test/persistent.clickhouse.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,10 @@ const build_compact = env && env.includes("compact");
1010
const build_esm = !env || env.startsWith("module");
1111
const Charset = _Charset || (await import("../src/charset.js")).default;
1212

13-
import Clickhouse_src from "../src/db/clickhouse/index.js";
14-
import Clickhouse_dist from "../dist/module/db/clickhouse/index.js";
1513
import tests from "./persistent.js";
1614

1715
if(!build_light && !build_compact){
18-
describe("Persistent: Clickhouse", function(){
19-
tests(env ? Clickhouse_dist : Clickhouse_src, "Clickhouse");
16+
describe("Persistent: Clickhouse", async function(){
17+
await tests("Clickhouse");
2018
});
2119
}

test/persistent.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,24 @@ const build_compact = env && env.includes("compact");
1010
const build_esm = !env || env.startsWith("module");
1111
const Charset = _Charset || (await import("../src/charset.js")).default;
1212

13-
export default function(DB, DBClass){
13+
export default async function(DBClass){
14+
15+
let DB;
16+
if(DBClass === "Clickhouse"){
17+
DB = (await import(env ? "../dist/module/db/clickhouse/index.js" : "../src/db/clickhouse/index.js")).default;
18+
}
19+
if(DBClass === "Redis"){
20+
DB = (await import(env ? "../dist/module/db/redis/index.js" : "../src/db/redis/index.js")).default;
21+
}
22+
if(DBClass === "Mongo"){
23+
DB = (await import(env ? "../dist/module/db/mongodb/index.js" : "../src/db/mongodb/index.js")).default;
24+
}
25+
if(DBClass === "SQLite"){
26+
DB = (await import(env ? "../dist/module/db/sqlite/index.js" : "../src/db/sqlite/index.js")).default;
27+
}
28+
if(DBClass === "Postgres"){
29+
DB = (await import(env ? "../dist/module/db/postgres/index.js" : "../src/db/postgres/index.js")).default;
30+
}
1431

1532
const data = [{
1633
"tconst": "tt0000001",

test/persistent.mongo.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,10 @@ const build_compact = env && env.includes("compact");
1010
const build_esm = !env || env.startsWith("module");
1111
const Charset = _Charset || (await import("../src/charset.js")).default;
1212

13-
import Mongo_src from "../src/db/mongodb/index.js";
14-
import Mongo_dist from "../dist/module/db/mongodb/index.js";
1513
import tests from "./persistent.js";
1614

1715
if(!build_light && !build_compact){
18-
describe("Persistent: Mongo", function(){
19-
tests(env ? Mongo_dist : Mongo_src, "Mongo");
16+
describe("Persistent: Mongo", async function(){
17+
await tests("Mongo");
2018
});
2119
}

test/persistent.postgres.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,10 @@ const build_compact = env && env.includes("compact");
1010
const build_esm = !env || env.startsWith("module");
1111
const Charset = _Charset || (await import("../src/charset.js")).default;
1212

13-
import Postgres_src from "../src/db/postgres/index.js";
14-
import Postgres_dist from "../dist/module/db/postgres/index.js";
1513
import tests from "./persistent.js";
1614

1715
if(!build_light && !build_compact){
18-
describe("Persistent: Postgres", function(){
19-
tests(env ? Postgres_dist : Postgres_src, "Postgres");
16+
describe("Persistent: Postgres", async function(){
17+
await tests("Postgres");
2018
});
2119
}

test/persistent.redis.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,10 @@ const build_compact = env && env.includes("compact");
1010
const build_esm = !env || env.startsWith("module");
1111
const Charset = _Charset || (await import("../src/charset.js")).default;
1212

13-
import Redis_src from "../src/db/redis/index.js";
14-
import Redis_dist from "../dist/module/db/redis/index.js";
1513
import tests from "./persistent.js";
1614

1715
if(!build_light && !build_compact){
18-
describe("Persistent: Redis", function(){
19-
tests(env ? Redis_dist : Redis_src, "Redis");
16+
describe("Persistent: Redis", async function(){
17+
await tests("Redis");
2018
});
2119
}

test/persistent.sqlite.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,10 @@ const build_compact = env && env.includes("compact");
1010
const build_esm = !env || env.startsWith("module");
1111
const Charset = _Charset || (await import("../src/charset.js")).default;
1212

13-
import SQLite_src from "../src/db/sqlite/index.js";
14-
import SQLite_dist from "../dist/module/db/sqlite/index.js";
1513
import tests from "./persistent.js";
1614

1715
if(!build_light && !build_compact){
18-
describe("Persistent: SQLite", function(){
19-
tests(env ? SQLite_dist : SQLite_src, "SQLite");
16+
describe("Persistent: SQLite", async function(){
17+
await tests("SQLite");
2018
});
2119
}

0 commit comments

Comments
 (0)