-
Notifications
You must be signed in to change notification settings - Fork 200
120 lines (104 loc) · 3.87 KB
/
bazel.yml
File metadata and controls
120 lines (104 loc) · 3.87 KB
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
name: Bazel
on:
schedule:
- cron: '0 0 * * 1'
push:
branches: [ '*' ]
pull_request:
branches: [ master ]
release:
types:
- published
- prereleased
permissions:
contents: read
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04, macos-latest, windows-latest]
tls: [boringssl, openssl, 'no']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 100
fetch-tags: true
- name: Setup Bazel
uses: bazel-contrib/setup-bazel@0.15.0
with:
bazelisk-cache: true
disk-cache: true
repository-cache: true
- name: Build project
run: bazel build //... --@clickhouse-cpp-client//:tls=${{ matrix.tls }}
- name: Run unit tests
run: bazel test //ut:unit_tests --@clickhouse-cpp-client//:tls=${{ matrix.tls }} --test_output=errors
# //ut:e2e_tests is tagged `manual`, so `bazel build //...` above
# skips it; build it explicitly so the run step below doesn't pay
# for compilation under the running-server timeout.
- name: Build e2e tests
run: bazel build //ut:e2e_tests --@clickhouse-cpp-client//:tls=${{ matrix.tls }}
# The e2e suite needs a live server on localhost:9000. Each OS starts
# one the same way the CMake build's per-OS workflows do, since hosted
# runners can't all run a Linux container the same way:
# * Linux — docker-compose (linux.yml)
# * macOS — the native ClickHouse build run as a process (macos.yml)
# * Windows — the Linux container under WSL2 + podman (windows_msvc.yml)
- name: Start ClickHouse (Linux, docker-compose)
if: runner.os == 'Linux'
uses: hoverkraft-tech/compose-action@v2.0.1
with:
compose-file: ci/docker-compose.yml
down-flags: --volumes
- name: Start ClickHouse (macOS, native binary)
if: runner.os == 'macOS'
working-directory: ${{ runner.temp }}
run: |
curl https://builds.clickhouse.com/25.12/macos-aarch64/clickhouse -o clickhouse
chmod +x ./clickhouse
sudo mkdir -p /var/lib/clickhouse /var/log/clickhouse-server
sudo chown -R "$USER" /var/lib/clickhouse /var/log/clickhouse-server
nohup ./clickhouse server --config-file="$GITHUB_WORKSPACE/ci/docker-compose/config.xml" > clickhouse.log 2>&1 &
for i in {1..60}; do
if curl -fsS http://localhost:8123/ > /dev/null; then
echo "ClickHouse is ready"
exit 0
fi
sleep 1
done
echo "ClickHouse failed to start"
tail -200 clickhouse.log || true
exit 1
- name: Enable WSL (Windows)
if: runner.os == 'Windows'
uses: Vampire/setup-wsl@v5
with:
distribution: Ubuntu-24.04
additional-packages:
podman
podman-compose
- name: Start ClickHouse (Windows, WSL + podman)
if: runner.os == 'Windows'
shell: wsl-bash {0}
run: |
cd $(wslpath -u "${{ github.workspace }}/ci/")
podman-compose up -d
timeout 60s bash -c \
'until curl -s -o /dev/null -w "%{http_code}" http://localhost:8123 | grep -q "200"; do sleep 2; done'
curl -s http://localhost:8123/?query=SELECT%20VERSION%28%29
- name: Wait for ClickHouse (Linux)
if: runner.os == 'Linux'
run: |
for i in {1..60}; do
if curl -fsS http://localhost:8123/ > /dev/null; then
echo "ClickHouse is ready"
exit 0
fi
sleep 1
done
echo "ClickHouse failed to start"
exit 1
- name: Run e2e tests
run: bazel test //ut:e2e_tests --@clickhouse-cpp-client//:tls=${{ matrix.tls }} --test_output=errors