Skip to content

Commit

Permalink
Merge pull request #255 from ClickHouse/coverage-reports
Browse files Browse the repository at this point in the history
Coverage reports for Node.js + Common packages
  • Loading branch information
slvrtrn committed Mar 29, 2024
2 parents b416895 + 41a5889 commit 13676c9
Show file tree
Hide file tree
Showing 8 changed files with 88 additions and 1 deletion.
49 changes: 49 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -291,3 +291,52 @@ jobs:
CLICKHOUSE_CLOUD_PASSWORD: ${{ secrets.INTEGRATIONS_TEAM_TESTS_CLOUD_PASSWORD_SMT }}
run: |
npm run test:web:integration:cloud_smt
# With unit + integration + TLS tests + coverage + SonarCloud report, after the rest of the tests.
# Needs all integration tests on all environments to pass.
# Should use only the current LTS version of Node.js.
node-all-tests-with-coverage-and-sonar:
needs:
[
'node-integration-tests-local-single-node',
'node-integration-tests-local-cluster',
'node-integration-tests-cloud',
'node-integration-tests-cloud-smt',
'web-all-tests-local-single-node',
'web-integration-tests-local-cluster',
'web-integration-tests-cloud',
'web-integration-tests-cloud-smt',
]
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@main

- name: Start ClickHouse (version - ${{ matrix.clickhouse }}) in Docker
uses: isbang/compose-action@v1.5.1
with:
compose-file: 'docker-compose.yml'
down-flags: '--volumes'

- name: Setup NodeJS 20
uses: actions/setup-node@v4
with:
node-version: 20

- name: Install dependencies
run: |
npm install
- name: Add ClickHouse TLS instance to /etc/hosts
run: |
sudo echo "127.0.0.1 server.clickhouseconnect.test" | sudo tee -a /etc/hosts
- name: Run unit + integration + TLS tests with coverage
run: |
npm run test:node:coverage
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ benchmarks/leaks/input
.npmrc
webpack
out
coverage
coverage-web
.nyc_output
16 changes: 16 additions & 0 deletions .nycrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"extends": "@istanbuljs/nyc-config-typescript",
"all": true,
"reporter": ["lcov", "text"],
"include": [
"packages/client-common/src/**/*.ts",
"packages/client-node/src/**/*.ts"
],
"exclude": [
"packages/**/version.ts",
"packages/client-common/src/clickhouse_types.ts",
"packages/client-common/src/connection.ts",
"packages/client-common/src/result.ts",
"packages/client-common/src/ts_utils.ts"
]
}
2 changes: 1 addition & 1 deletion .scripts/jasmine.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/bin/bash
ts-node -r tsconfig-paths/register --transpileOnly --project=tsconfig.dev.json node_modules/jasmine/bin/jasmine --config=$1
ts-node -r tsconfig-paths/register -r source-map-support/register --transpileOnly --project=tsconfig.dev.json node_modules/jasmine/bin/jasmine --config=$1
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,21 @@
</p>
<br/>
<p align="center">
<a href="https://www.npmjs.com/package/@clickhouse/client">
<img alt="NPM Version" src="https://img.shields.io/npm/v/%40clickhouse%2Fclient?color=%233178C6&logo=npm">
</a>

<a href="https://www.npmjs.com/package/@clickhouse/client">
<img alt="NPM Downloads" src="https://img.shields.io/npm/dw/%40clickhouse%2Fclient?color=%233178C6&logo=npm">
</a>

<img alt="NPM Type Definitions" src="https://img.shields.io/npm/types/%40clickhouse%2Fclient?color=%233178C6&logo=typescript">

<a href="https://github.com/ClickHouse/clickhouse-js/actions/workflows/tests.yml">
<img src="https://github.com/ClickHouse/clickhouse-js/actions/workflows/tests.yml/badge.svg?branch=main">
</a>

<img src="https://sonarcloud.io/api/project_badges/measure?project=ClickHouse_clickhouse-js&metric=alert_status">
</p>

## About
Expand Down
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"test:node:integration:local_cluster": "CLICKHOUSE_TEST_ENVIRONMENT=local_cluster npm run test:node:integration",
"test:node:integration:cloud": "CLICKHOUSE_TEST_ENVIRONMENT=cloud npm run test:node:integration",
"test:node:integration:cloud_smt": "CLICKHOUSE_TEST_ENVIRONMENT=cloud_smt npm run test:node:integration",
"test:node:coverage": "nyc npm run test",
"test:web": "karma start karma.config.cjs",
"test:web:integration:local_cluster": "CLICKHOUSE_TEST_ENVIRONMENT=local_cluster npm run test:web",
"test:web:integration:cloud": "CLICKHOUSE_TEST_ENVIRONMENT=cloud npm run test:web",
Expand All @@ -43,6 +44,7 @@
},
"devDependencies": {
"@faker-js/faker": "^8.4.1",
"@istanbuljs/nyc-config-typescript": "^1.0.2",
"@types/jasmine": "^5.1.4",
"@types/node": "^20.11.30",
"@types/sinon": "^17.0.3",
Expand All @@ -68,9 +70,11 @@
"karma-typescript": "^5.5.4",
"karma-webpack": "^5.0.1",
"lint-staged": "^15.2.2",
"nyc": "^15.1.0",
"parquet-wasm": "0.6.0-beta.2",
"prettier": "3.2.5",
"sinon": "^17.0.1",
"source-map-support": "^0.5.21",
"split2": "^4.2.0",
"terser-webpack-plugin": "^5.3.10",
"ts-jest": "^29.1.2",
Expand Down
Empty file.
3 changes: 3 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
sonar.organization=clickhouse-java
sonar.projectKey=ClickHouse_clickhouse-js
sonar.javascript.lcov.reportPaths=coverage/lcov.info

0 comments on commit 13676c9

Please sign in to comment.