tests #427
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' | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| paths-ignore: | |
| - '**/*.md' | |
| schedule: | |
| - cron: '0 9 * * *' | |
| jobs: | |
| unit-tests: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: true | |
| matrix: | |
| node: [20, 22, 24] | |
| steps: | |
| - uses: actions/checkout@main | |
| - name: Setup NodeJS ${{ matrix.node }} | |
| uses: actions/setup-node@v5 | |
| with: | |
| node-version: ${{ matrix.node }} | |
| - name: Install dependencies | |
| run: | | |
| npm ci | |
| - name: Linting | |
| run: | | |
| npm run lint | |
| - name: Unit testing | |
| run: | | |
| npm run test:unit | |
| node-integration-tests-local-single-node: | |
| needs: unit-tests | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: true | |
| matrix: | |
| node: [20, 22, 24] | |
| clickhouse: [head, latest] | |
| steps: | |
| - uses: actions/checkout@main | |
| - name: Start ClickHouse (version - ${{ matrix.clickhouse }}) in Docker | |
| uses: isbang/[email protected] | |
| env: | |
| CLICKHOUSE_VERSION: ${{ matrix.clickhouse }} | |
| with: | |
| compose-file: 'docker-compose.yml' | |
| down-flags: '--volumes' | |
| - name: Setup NodeJS ${{ matrix.node }} | |
| uses: actions/setup-node@v5 | |
| with: | |
| node-version: ${{ matrix.node }} | |
| - name: Install dependencies | |
| run: | | |
| npm ci | |
| - name: Build | |
| run: | | |
| npm run build | |
| - name: Test - apply migrations ./tests/migrations/few | |
| run: | | |
| node ./lib/cli.js migrate --host=http://localhost:8123 --user=default --password='' --db=analytics --migrations-home=./tests/migrations/few | |
| - name: Verify Migration | |
| run: | | |
| echo "Checking if tables exist..." | |
| response=$(curl -s "http://localhost:8123/?query=SELECT%20groupArray(name)%20FROM%20system.tables%20WHERE%20name%20IN%20('_migrations','events','sessions')%20AND%20database%20=%20'analytics'") | |
| echo "Response: $response" | |
| expected_tables="['_migrations','events','sessions']" | |
| if [ "$response" = "$expected_tables" ]; then | |
| echo "The tables were created successfully." | |
| else | |
| echo "Tables were not found!" | |
| echo "Expected: $expected_tables" | |
| echo "Got: $response" | |
| exit 1 | |
| fi | |
| - name: Run TLS CLI Integration Tests | |
| run: npm test -- --testPathPatterns=tls.e2e.test.ts --verbose | |
| timeout-minutes: 10 | |
| env: | |
| CI: true |