Merge pull request #441 from ilandry/clickhouse_client_move #214
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: 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//:tls=${{ matrix.tls }} | |
| - name: Run unit tests | |
| run: bazel test //ut:unit_tests --@clickhouse-cpp//: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//: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//:tls=${{ matrix.tls }} --test_output=errors |