chore(test): Add Coverage on Coveralls (#11225)

use lcov by default
This commit is contained in:
Oleg "OSA413" Sokolov 2025-01-09 15:03:32 +05:00 committed by GitHub
parent 65026cc509
commit 9d1d3f1008
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 1481 additions and 159 deletions

13
.github/workflows/coverage.yml vendored Normal file
View File

@ -0,0 +1,13 @@
name: coverage
on:
workflow_call
jobs:
coverage:
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@v2
with:
parallel-finished: true

View File

@ -9,6 +9,9 @@ on:
jobs:
oracle:
# For some reason nyc is stuck at the end of the test execution even if all tests pass
# Probably that's why the job failed on CircleCI
if: ${{inputs.node-version != '16.x'}}
runs-on: ubuntu-latest
strategy:
fail-fast: false
@ -21,4 +24,9 @@ jobs:
- run: docker compose -f .github/workflows/test/oracle.docker-compose up -d
- run: npm i
- run: cp .github/workflows/test/oracle.ormconfig.json ormconfig.json
- run: npm test
- run: npx nyc npm run test
- name: Coveralls Parallel
uses: coverallsapp/github-action@v2
with:
flag-name: oracle-${{ inputs.node-version }}
parallel: true

View File

@ -25,7 +25,12 @@ jobs:
- run: npm i
- run: chown -R 1001:127 /github/home/.npm #This fix is needed for running CLI tests
- run: cp .github/workflows/test/cockroachdb.ormconfig.json ormconfig.json
- run: npm test
- run: npx nyc npm run test
- name: Coveralls Parallel
uses: coverallsapp/github-action@v2
with:
flag-name: crdb-${{ inputs.node-container }}
parallel: true
mongodb:
runs-on: ubuntu-latest
@ -42,7 +47,12 @@ jobs:
- run: npm i
- run: chown -R 1001:127 /github/home/.npm #This fix is needed for running CLI tests
- run: cp .github/workflows/test/mongodb.ormconfig.json ormconfig.json
- run: npm test
- run: npx nyc npm run test
- name: Coveralls Parallel
uses: coverallsapp/github-action@v2
with:
flag-name: mongodb-${{ inputs.node-container }}
parallel: true
mssql:
@ -64,6 +74,12 @@ jobs:
- run: chown -R 1001:127 /github/home/.npm #This fix is needed for running CLI tests
- run: cp .github/workflows/test/mssql.ormconfig.json ormconfig.json
- run: npm test
- run: npx nyc npm run test
- name: Coveralls Parallel
uses: coverallsapp/github-action@v2
with:
flag-name: mssql-${{ inputs.node-container }}
parallel: true
mysql_mariadb:
@ -93,7 +109,12 @@ jobs:
- run: npm i
- run: chown -R 1001:127 /github/home/.npm #This fix is needed for running CLI tests
- run: cp .github/workflows/test/mysql-mariadb.ormconfig.json ormconfig.json
- run: npm test
- run: npx nyc npm run test
- name: Coveralls Parallel
uses: coverallsapp/github-action@v2
with:
flag-name: mysql+mariadb-${{ inputs.node-container }}
parallel: true
better-sqlite3:
@ -109,7 +130,12 @@ jobs:
- run: chown -R 1001:127 /github/home/.npm #This fix is needed for running CLI tests
- run: chown -R 1001:127 ./temp #This fix is needed for fixing permission error on Node 16
- run: cp .github/workflows/test/better-sqlite3.ormconfig.json ormconfig.json
- run: npm test
- run: npx nyc npm run test
- name: Coveralls Parallel
uses: coverallsapp/github-action@v2
with:
flag-name: better-sqlite3-${{ inputs.node-container }}
parallel: true
sqlite:
@ -125,7 +151,12 @@ jobs:
- run: chown -R 1001:127 /github/home/.npm #This fix is needed for running CLI tests
- run: chown -R 1001:127 ./temp #This fix is needed for fixing permission error on Node 16
- run: cp .github/workflows/test/sqlite.ormconfig.json ormconfig.json
- run: npm test
- run: npx nyc npm run test
- name: Coveralls Parallel
uses: coverallsapp/github-action@v2
with:
flag-name: sqlite-${{ inputs.node-container }}
parallel: true
sqljs:
@ -140,7 +171,12 @@ jobs:
- run: npm i
- run: chown -R 1001:127 /github/home/.npm #This fix is needed for running CLI tests
- run: cp .github/workflows/test/sqljs.ormconfig.json ormconfig.json
- run: npm test
- run: npx nyc npm run test
- name: Coveralls Parallel
uses: coverallsapp/github-action@v2
with:
flag-name: sqljs-${{ inputs.node-container }}
parallel: true
postgres:
@ -167,4 +203,9 @@ jobs:
- run: npm i
- run: chown -R 1001:127 /github/home/.npm #This fix is needed for running CLI tests
- run: cp .github/workflows/test/postgres.ormconfig.json ormconfig.json
- run: npm test
- run: npx nyc npm run test
- name: Coveralls Parallel
uses: coverallsapp/github-action@v2
with:
flag-name: postgres-${{ inputs.node-container }}
parallel: true

View File

@ -47,3 +47,9 @@ jobs:
uses: ./.github/workflows/database-compose-tests.yml
with:
node-version: ${{matrix.node-version}}
# Run with most databases possible to provide the coverage of the tests
coverage:
if: ${{ always() }}
needs: [database-tests, database-compose-tests]
uses: ./.github/workflows/coverage.yml

15
.nycrc Normal file
View File

@ -0,0 +1,15 @@
{
"all": true,
"cache": false,
"exclude": [
"**/*.d.ts"
],
"extension": [
".ts"
],
"include": [
"build/compiled/src/**",
"src/**"
],
"reporter": "lcov"
}

View File

@ -10,8 +10,8 @@
<a href="https://badge.fury.io/js/typeorm">
<img src="https://badge.fury.io/js/typeorm.svg">
</a>
<a href="https://codecov.io/gh/typeorm/typeorm">
<img alt="Codecov" src="https://img.shields.io/codecov/c/github/typeorm/typeorm.svg">
<a href='https://coveralls.io/github/typeorm/typeorm?branch=master'>
<img src='https://coveralls.io/repos/github/typeorm/typeorm/badge.svg?branch=master' alt='Coverage Status' />
</a>
<br>
<br>

1521
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -130,6 +130,7 @@
"mssql": "^10.0.1",
"mysql": "^2.18.1",
"mysql2": "^3.9.7",
"nyc": "^17.1.0",
"pg": "^8.9.0",
"pg-query-stream": "^4.3.0",
"prettier": "^2.8.8",
@ -255,20 +256,5 @@
"type": "opencollective",
"url": "https://opencollective.com/typeorm",
"logo": "https://opencollective.com/opencollective/logo.txt"
},
"nyc": {
"all": true,
"cache": false,
"exclude": [
"**/*.d.ts"
],
"extension": [
".ts"
],
"include": [
"build/compiled/src/**",
"src/**"
],
"reporter": "json"
}
}