test: converting test suite to TestContainers #879
Workflow file for this run
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: ci | |
| on: | |
| push: | |
| branches: [master] | |
| pull_request: | |
| branches: [master] | |
| env: | |
| rust_version: 1.85 | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: ${{ env.rust_version }} | |
| components: rustfmt, clippy | |
| - run: cargo fmt -- --check | |
| - run: cargo clippy -- -Dwarnings | |
| - run: cargo clippy --tests -- -Dwarnings | |
| - run: cargo test --doc | |
| check: | |
| strategy: | |
| matrix: | |
| include: | |
| - os: macos-15 | |
| - os: windows-2025 | |
| features: cmake-build,libz-static,curl-static | |
| rdkafka-sys-features: cmake-build,libz-static,curl-static | |
| - os: ubuntu-24.04 | |
| features: tracing | |
| - os: ubuntu-24.04 | |
| features: cmake-build,ssl-vendored,gssapi-vendored,libz-static,curl-static,zstd | |
| rdkafka-sys-features: cmake-build,ssl-vendored,gssapi-vendored,libz-static,curl-static,zstd | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: lukka/get-cmake@latest | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: ${{ env.rust_version }} | |
| - run: cargo build --all-targets --verbose --features "${{ matrix.features }}" | |
| - run: cd rdkafka-sys && cargo test --features "${{ matrix.rdkafka-sys-features }}" | |
| # Use the `minimal-versions` resolver to ensure we're not claiming to support | |
| # an older version of a dependency than we actually do. | |
| check-minimal-versions: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| # The version of this toolchain doesn't matter much. It's only used to | |
| # generate the minimal-versions lockfile, not to actually run `cargo | |
| # check`. | |
| toolchain: nightly | |
| components: rustfmt, clippy | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: ${{ env.rust_version }} | |
| - run: rustup default ${{ env.rust_version }} | |
| - run: cargo +nightly -Z minimal-versions generate-lockfile | |
| # Default features and features that require optional dependencies should be | |
| # explicitly checked. | |
| - run: cargo check --features libz,tokio,tracing | |
| test: | |
| strategy: | |
| fail-fast: false | |
| # Each row spins up its own Docker container via testcontainers, so | |
| # keep them sequential to avoid contention on a single runner. | |
| max-parallel: 1 | |
| matrix: | |
| include: | |
| - kafka-version: "4.0" | |
| - kafka-version: "3.9" | |
| - kafka-version: "3.8" | |
| - kafka-version: "3.7" | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: lukka/get-cmake@latest | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: ${{ env.rust_version }} | |
| - run: sudo apt-get update | |
| - run: sudo apt-get install -y libcurl4-openssl-dev | |
| - run: cargo test | |
| env: | |
| KAFKA_VERSION: ${{ matrix.kafka-version }} | |
| RUST_LOG: off | |
| RUST_BACKTRACE: 1 | |
| # Smoke-test the smol and async-std runtime examples against a real | |
| # broker. The integration suite covers the tokio path via testcontainers; | |
| # this job catches breakage in the alternative runtimes that | |
| # `cargo build --all-targets` would miss. | |
| runtime-examples: | |
| runs-on: ubuntu-24.04 | |
| services: | |
| kafka: | |
| image: apache/kafka:4.0.2 | |
| ports: | |
| - 9092:9092 | |
| env: | |
| KAFKA_NODE_ID: 1 | |
| KAFKA_PROCESS_ROLES: broker,controller | |
| KAFKA_LISTENERS: PLAINTEXT://:9092,CONTROLLER://:9093 | |
| KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://localhost:9092 | |
| KAFKA_CONTROLLER_LISTENER_NAMES: CONTROLLER | |
| KAFKA_CONTROLLER_QUORUM_VOTERS: 1@localhost:9093 | |
| KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT | |
| KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 | |
| KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1 | |
| KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1 | |
| options: >- | |
| --health-cmd "/opt/kafka/bin/kafka-topics.sh --bootstrap-server localhost:9092 --list" | |
| --health-interval 5s | |
| --health-timeout 5s | |
| --health-retries 12 | |
| --health-start-period 30s | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: lukka/get-cmake@latest | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: ${{ env.rust_version }} | |
| - run: sudo apt-get update | |
| - run: sudo apt-get install -y libcurl4-openssl-dev | |
| - run: cargo run --example runtime_smol --no-default-features --features cmake-build -- --topic smol | |
| - run: cargo run --example runtime_async_std --no-default-features --features cmake-build -- --topic async-std |