Skip to content

Commit

Permalink
ci: split test and test:ci to update coverage only on CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Romakita committed Aug 17, 2024
1 parent caead1f commit 40ee381
Show file tree
Hide file tree
Showing 62 changed files with 372 additions and 309 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Benchmarks
on:
workflow_dispatch:
pull_request:
# pull_request:
schedule:
# * is a special character in YAML so you have to quote this string
- cron: '0 0 * * 1'
Expand Down Expand Up @@ -46,17 +46,17 @@ jobs:
# name: Github Actions
# email: <>

- uses: actions/github-script@v4
if: github.event_name == 'pull_request' && !github.event.pull_request.head.repo.fork && github.actor != 'dependabot[bot]'
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
context.issue.number && github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: require('fs').readFileSync('./benchmarks/ISSUE_COMMENT.md', {encoding: 'utf8'})
})
# - uses: actions/github-script@v4
# if: github.event_name == 'pull_request' && !github.event.pull_request.head.repo.fork && github.actor != 'dependabot[bot]'
# with:
# github-token: ${{secrets.GITHUB_TOKEN}}
# script: |
# context.issue.number && github.issues.createComment({
# issue_number: context.issue.number,
# owner: context.repo.owner,
# repo: context.repo.repo,
# body: require('fs').readFileSync('./benchmarks/ISSUE_COMMENT.md', {encoding: 'utf8'})
# })
- uses: actions/upload-artifact@v2
with:
name: benchmarks
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "6.115.0",
"description": "Benchmarks for Ts.ED",
"main": "index.js",
"type": "commonjs",
"type": "module",
"scripts": {
"start": "node bin/benchmark.js",
"compare": "node bin/benchmark.js compare --",
Expand Down
19 changes: 10 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,19 @@
"postinstall": "node tools/yarn/postinstall.js && cd docs && yarn install && cd .. && node ./tools/github-sponsors/bin/github-sponsors.js",
"configure": "monorepo ci configure",
"clean": "monorepo clean workspace",
"test": "yarn test:lint && yarn test:core && yarn test:specs && yarn test:platform && yarn test:integration && yarn test:graphql && yarn test:orm && yarn test:security && yarn test:formio && yarn test:third-parties",
"test": "lerna run test --concurrency 2",
"test:ci": "yarn test:lint && yarn test:core && yarn test:specs && yarn test:platform && yarn test:integration && yarn test:graphql && yarn test:orm && yarn test:security && yarn test:formio && yarn test:third-parties",
"test:lint": "eslint '**/*.{ts,js}'",
"test:lint:fix": "eslint '**/*.{ts,js}' --fix",
"test:core": "lerna run test --scope '@tsed/{core,di,common,engines,normalize-path}' --stream --concurrency 2",
"test:platform": "lerna run test --ignore '@tsed/platform-{express,koa}' --scope '@tsed/platform-*' --stream --concurrency 2",
"test:integration": "lerna run test --scope '@tsed/platform-{express,koa}' --stream --concurrency 2",
"test:orm": "lerna run test --scope '@tsed/{adapters,adapters-redis,mikro-orm,mongoose,objection,prisma,typeorm}' --stream --concurrency 4",
"test:graphql": "lerna run test --scope '@tsed/{apollo,typegraphql}' --stream",
"test:security": "lerna run test --scope '@tsed/{jwks,oidc-provider,passport,oidc-provider-plugin-wildcard-redirect-uri}' --stream",
"test:core": "lerna run test:ci --scope '@tsed/{core,di,common,engines,normalize-path}' --stream --concurrency 2",
"test:platform": "lerna run test:ci --ignore '@tsed/platform-{express,koa}' --scope '@tsed/platform-*' --stream --concurrency 2",
"test:integration": "lerna run test:ci --scope '@tsed/platform-{express,koa}' --stream --concurrency 2",
"test:orm": "lerna run test:ci --scope '@tsed/{adapters,adapters-redis,mikro-orm,mongoose,objection,prisma,typeorm}' --stream --concurrency 4",
"test:graphql": "lerna run test:ci --scope '@tsed/{apollo,typegraphql}' --stream",
"test:security": "lerna run test:ci --scope '@tsed/{jwks,oidc-provider,passport,oidc-provider-plugin-wildcard-redirect-uri}' --stream",
"test:specs": "lerna run test --scope '@tsed/{ajv,exceptions,json-mapper,schema,swagger}' --stream --concurrency 2",
"test:third-parties": "lerna run test --scope '@tsed/{agenda,bullmq,components-scan,event-emitter,formio,pulse,sse,socketio,stripe,temporal,terminus,vike,vite-ssr-plugin}' --stream --concurrency 4",
"test:formio": "lerna run test --scope '@tsed/{schema-formio,formio}' --stream",
"test:third-parties": "lerna run test:ci --scope '@tsed/{agenda,bullmq,components-scan,event-emitter,formio,pulse,sse,socketio,stripe,temporal,terminus,vike,vite-ssr-plugin}' --stream --concurrency 4",
"test:formio": "lerna run test:ci --scope '@tsed/{schema-formio,formio}' --stream",
"coverage": "merge-istanbul --out coverage/coverage-final.json \"**/packages/**/coverage/coverage-final.json\" && nyc report --reporter text --reporter html --reporter lcov -t coverage --report-dir coverage",
"barrels": "lerna run barrels",
"build": "monorepo build --verbose",
Expand Down
7 changes: 4 additions & 3 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@tsed/core",
"description": "Core module for Ts.ED Framework",
"type": "commonjs",
"version": "7.79.3",
"version": "7.79.4",
"source": "./src/index.ts",
"main": "./lib/esm/index.js",
"module": "./lib/esm/index.js",
Expand All @@ -20,8 +20,9 @@
"build": "yarn barrels && yarn build:ts && yarn run build:browser",
"barrels": "barrels",
"build:browser": "webpack",
"test": "jest --max-workers=2 && jest-coverage-thresholds-bumper",
"build:ts": "tsc --build tsconfig.json"
"test": "jest --max-workers=4",
"build:ts": "tsc --build tsconfig.json",
"test:ci": "jest --max-workers=2 && jest-coverage-thresholds-bumper"
},
"dependencies": {
"reflect-metadata": "^0.2.1",
Expand Down
11 changes: 6 additions & 5 deletions packages/di/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@tsed/di",
"description": "DI module for Ts.ED Framework",
"type": "commonjs",
"version": "7.79.3",
"version": "7.79.4",
"source": "./src/index.ts",
"main": "lib/esm/index.js",
"module": "lib/esm/index.js",
Expand All @@ -20,8 +20,9 @@
"build": "yarn barrels && yarn build:ts && yarn run build:browser",
"build:browser": "webpack",
"barrels": "barrels",
"test": "jest --max-workers=2 && jest-coverage-thresholds-bumper",
"build:ts": "tsc --build tsconfig.json"
"test": "jest --max-workers=4",
"build:ts": "tsc --build tsconfig.json",
"test:ci": "jest --max-workers=2 && jest-coverage-thresholds-bumper"
},
"dependencies": {
"tslib": "2.6.2"
Expand All @@ -39,9 +40,9 @@
"webpack": "^5.75.0"
},
"peerDependencies": {
"@tsed/core": "7.79.3",
"@tsed/core": "7.79.4",
"@tsed/logger": ">=6.7.5",
"@tsed/schema": "7.79.3"
"@tsed/schema": "7.79.4"
},
"peerDependenciesMeta": {
"@tsed/core": {
Expand Down
5 changes: 3 additions & 2 deletions packages/engines/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
"scripts": {
"build": "yarn barrels && yarn build:ts",
"barrels": "barrels",
"test": "jest --max-workers=2 && jest-coverage-thresholds-bumper",
"build:ts": "tsc --build tsconfig.json"
"test": "jest --max-workers=4",
"build:ts": "tsc --build tsconfig.json",
"test:ci": "jest --max-workers=2 && jest-coverage-thresholds-bumper"
},
"dependencies": {
"tslib": "2.6.1"
Expand Down
5 changes: 3 additions & 2 deletions packages/graphql/apollo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
"scripts": {
"build": "yarn barrels && yarn build:ts",
"barrels": "barrels",
"test": "jest && jest-coverage-thresholds-bumper",
"build:ts": "tsc --build tsconfig.json"
"test": "jest --max-workers=4",
"build:ts": "tsc --build tsconfig.json",
"test:ci": "jest --max-workers=2 && jest-coverage-thresholds-bumper"
},
"dependencies": {
"tslib": "2.6.1"
Expand Down
5 changes: 3 additions & 2 deletions packages/graphql/typegraphql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@
"barrels": "barrels",
"start:express": "ts-node test/app/index.express.ts",
"start:koa": "ts-node test/app/index.koa.ts",
"test": "jest && jest-coverage-thresholds-bumper",
"build:ts": "tsc --build tsconfig.json"
"test": "jest --max-workers=4",
"build:ts": "tsc --build tsconfig.json",
"test:ci": "jest --max-workers=2 && jest-coverage-thresholds-bumper"
},
"dependencies": {
"@tsed/apollo": "workspace:*",
Expand Down
5 changes: 3 additions & 2 deletions packages/orm/adapters-redis/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
"scripts": {
"build": "yarn barrels && yarn build:ts",
"barrels": "barrels",
"test": "jest && jest-coverage-thresholds-bumper",
"build:ts": "tsc --build tsconfig.json"
"test": "jest --max-workers=4",
"build:ts": "tsc --build tsconfig.json",
"test:ci": "jest --max-workers=2 && jest-coverage-thresholds-bumper"
},
"dependencies": {
"@tsed/adapters": "workspace:*",
Expand Down
5 changes: 3 additions & 2 deletions packages/orm/adapters/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
"scripts": {
"build": "yarn barrels && yarn build:ts",
"barrels": "barrels",
"test": "jest && jest-coverage-thresholds-bumper",
"build:ts": "tsc --build tsconfig.json"
"test": "jest --max-workers=4",
"build:ts": "tsc --build tsconfig.json",
"test:ci": "jest --max-workers=2 && jest-coverage-thresholds-bumper"
},
"dependencies": {
"@types/lowdb": "1.0.15",
Expand Down
5 changes: 3 additions & 2 deletions packages/orm/ioredis/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
"scripts": {
"build": "yarn barrels && yarn build:ts",
"barrels": "barrels",
"test": "jest && jest-coverage-thresholds-bumper",
"build:ts": "tsc --build tsconfig.json"
"test": "jest --max-workers=4",
"build:ts": "tsc --build tsconfig.json",
"test:ci": "jest --max-workers=2 && jest-coverage-thresholds-bumper"
},
"dependencies": {
"tslib": "2.6.1"
Expand Down
5 changes: 3 additions & 2 deletions packages/orm/mikro-orm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
"scripts": {
"build": "yarn barrels && yarn build:ts",
"barrels": "barrels",
"test": "jest",
"build:ts": "tsc --build tsconfig.json"
"test": "jest --max-workers=4",
"build:ts": "tsc --build tsconfig.json",
"test:ci": "jest --max-workers=2 && jest-coverage-thresholds-bumper"
},
"dependencies": {
"tslib": "2.6.1"
Expand Down
5 changes: 3 additions & 2 deletions packages/orm/mongoose/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@
"scripts": {
"build": "yarn barrels && yarn build:ts",
"barrels": "barrels",
"test": "jest && jest-coverage-thresholds-bumper",
"build:ts": "tsc --build tsconfig.json"
"test": "jest --max-workers=4",
"build:ts": "tsc --build tsconfig.json",
"test:ci": "jest --max-workers=2 && jest-coverage-thresholds-bumper"
},
"dependencies": {
"change-case": "4.1.2",
Expand Down
5 changes: 3 additions & 2 deletions packages/orm/objection/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
"scripts": {
"build": "yarn barrels && yarn build:ts",
"barrels": "barrels",
"test": "jest && jest-coverage-thresholds-bumper",
"build:ts": "tsc --build tsconfig.json"
"test": "jest --max-workers=4",
"build:ts": "tsc --build tsconfig.json",
"test:ci": "jest --max-workers=2 && jest-coverage-thresholds-bumper"
},
"dependencies": {
"tslib": "2.6.1"
Expand Down
5 changes: 3 additions & 2 deletions packages/orm/prisma/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@
"prebuild": "cd ../../core && yarn build",
"build": "rm -rf lib && yarn build:ts && monorepo build-hybrid",
"build:ts": "tsc --build tsconfig.json",
"test": "jest && jest-coverage-thresholds-bumper",
"test": "jest --max-workers=4",
"generate:postgres": "yarn build && cd test/postgres && prisma -v && prisma generate",
"generate:postgres:esm": "yarn build && cd test/postgres-esm && prisma -v && prisma generate",
"generate:mongo": "yarn build && cd test/mongo && prisma -v && prisma generate",
"generate:mongo:esm": "yarn build && cd test/mongo-esm && prisma -v && prisma generate"
"generate:mongo:esm": "yarn build && cd test/mongo-esm && prisma -v && prisma generate",
"test:ci": "jest --max-workers=2 && jest-coverage-thresholds-bumper"
},
"dependencies": {
"@prisma/generator-helper": "^4.16.2",
Expand Down
11 changes: 7 additions & 4 deletions packages/orm/prisma/src/__mock__/createDmmfFixture.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
export function createDmmfFixture() {
return require("./dmmf.json");
import dmmf from "./dmmf.json";
import dmmfTypes from "./dmmf.types.json";

export function createDmmfFixture(): any {
return dmmf;
}

export function createDmmfWithTypesFixture() {
return require("./dmmf.types.json");
export function createDmmfWithTypesFixture(): any {
return dmmfTypes;
}
3 changes: 2 additions & 1 deletion packages/orm/prisma/src/__mock__/createDmmfModelFixture.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {DmmfModel} from "../generator/domain/DmmfModel.js";
import dmmfUserModel from "./dmmfUserModel.json";

export function createDmmfModelFixture() {
return new DmmfModel(require("./dmmfUserModel.json"));
return new DmmfModel(dmmfUserModel as any);
}
5 changes: 3 additions & 2 deletions packages/orm/typeorm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
"scripts": {
"build": "yarn barrels && yarn build:ts",
"barrels": "barrels",
"test": "jest",
"build:ts": "tsc --build tsconfig.json"
"test": "jest --max-workers=4",
"build:ts": "tsc --build tsconfig.json",
"test:ci": "jest --max-workers=2 && jest-coverage-thresholds-bumper"
},
"dependencies": {
"tslib": "2.6.1"
Expand Down
9 changes: 5 additions & 4 deletions packages/platform/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@tsed/common",
"description": "A TypeScript Framework on top of Express",
"type": "commonjs",
"version": "7.79.3",
"version": "7.79.4",
"source": "./src/index.ts",
"main": "./lib/esm/index.js",
"module": "./lib/esm/index.js",
Expand All @@ -17,8 +17,9 @@
"scripts": {
"build": "yarn barrels && yarn build:ts",
"barrels": "barrels -e \"getConfiguration\"",
"test": "jest --max-workers=2 --no-cache && jest-coverage-thresholds-bumper",
"build:ts": "tsc --build tsconfig.json"
"test": "jest --max-workers=4",
"build:ts": "tsc --build tsconfig.json",
"test:ci": "jest --max-workers=2 && jest-coverage-thresholds-bumper"
},
"keywords": [
"Express",
Expand Down Expand Up @@ -89,8 +90,8 @@
"devDependencies": {
"@tsed/barrels": "workspace:*",
"@tsed/components-scan": "workspace:*",
"@tsed/typescript": "workspace:*",
"@tsed/engines": "workspace:*",
"@tsed/typescript": "workspace:*",
"cross-env": "7.0.3",
"eslint": "^8.57.0",
"jest": "^29.7.0",
Expand Down
5 changes: 3 additions & 2 deletions packages/platform/platform-cache/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@
},
"scripts": {
"build": "yarn barrels && yarn build:ts",
"test": "jest --max-workers=2 && jest-coverage-thresholds-bumper",
"test": "jest --max-workers=4",
"barrels": "barrels",
"build:ts": "tsc --build tsconfig.json"
"build:ts": "tsc --build tsconfig.json",
"test:ci": "jest --max-workers=2 && jest-coverage-thresholds-bumper"
},
"dependencies": {
"cache-manager": "^5.4.0",
Expand Down
13 changes: 7 additions & 6 deletions packages/platform/platform-exceptions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@tsed/platform-exceptions",
"description": "Platform exceptions module for Ts.ED Framework",
"type": "commonjs",
"version": "7.79.3",
"version": "7.79.4",
"source": "./src/index.ts",
"main": "./lib/esm/index.js",
"module": "./lib/esm/index.js",
Expand All @@ -17,8 +17,9 @@
"scripts": {
"build": "yarn barrels && yarn build:ts",
"barrels": "barrels",
"test": "jest --max-workers=2 && jest-coverage-thresholds-bumper",
"build:ts": "tsc --build tsconfig.json"
"test": "jest --max-workers=4",
"build:ts": "tsc --build tsconfig.json",
"test:ci": "jest --max-workers=2 && jest-coverage-thresholds-bumper"
},
"dependencies": {
"tslib": "2.6.1"
Expand All @@ -35,9 +36,9 @@
"typescript": "4.9.5"
},
"peerDependencies": {
"@tsed/core": "7.79.3",
"@tsed/di": "7.79.3",
"@tsed/exceptions": "7.79.3",
"@tsed/core": "7.79.4",
"@tsed/di": "7.79.4",
"@tsed/exceptions": "7.79.4",
"@tsed/schema": "7.79.3"
},
"peerDependenciesMeta": {
Expand Down
Loading

0 comments on commit 40ee381

Please sign in to comment.