Skip to content

Commit a299ec5

Browse files
committed
refactor: disaggregated CI pipelines for HQL and clickhouse tests
1 parent 271ff67 commit a299ec5

File tree

3 files changed

+154
-155
lines changed

3 files changed

+154
-155
lines changed
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: HQL ClickHouse Wrapper Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- devin/eng-3012-ci
8+
pull_request:
9+
branches:
10+
- main
11+
paths:
12+
# ClickHouse wrapper and database implementation files
13+
- "valhalla/jawn/src/lib/db/ClickhouseWrapper.ts"
14+
- "valhalla/jawn/src/managers/HeliconeSqlManager.ts"
15+
# ClickHouse wrapper test files
16+
- "valhalla/jawn/src/lib/db/test/TestClickhouseWrapper.test.ts"
17+
- "valhalla/jawn/src/lib/db/test/TestClickhouseWrapper.ts"
18+
- "valhalla/jawn/src/lib/db/test/clickhouseMockData.ts"
19+
# Workflow file itself
20+
- ".github/workflows/hql-clickhouse-tests.yml"
21+
22+
jobs:
23+
hql-clickhouse-wrapper-tests:
24+
name: HQL ClickHouse Wrapper Tests
25+
runs-on: ubuntu-latest
26+
defaults:
27+
run:
28+
working-directory: valhalla/jawn
29+
services:
30+
clickhouse:
31+
image: clickhouse/clickhouse-server:latest
32+
ports:
33+
- 8123:8123
34+
- 9000:9000
35+
options: >-
36+
--health-cmd "wget --no-verbose --tries=1 --spider http://localhost:8123/ping || exit 1"
37+
--health-interval 10s
38+
--health-timeout 5s
39+
--health-retries 5
40+
steps:
41+
- uses: actions/checkout@v4
42+
43+
- name: Setup Node.js
44+
uses: actions/setup-node@v4
45+
with:
46+
node-version: "20"
47+
cache: "yarn"
48+
cache-dependency-path: "**/yarn.lock"
49+
50+
- name: Install dependencies
51+
run: |
52+
# Retry logic for yarn install with fallback to npm
53+
for i in 1 2 3; do
54+
echo "Attempt $i: Installing dependencies..."
55+
if yarn install --frozen-lockfile --network-timeout 100000; then
56+
echo "✓ Successfully installed dependencies"
57+
exit 0
58+
fi
59+
echo "Attempt $i failed, waiting 5 seconds..."
60+
sleep 5
61+
done
62+
# Fallback to npm if yarn fails
63+
echo "Yarn failed, using npm install..."
64+
npm install
65+
66+
- name: Wait for ClickHouse
67+
run: |
68+
for i in {1..30}; do
69+
if curl -s http://localhost:8123/ping > /dev/null; then
70+
echo "ClickHouse is ready"
71+
break
72+
fi
73+
echo "Waiting for ClickHouse... ($i/30)"
74+
sleep 2
75+
done
76+
77+
- name: Run ClickHouse Wrapper Tests
78+
run: yarn test:jawn TestClickhouseWrapper.test.ts
79+
env:
80+
NODE_ENV: test
81+
CLICKHOUSE_HOST: localhost
82+
CLICKHOUSE_PORT: 8123
83+
CLICKHOUSE_USER: default
84+
CLICKHOUSE_PASSWORD: ""
85+
CLICKHOUSE_DATABASE: default
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: HQL Security Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- devin/eng-3012-ci
8+
pull_request:
9+
branches:
10+
- main
11+
paths:
12+
# HQL security-related implementation files
13+
- "valhalla/jawn/src/lib/stores/HqlStore.ts"
14+
- "valhalla/jawn/src/lib/errors/HqlErrors.ts"
15+
- "valhalla/jawn/src/managers/HqlQueryManager.ts"
16+
- "valhalla/jawn/src/controllers/public/heliconeSqlController.ts"
17+
# HQL security test files
18+
- "valhalla/jawn/src/lib/db/test/hqlSecurityTests.test.ts"
19+
- "valhalla/jawn/src/lib/db/test/MockClickhouseWrapper.ts"
20+
- "valhalla/jawn/src/controllers/public/__tests__/heliconeSqlController.test.ts"
21+
# Web HQL files
22+
- "web/lib/api/hql/**"
23+
# Workflow file itself
24+
- ".github/workflows/hql-security-tests.yml"
25+
26+
jobs:
27+
hql-security-tests:
28+
name: HQL Security Tests
29+
runs-on: ubuntu-latest
30+
defaults:
31+
run:
32+
working-directory: valhalla/jawn
33+
steps:
34+
- uses: actions/checkout@v4
35+
36+
- name: Setup Node.js
37+
uses: actions/setup-node@v4
38+
with:
39+
node-version: "20"
40+
cache: "yarn"
41+
cache-dependency-path: "**/yarn.lock"
42+
43+
- name: Install dependencies
44+
run: |
45+
# Retry logic for yarn install with fallback to npm
46+
for i in 1 2 3; do
47+
echo "Attempt $i: Installing dependencies..."
48+
if yarn install --frozen-lockfile --network-timeout 100000; then
49+
echo "✓ Successfully installed dependencies"
50+
exit 0
51+
fi
52+
echo "Attempt $i failed, waiting 5 seconds..."
53+
sleep 5
54+
done
55+
# Fallback to npm if yarn fails
56+
echo "Yarn failed, using npm install..."
57+
npm install
58+
59+
- name: Run HQL Security Tests
60+
run: yarn test:jawn hqlSecurityTests.test.ts
61+
env:
62+
NODE_ENV: test
63+
64+
# Note: API integration tests are skipped in CI because they require
65+
# the full Jawn server to be running on port 8585.
66+
# These tests should be run locally or in a more complete E2E test environment.
67+
# To run locally:
68+
# 1. Start the Jawn server: yarn start
69+
# 2. Run tests: yarn test:jawn heliconeSqlController.test.ts

.github/workflows/hql-test.yml

Lines changed: 0 additions & 155 deletions
This file was deleted.

0 commit comments

Comments
 (0)