Skip to content

Commit 7021be0

Browse files
committed
ci: add runtime-examples job for the smol and async-std examples
Bring back the e2e smoke test for the alternative runtime examples that test_suite.sh used to run. Putting it in its own job, with a service-container broker, instead of re-entangling it with the integration suite: - the integration test job uses testcontainers and a random host port, so it can't host examples that hardcode localhost:9092; - the examples are runtime-correctness checks for smol and async-std, not broker-compatibility checks, so a single pinned Kafka version is enough and matrixing across 3.7-4.0 would be wasted CI time. The service container is apache/kafka:4.0.2 in KRaft mode with the same single-broker overrides we set in tests/utils/containers.rs (transaction-state-log RF/ISR = 1), exposed on localhost:9092 with a kafka-topics.sh-based healthcheck so the runner waits for the broker before launching cargo. The examples produce / consume one message each and exit non-zero on failure. Verified locally that both examples compile with `--no-default-features --features cmake-build`. The check job's cargo build --all-targets continues to catch pure compile breakage; this job catches anything that only manifests at runtime.
1 parent 0866fbc commit 7021be0

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,42 @@ jobs:
9494
KAFKA_VERSION: ${{ matrix.kafka-version }}
9595
RUST_LOG: off
9696
RUST_BACKTRACE: 1
97+
98+
# Smoke-test the smol and async-std runtime examples against a real
99+
# broker. The integration suite covers the tokio path via testcontainers;
100+
# this job catches breakage in the alternative runtimes that
101+
# `cargo build --all-targets` would miss.
102+
runtime-examples:
103+
runs-on: ubuntu-24.04
104+
services:
105+
kafka:
106+
image: apache/kafka:4.0.2
107+
ports:
108+
- 9092:9092
109+
env:
110+
KAFKA_NODE_ID: 1
111+
KAFKA_PROCESS_ROLES: broker,controller
112+
KAFKA_LISTENERS: PLAINTEXT://:9092,CONTROLLER://:9093
113+
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://localhost:9092
114+
KAFKA_CONTROLLER_LISTENER_NAMES: CONTROLLER
115+
KAFKA_CONTROLLER_QUORUM_VOTERS: 1@localhost:9093
116+
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT
117+
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
118+
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
119+
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
120+
options: >-
121+
--health-cmd "/opt/kafka/bin/kafka-topics.sh --bootstrap-server localhost:9092 --list"
122+
--health-interval 5s
123+
--health-timeout 5s
124+
--health-retries 12
125+
--health-start-period 30s
126+
steps:
127+
- uses: actions/checkout@v4
128+
- uses: lukka/get-cmake@latest
129+
- uses: dtolnay/rust-toolchain@stable
130+
with:
131+
toolchain: ${{ env.rust_version }}
132+
- run: sudo apt-get update
133+
- run: sudo apt-get install -y libcurl4-openssl-dev
134+
- run: cargo run --example runtime_smol --no-default-features --features cmake-build -- --topic smol
135+
- run: cargo run --example runtime_async_std --no-default-features --features cmake-build -- --topic async-std

0 commit comments

Comments
 (0)