Ci/workflow - #2
Conversation
Introduces TESTS.md with guidance on test directory structure, running unit and integration tests, and CI best practices. Adds integration/README.md detailing ClickHouse integration test setup, environment variables, and CI recommendations.
Introduces a docker-compose.yml to set up a ClickHouse server for testing, including environment variables, port mappings, persistent storage, and a healthcheck.
Introduces three GitHub Actions workflows: 'ci.yml' for unit tests and formatting on push and PRs, 'integration.yml' for matrix integration testing against multiple ClickHouse versions, and 'smoke-integration.yml' for basic smoke tests on pull requests. These workflows automate testing and validation for improved code quality and reliability.
Added CI and integration test badges, a Gleam version badge, and a new quick start section with example usage. Expanded documentation to clarify available modules and design inspiration.
There was a problem hiding this comment.
Pull Request Overview
This PR adds comprehensive integration testing infrastructure and documentation for the Sparkling ClickHouse client library. It establishes a foundation for running integration tests both locally and in CI environments.
- Introduces Docker Compose configuration for local ClickHouse testing
- Adds three GitHub Actions workflows: unit tests (CI), full integration tests, and smoke tests for PRs
- Provides detailed documentation on test organization, running tests locally, and CI guidance
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 15 comments.
Show a summary per file
| File | Description |
|---|---|
test/integration/README.md |
Comprehensive documentation for running integration tests locally and in CI |
test/TESTS.md |
Overview of test organization and structure across the repository |
docker-compose.yml |
Docker Compose configuration for ClickHouse test instance |
.github/workflows/ci.yml |
Main CI workflow for unit tests on PRs and main branch |
.github/workflows/integration.yml |
Full integration test workflow with matrix testing across ClickHouse versions |
.github/workflows/smoke-integration.yml |
Lightweight smoke tests for PRs using curl |
README.md |
Updated with CI badges, quick start example, and module overview |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| This document explains how to run integration tests locally and how to wire them into CI in a safe way. | ||
|
|
||
| Prerequisites |
There was a problem hiding this comment.
Missing markdown heading level indicator. This should be ## Prerequisites to maintain proper heading hierarchy.
| Prerequisites | |
| ## Prerequisites |
| - Docker (used for the example below). | ||
| - docker-compose (optional, if you prefer a compose-based setup). | ||
|
|
||
| Recommended local setup (Docker Compose) |
There was a problem hiding this comment.
Missing markdown heading level indicator. This should be ## Recommended local setup (Docker Compose) to maintain proper heading hierarchy.
| Recommended local setup (Docker Compose) | |
| ## Recommended local setup (Docker Compose) |
| docker-compose down -v | ||
| ``` | ||
|
|
||
| Quick single-container alternative (no compose) |
There was a problem hiding this comment.
Missing markdown heading level indicator. This should be ## Quick single-container alternative (no compose) to maintain proper heading hierarchy.
| Quick single-container alternative (no compose) | |
| ## Quick single-container alternative (no compose) |
| docker stop clickhouse-server && docker rm clickhouse-server | ||
| ``` | ||
|
|
||
| Connection details (local defaults) |
There was a problem hiding this comment.
Missing markdown heading level indicator. This should be ## Connection details (local defaults) to maintain proper heading hierarchy.
| Connection details (local defaults) | |
| ## Connection details (local defaults) |
|
|
||
| If your tests require different credentials or endpoints, set the appropriate environment variables (see the `Environment variables` section below). | ||
|
|
||
| Implemented integration tests |
There was a problem hiding this comment.
Missing markdown heading level indicator. This should be ## Implemented integration tests to maintain proper heading hierarchy.
| Implemented integration tests | |
| ## Implemented integration tests |
| docker stop clickhouse-server && docker rm clickhouse-server | ||
| ``` | ||
|
|
||
| Environment variables |
There was a problem hiding this comment.
Missing markdown heading level indicator. This should be ## Environment variables to maintain proper heading hierarchy.
| Environment variables | |
| ## Environment variables |
|
|
||
| Document required variables in `test/integration/README.md`. | ||
|
|
||
| CI guidance |
There was a problem hiding this comment.
Missing markdown heading level indicator. This should be ## CI guidance to maintain proper heading hierarchy.
| CI guidance | |
| ## CI guidance |
| - Pull Requests: run unit tests only. | ||
| - Integration tests: run in separate CI jobs (manual trigger, nightly, or on release tags). Ensure the CI environment has access to required services and secrets before enabling integration jobs. | ||
|
|
||
| Best practices and PR checklist |
There was a problem hiding this comment.
Missing markdown heading level indicator. This should be ## Best practices and PR checklist to maintain proper heading hierarchy.
| Best practices and PR checklist | |
| ## Best practices and PR checklist |
|
|
||
| ## Quick start | ||
|
|
||
| See the extracted quick start example: `docs/quickstart.md` it contains a short walkthrough (define schema, build a query, execute it with a repo). |
There was a problem hiding this comment.
Missing punctuation after docs/quickstart.md. Should be: 'See the extracted quick start example: docs/quickstart.md. It contains a short walkthrough (define schema, build a query, execute it with a repo).'
| See the extracted quick start example: `docs/quickstart.md` it contains a short walkthrough (define schema, build a query, execute it with a repo). | |
| See the extracted quick start example: `docs/quickstart.md`. It contains a short walkthrough (define schema, build a query, execute it with a repo). |
| if [ "$OUT" != '{"result":1}' ] && [ "$OUT" != '{"result":1}\n' ]; then | ||
| echo "Unexpected response: $OUT" | ||
| exit 2 | ||
| fi |
There was a problem hiding this comment.
The literal \\n check is incorrect. The newline comparison won't work as expected because $OUT from curl won't contain a literal \\n string. Consider using grep or checking the content without the newline: echo \"$OUT\" | grep -q '{\"result\":1}' or strip trailing whitespace before comparison.
| if [ "$OUT" != '{"result":1}' ] && [ "$OUT" != '{"result":1}\n' ]; then | |
| echo "Unexpected response: $OUT" | |
| exit 2 | |
| fi | |
| echo "$OUT" | grep -q '{"result":1}' || { | |
| echo "Unexpected response: $OUT" | |
| exit 2 | |
| } |
Bump Gleam version from 1.6.1 to 1.11.0 in CI and integration workflows, update cache keys accordingly, and reflect the new minimum version in the README badge. Also add a step to display the Gleam version in workflows.
This pull request introduces a comprehensive continuous integration (CI) and testing setup for the project, including GitHub Actions workflows for unit, smoke, and integration tests, as well as supporting documentation and configuration for local and CI-based testing. The changes ensure robust test coverage and provide clear instructions for contributors on running and organizing tests.
CI/CD Workflows and Automation:
.github/workflows/ci.ymlto run unit tests, formatting checks, and builds on pushes and pull requests tomain, ensuring code quality and correctness..github/workflows/smoke-integration.ymlto perform fast smoke tests against a ClickHouse instance on every pull request, verifying basic connectivity and minimal API functionality..github/workflows/integration.ymlfor full integration tests against multiple ClickHouse versions, triggered on push or manually, to ensure compatibility and deeper correctness.Testing Infrastructure and Documentation:
docker-compose.ymlfor spinning up a local ClickHouse service with test credentials, simplifying local and CI integration testing.test/TESTS.mdandtest/integration/README.mdto document the test structure, how to run tests locally or in CI, environment variables, and best practices for contributors. [1] [2]Project Documentation Updates:
README.mdto include CI and integration test badges, a quick start example, and a clear overview of the project structure and testing approach.These changes establish a solid foundation for reliable development, easier onboarding, and safer contributions.
Most important changes:
CI/CD and Test Automation
ci.yml) for all pushes/PRs tomain, running formatting, build, and test steps.smoke-integration.yml) for fast PR validation against ClickHouse.integration.yml) with matrix testing against multiple ClickHouse versions.Testing Infrastructure & Docs
docker-compose.ymlfor local/CI ClickHouse setup with test credentials and health checks.test/TESTS.mdandtest/integration/README.mdto explain test organization, local/CI execution, and environment configuration. [1] [2]Project Documentation
README.mdwith new CI badges, quick start, and clearer project/test structure overview.