Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,34 @@ jobs:
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ matrix.target }}-kafka-${{ hashFiles('**/Cargo.lock') }}

- name: Find and fix librdkafka CMakeLists.txt
run: |
# Download the package first so it's in the registry
cargo fetch

# Find the rdkafka-sys package directory
RDKAFKA_SYS_DIR=$(find ~/.cargo/registry/src -name "rdkafka-sys-*" -type d | head -n 1)
echo "Found rdkafka-sys at: $RDKAFKA_SYS_DIR"

# Find the librdkafka CMakeLists.txt file
CMAKE_FILE="$RDKAFKA_SYS_DIR/librdkafka/CMakeLists.txt"

if [ -f "$CMAKE_FILE" ]; then
echo "Found CMakeLists.txt at: $CMAKE_FILE"

# Make a backup of the original file
cp "$CMAKE_FILE" "$CMAKE_FILE.bak"

# Replace the minimum required version
sed -i 's/cmake_minimum_required(VERSION 3.2)/cmake_minimum_required(VERSION 3.5)/' "$CMAKE_FILE"

echo "Modified CMakeLists.txt - before and after comparison:"
diff "$CMAKE_FILE.bak" "$CMAKE_FILE" || true
else
echo "Could not find librdkafka CMakeLists.txt file!"
exit 1
fi

- name: Build with Kafka
uses: actions-rs/cargo@v1
Expand Down
28 changes: 0 additions & 28 deletions .github/workflows/coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,34 +62,6 @@ jobs:
exit 1
fi

- name: Find and fix librdkafka CMakeLists.txt
run: |
# Download the package first so it's in the registry
cargo fetch

# Find the rdkafka-sys package directory
RDKAFKA_SYS_DIR=$(find ~/.cargo/registry/src -name "rdkafka-sys-*" -type d | head -n 1)
echo "Found rdkafka-sys at: $RDKAFKA_SYS_DIR"

# Find the librdkafka CMakeLists.txt file
CMAKE_FILE="$RDKAFKA_SYS_DIR/librdkafka/CMakeLists.txt"

if [ -f "$CMAKE_FILE" ]; then
echo "Found CMakeLists.txt at: $CMAKE_FILE"

# Make a backup of the original file
cp "$CMAKE_FILE" "$CMAKE_FILE.bak"

# Replace the minimum required version
sed -i 's/cmake_minimum_required(VERSION 3.2)/cmake_minimum_required(VERSION 3.5)/' "$CMAKE_FILE"

echo "Modified CMakeLists.txt - before and after comparison:"
diff "$CMAKE_FILE.bak" "$CMAKE_FILE" || true
else
echo "Could not find librdkafka CMakeLists.txt file!"
exit 1
fi

- name: Check with clippy
run: cargo hack clippy --verbose --each-feature --no-dev-deps -- -D warnings

Expand Down
24 changes: 21 additions & 3 deletions Dockerfile.kafka
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,27 @@ RUN apt-get update && \
WORKDIR /parseable
COPY Cargo.toml Cargo.lock build.rs ./

# Create a dummy main.rs to pre-cache dependencies
RUN mkdir src && echo "fn main() {}" > src/main.rs && \
cargo build --release --features kafka && \
# Fix librdkafka CMakeLists.txt before building
RUN mkdir -p src && echo "fn main() {}" > src/main.rs && \
# Download the package so it's in the cargo registry
cargo fetch && \
# Find rdkafka-sys directory
RDKAFKA_SYS_DIR=$(find /usr/local/cargo/registry/src -name "rdkafka-sys-*" -type d | head -n 1) && \
echo "Found rdkafka-sys at: $RDKAFKA_SYS_DIR" && \
# Find the CMakeLists.txt file
CMAKE_FILE="$RDKAFKA_SYS_DIR/librdkafka/CMakeLists.txt" && \
if [ -f "$CMAKE_FILE" ]; then \
echo "Found CMakeLists.txt at: $CMAKE_FILE" && \
# Replace the minimum required version
sed -i 's/cmake_minimum_required(VERSION 3.2)/cmake_minimum_required(VERSION 3.5)/' "$CMAKE_FILE" && \
echo "Modified CMakeLists.txt to use CMake 3.5 minimum version"; \
else \
echo "Could not find librdkafka CMakeLists.txt file!" && \
exit 1; \
fi

# Now build dependencies with the fixed CMakeLists.txt
RUN cargo build --release --features kafka && \
rm -rf src

# Copy the actual source code
Expand Down
Loading
Loading