-
Notifications
You must be signed in to change notification settings - Fork 12
93 lines (76 loc) · 2.32 KB
/
tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
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: [18, 20, 22]
steps:
- uses: actions/checkout@main
- name: Setup NodeJS ${{ matrix.node }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- name: Install dependencies
run: |
npm ci
- name: Linting
run: |
npm run lint
- name: Unit testing
run: |
npm run test
node-integration-tests-local-single-node:
needs: unit-tests
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
node: [18, 20, 22]
clickhouse: [head, latest]
steps:
- uses: actions/checkout@main
- name: Start ClickHouse (version - ${{ matrix.clickhouse }}) using docker-compose
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@v4
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