Merge docker-compose setups so single-node and cluster can run together #2791
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: 'tests' | |
| permissions: {} | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| paths-ignore: | |
| - '**/*.md' | |
| - 'LICENSE' | |
| - 'benchmarks/**' | |
| pull_request: | |
| paths-ignore: | |
| - '**/*.md' | |
| - 'LICENSE' | |
| - 'benchmarks/**' | |
| schedule: | |
| - cron: '0 9 * * *' | |
| concurrency: | |
| group: '${{ github.workflow }}-${{ github.ref }}' | |
| cancel-in-progress: true | |
| env: | |
| OTEL_SERVICE_NAME: vitest | |
| OTEL_EXPORTER_OTLP_ENDPOINT: ${{ secrets.OTEL_EXPORTER_OTLP_ENDPOINT }} | |
| OTEL_EXPORTER_OTLP_HEADERS: 'authorization=${{ secrets.OTEL_EXPORTER_OTLP_API_KEY }}' | |
| OTEL_RESOURCE_ATTRIBUTES: 'service.namespace=clickhouse-js,deployment.environment=ci' | |
| VITEST_OTEL_ENABLED: 'true' | |
| VITEST_COVERAGE: 'true' | |
| jobs: | |
| code-quality: | |
| timeout-minutes: 5 | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Setup NodeJS | |
| uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 | |
| with: | |
| node-version: 24 | |
| - name: Install dependencies | |
| run: | | |
| npm install | |
| - name: Build packages | |
| run: | | |
| npm run build | |
| - name: Typecheck | |
| run: | | |
| npm run typecheck | |
| - name: Run linting | |
| run: | | |
| npm run lint | |
| code-quality-examples: | |
| timeout-minutes: 5 | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: examples | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Setup NodeJS | |
| uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 | |
| with: | |
| node-version: 24 | |
| - name: Install dependencies | |
| run: | | |
| npm install | |
| - name: Typecheck | |
| run: | | |
| npm run typecheck | |
| - name: Run linting | |
| run: | | |
| npm run lint | |
| run-examples: | |
| timeout-minutes: 10 | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| clickhouse: [head, latest] | |
| defaults: | |
| run: | |
| working-directory: examples | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Start ClickHouse (version - ${{ matrix.clickhouse }}) in Docker | |
| uses: isbang/compose-action@3846bcd61da338e9eaaf83e7ed0234a12b099b72 # v2.4.2 | |
| env: | |
| CLICKHOUSE_VERSION: ${{ matrix.clickhouse }} | |
| with: | |
| compose-file: 'docker-compose.yml' | |
| down-flags: '--volumes' | |
| - name: Setup NodeJS | |
| uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 | |
| with: | |
| node-version: 24 | |
| - name: Install root dependencies | |
| working-directory: . | |
| run: | | |
| npm install | |
| - name: Install examples dependencies | |
| run: | | |
| npm install | |
| - name: Run examples | |
| run: | | |
| npm run run-examples | |
| common-unit-tests-node: | |
| timeout-minutes: 5 | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| node: [20, 22, 24] | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Setup NodeJS ${{ matrix.node }} | |
| uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 | |
| with: | |
| node-version: ${{ matrix.node }} | |
| - name: Install dependencies | |
| run: | | |
| npm install | |
| - name: Run unit tests | |
| run: | | |
| npm run test:common:unit:node | |
| - name: Export coverage metrics | |
| env: | |
| COVERAGE_REPORT_NAME: ${{ github.job }} (${{ matrix.node }}) | |
| run: | | |
| node .scripts/export-coverage-metrics.mjs | |
| common-unit-tests-web: | |
| timeout-minutes: 5 | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| browser: [chromium, firefox] # We're not testing in WebKit atm | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Setup NodeJS | |
| uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 | |
| with: | |
| node-version: 24 | |
| - name: Install dependencies | |
| run: | | |
| npm install | |
| npx playwright install ${{ matrix.browser }} | |
| - name: Run unit tests (${{ matrix.browser }}) | |
| env: | |
| BROWSER: ${{ matrix.browser }} | |
| run: | | |
| npm run test:common:unit:web | |
| - name: Export coverage metrics | |
| env: | |
| COVERAGE_REPORT_NAME: ${{ github.job }} (${{ matrix.browser }}) | |
| run: | | |
| node .scripts/export-coverage-metrics.mjs | |
| node-unit-tests: | |
| timeout-minutes: 5 | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| node: [20, 22, 24] | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Setup NodeJS ${{ matrix.node }} | |
| uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 | |
| with: | |
| node-version: ${{ matrix.node }} | |
| - name: Install dependencies | |
| run: | | |
| npm install | |
| - name: Install dependencies (examples) | |
| working-directory: examples | |
| run: | | |
| npm install | |
| - name: Run unit tests | |
| run: | | |
| npm run test:node:unit | |
| - name: Export coverage metrics | |
| env: | |
| COVERAGE_REPORT_NAME: ${{ github.job }} (${{ matrix.node }}) | |
| run: | | |
| node .scripts/export-coverage-metrics.mjs | |
| web-all-tests-local-single-node: | |
| timeout-minutes: 5 | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| browser: [chromium, firefox] # We're not testing in WebKit atm | |
| clickhouse: [head, latest] | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Start ClickHouse (version - ${{ matrix.clickhouse }}) in Docker | |
| uses: isbang/compose-action@3846bcd61da338e9eaaf83e7ed0234a12b099b72 # v2.4.2 | |
| env: | |
| CLICKHOUSE_VERSION: ${{ matrix.clickhouse }} | |
| with: | |
| compose-file: 'docker-compose.yml' | |
| down-flags: '--volumes' | |
| - name: Setup NodeJS | |
| uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 | |
| with: | |
| node-version: 24 | |
| - name: Install dependencies | |
| run: | | |
| npm install | |
| npx playwright install ${{ matrix.browser }} | |
| - name: Run all web tests | |
| env: | |
| BROWSER: ${{ matrix.browser }} | |
| run: | | |
| npm run test:web:all | |
| - name: Export coverage metrics | |
| env: | |
| COVERAGE_REPORT_NAME: ${{ github.job }} (${{ matrix.browser }}, ${{ matrix.clickhouse }}) | |
| run: | | |
| node .scripts/export-coverage-metrics.mjs | |
| node-integration-tests-local-single-node: | |
| timeout-minutes: 5 | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| node: [20, 22, 24] | |
| clickhouse: [head, latest] | |
| log_level: [undefined, TRACE] | |
| include: | |
| - node: 24 | |
| clickhouse: 26.2 | |
| log_level: undefined | |
| - node: 24 | |
| clickhouse: 26.1 | |
| log_level: undefined | |
| - node: 24 | |
| clickhouse: 25.12 | |
| log_level: undefined | |
| - node: 24 | |
| clickhouse: 25.11 | |
| log_level: undefined | |
| - node: 24 | |
| clickhouse: 25.10 | |
| log_level: undefined | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Start ClickHouse (version - ${{ matrix.clickhouse }}) in Docker | |
| uses: isbang/compose-action@3846bcd61da338e9eaaf83e7ed0234a12b099b72 # v2.4.2 | |
| env: | |
| CLICKHOUSE_VERSION: ${{ matrix.clickhouse }} | |
| with: | |
| compose-file: 'docker-compose.yml' | |
| down-flags: '--volumes' | |
| - name: Setup NodeJS ${{ matrix.node }} | |
| uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 | |
| with: | |
| node-version: ${{ matrix.node }} | |
| - 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 integration tests with TLS tests | |
| env: | |
| LOG_LEVEL: ${{ matrix.log_level }} | |
| run: | | |
| npm run test:node:integration:tls | |
| - name: Export coverage metrics | |
| env: | |
| COVERAGE_REPORT_NAME: ${{ github.job }} (${{ matrix.node }}, ${{ matrix.clickhouse }}, ${{ matrix.log_level }}) | |
| run: | | |
| node .scripts/export-coverage-metrics.mjs | |
| node-integration-tests-local-cluster: | |
| timeout-minutes: 5 | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| node: [20, 22, 24] | |
| clickhouse: [head, latest] | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Start ClickHouse cluster (version - ${{ matrix.clickhouse }}) in Docker | |
| uses: isbang/compose-action@3846bcd61da338e9eaaf83e7ed0234a12b099b72 # v2.4.2 | |
| env: | |
| CLICKHOUSE_VERSION: ${{ matrix.clickhouse }} | |
| with: | |
| compose-file: 'docker-compose.yml' | |
| down-flags: '--volumes' | |
| - name: Setup NodeJS ${{ matrix.node }} | |
| uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 | |
| with: | |
| node-version: ${{ matrix.node }} | |
| - name: Install dependencies | |
| run: | | |
| npm install | |
| - name: Run integration tests | |
| run: | | |
| npm run test:node:integration:local_cluster | |
| - name: Export coverage metrics | |
| env: | |
| COVERAGE_REPORT_NAME: ${{ github.job }} (${{ matrix.node }}) | |
| run: | | |
| node .scripts/export-coverage-metrics.mjs | |
| web-integration-tests-local-cluster: | |
| timeout-minutes: 5 | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| browser: [chromium, firefox] # We're not testing in WebKit atm | |
| clickhouse: [head, latest] | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Start ClickHouse cluster (version - ${{ matrix.clickhouse }}) in Docker | |
| uses: isbang/compose-action@3846bcd61da338e9eaaf83e7ed0234a12b099b72 # v2.4.2 | |
| env: | |
| CLICKHOUSE_VERSION: ${{ matrix.clickhouse }} | |
| with: | |
| compose-file: 'docker-compose.yml' | |
| down-flags: '--volumes' | |
| - name: Setup NodeJS | |
| uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 | |
| with: | |
| node-version: 24 | |
| - name: Install dependencies | |
| run: | | |
| npm install | |
| npx playwright install ${{ matrix.browser }} | |
| - name: Run all web tests | |
| env: | |
| BROWSER: ${{ matrix.browser }} | |
| run: | | |
| npm run test:web:integration:local_cluster | |
| - name: Export coverage metrics | |
| env: | |
| COVERAGE_REPORT_NAME: ${{ github.job }} (${{ matrix.browser }}, ${{ matrix.clickhouse }}) | |
| run: | | |
| node .scripts/export-coverage-metrics.mjs | |
| node-integration-tests-cloud: | |
| timeout-minutes: 5 | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| node: [20, 22, 24] | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Setup NodeJS ${{ matrix.node }} | |
| uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 | |
| with: | |
| node-version: ${{ matrix.node }} | |
| - name: Install dependencies | |
| run: | | |
| npm install | |
| - name: Run integration tests | |
| env: | |
| CLICKHOUSE_CLOUD_HOST: ${{ secrets.INTEGRATIONS_TEAM_TESTS_CLOUD_HOST_SMT_PROD }} | |
| CLICKHOUSE_CLOUD_PASSWORD: ${{ secrets.INTEGRATIONS_TEAM_TESTS_CLOUD_PASSWORD_SMT_PROD }} | |
| CLICKHOUSE_CLOUD_JWT_ACCESS_TOKEN: ${{ secrets.INTEGRATIONS_TEAM_TESTS_CLOUD_JWT_DESERT_VM_43_PROD }} | |
| run: | | |
| npm run test:node:integration:cloud | |
| - name: Export coverage metrics | |
| env: | |
| COVERAGE_REPORT_NAME: ${{ github.job }} (${{ matrix.node }}) | |
| run: | | |
| node .scripts/export-coverage-metrics.mjs | |
| web-integration-tests-cloud: | |
| timeout-minutes: 5 | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| browser: [chromium, firefox] # We're not testing in WebKit atm | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Setup NodeJS | |
| uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 | |
| with: | |
| node-version: 24 | |
| - name: Install dependencies | |
| run: | | |
| npm install | |
| npx playwright install ${{ matrix.browser }} | |
| - name: Run integration tests and JWT auth | |
| env: | |
| CLICKHOUSE_CLOUD_HOST: ${{ secrets.INTEGRATIONS_TEAM_TESTS_CLOUD_HOST_SMT_PROD }} | |
| CLICKHOUSE_CLOUD_PASSWORD: ${{ secrets.INTEGRATIONS_TEAM_TESTS_CLOUD_PASSWORD_SMT_PROD }} | |
| CLICKHOUSE_CLOUD_JWT_ACCESS_TOKEN: ${{ secrets.INTEGRATIONS_TEAM_TESTS_CLOUD_JWT_DESERT_VM_43_PROD }} | |
| BROWSER: ${{ matrix.browser }} | |
| run: | | |
| npm run test:web:integration:cloud:jwt | |
| - name: Export coverage metrics | |
| env: | |
| COVERAGE_REPORT_NAME: ${{ github.job }} (${{ matrix.browser }}) | |
| run: | | |
| node .scripts/export-coverage-metrics.mjs | |
| # It should only use the current LTS version of Node.js. | |
| node-codecov-upload: | |
| timeout-minutes: 5 | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| fetch-depth: 0 | |
| - name: Start ClickHouse (version - ${{ matrix.clickhouse }}) in Docker | |
| uses: isbang/compose-action@3846bcd61da338e9eaaf83e7ed0234a12b099b72 # v2.4.2 | |
| with: | |
| compose-file: 'docker-compose.yml' | |
| down-flags: '--volumes' | |
| - name: Setup NodeJS | |
| uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 | |
| with: | |
| node-version: 24 | |
| - 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 | |
| env: | |
| LOG_LEVEL: TRACE | |
| run: | | |
| npm run test:node:coverage | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2 | |
| with: | |
| name: node | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: ./coverage/lcov.info | |
| fail_ci_if_error: true | |
| # It should only use the current version of Chrome | |
| web-codecov-upload: | |
| timeout-minutes: 5 | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| fetch-depth: 0 | |
| - name: Start ClickHouse (version - ${{ matrix.clickhouse }}) in Docker | |
| uses: isbang/compose-action@3846bcd61da338e9eaaf83e7ed0234a12b099b72 # v2.4.2 | |
| with: | |
| compose-file: 'docker-compose.yml' | |
| down-flags: '--volumes' | |
| - name: Setup NodeJS | |
| uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 | |
| with: | |
| node-version: 24 | |
| - name: Install dependencies | |
| run: | | |
| npm install | |
| npx playwright install chromium | |
| - 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 | |
| env: | |
| LOG_LEVEL: TRACE | |
| run: | | |
| npm run test:web:coverage | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2 | |
| with: | |
| name: web | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: ./coverage/lcov.info | |
| fail_ci_if_error: true | |
| success: | |
| needs: | |
| [ | |
| 'code-quality', | |
| 'code-quality-examples', | |
| 'run-examples', | |
| 'common-unit-tests-node', | |
| 'common-unit-tests-web', | |
| 'node-unit-tests', | |
| 'node-integration-tests-local-single-node', | |
| 'node-integration-tests-local-cluster', | |
| 'node-integration-tests-cloud', | |
| 'node-codecov-upload', | |
| 'web-all-tests-local-single-node', | |
| 'web-integration-tests-local-cluster', | |
| 'web-integration-tests-cloud', | |
| 'web-codecov-upload', | |
| ] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: All tests passed | |
| run: echo "All tests passed! 🎉" |