Skip to content
Draft
Show file tree
Hide file tree
Changes from all 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
59 changes: 56 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ concurrency:
env:
DOCKER_CMAKE_FLAGS: -DDOCKER_VERIFY_THREAD=3 -DUSE_SHARED_LIBS= -DSTRICT_GSL_CHECKS=AUDIT -DCI_BUILD=ON -DENABLE_AWS=ON -DENABLE_KAFKA=ON -DENABLE_MQTT=ON -DENABLE_AZURE=ON -DENABLE_SQL=ON \
-DENABLE_SPLUNK=ON -DENABLE_GCP=ON -DENABLE_OPC=ON -DENABLE_PYTHON_SCRIPTING=ON -DENABLE_LUA_SCRIPTING=ON -DENABLE_KUBERNETES=ON -DENABLE_TEST_PROCESSORS=ON -DENABLE_PROMETHEUS=ON \
-DENABLE_ELASTICSEARCH=ON -DENABLE_GRAFANA_LOKI=ON -DENABLE_COUCHBASE=ON -DENABLE_LLAMACPP=ON -DDOCKER_BUILD_ONLY=ON -DMINIFI_PERFORMANCE_TESTS=ON
-DENABLE_ELASTICSEARCH=ON -DENABLE_GRAFANA_LOKI=ON -DENABLE_COUCHBASE=ON -DENABLE_LLAMACPP=ON -DDOCKER_BUILD_ONLY=ON -DMINIFI_PERFORMANCE_TESTS=ON -DMINIFI_RUST=OFF
CCACHE_DIR: ${{ GITHUB.WORKSPACE }}/.ccache
jobs:
macos_xcode:
Expand Down Expand Up @@ -552,8 +552,55 @@ jobs:
with:
name: behavex_output_modular
path: build/behavex_output_modular
rusty_docker_tests:
name: "Rusty Docker integration tests (x86_64)"
needs: docker_build
runs-on: ubuntu-24.04
timeout-minutes: 20
steps:
- id: checkout
uses: actions/checkout@v6
- id: run_cmake
name: Run CMake
run: |
mkdir build
cd build
cmake ${DOCKER_CMAKE_FLAGS} ..
- name: Download artifact
uses: actions/download-artifact@v8
with:
name: minifi_docker
path: build
- name: Load Docker image
run: |
docker load --input ./build/minifi_docker.tar && docker tag apacheminificpp:1.0.0 apacheminificpp:behave
- id: install_deps
name: Install dependencies for Docker Verify
run: |
sudo apt update
sudo apt install -y python3-virtualenv
- id: test
name: Docker Verify
working-directory: ./minifi_rust
run: cargo behave-alpine
- name: Test Reporter
if: always()
uses: dorny/test-reporter@a43b3a5f7366b97d083190328d2c652e1a8b6aa2 # v3
with:
name: Docker integration tests
path: minifi_rust/minifi_rs_behave/output/behave/*.xml
reporter: java-junit
only-summary: 'true'
list-tests: 'failed'
list-suites: 'failed'
- name: Upload artifact
if: failure()
uses: actions/upload-artifact@v7
with:
name: minifi_rs_behave
path: minifi_rust/minifi_rs_behave/output
linters:
name: "C++ lint + Shellcheck + Flake8"
name: "C++ lint + Shellcheck + Flake8 + Cargo check"
runs-on: ubuntu-22.04-arm
timeout-minutes: 15
steps:
Expand All @@ -578,8 +625,14 @@ jobs:
continue-on-error: true
run: ./run_flake8.sh .

- id: cargo_check
name: Cargo check
continue-on-error: true
run: cargo fmt --check
working-directory: minifi_rust

Comment on lines 602 to +633
- name: Check Linter Statuses
if: steps.cpp_lint.outcome == 'failure' || steps.shellcheck.outcome == 'failure' || steps.flake8_check.outcome == 'failure'
if: steps.cpp_lint.outcome == 'failure' || steps.shellcheck.outcome == 'failure' || steps.flake8_check.outcome == 'failure' || steps.cargo_check.outcome == 'failure'
run: |
echo "One or more linters failed. Failing the workflow."
exit 1
10 changes: 10 additions & 0 deletions .github/workflows/create-release-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,16 @@ jobs:
with:
name: ${{ matrix.platform.rpm-artifact }}
path: build/nifi-minifi-cpp-*.rpm

- id: cargo
working-directory: minifi_rust
run: |
cargo build --release

- uses: actions/upload-artifact@v7
with:
name: minifi_rust_extensions
path: minifi_rust/target/release/*.so
windows_VS2022:
name: "Windows Server 2025 x86_64"
runs-on: windows-2025
Expand Down
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -851,3 +851,5 @@ if (MINIFI_ADVANCED_CODE_COVERAGE)
endif()

add_subdirectory(packaging)

add_subdirectory(minifi_rust)
1 change: 1 addition & 0 deletions cmake/MiNiFiOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ add_minifi_option(ENABLE_EXECUTE_PROCESS "Enable ExecuteProcess processor" OFF)
add_minifi_option(ENABLE_CONTROLLER "Enables the build of MiNiFi controller binary." ON)
add_minifi_option(ENABLE_LLAMACPP "Enables llama.cpp support." ON)
add_minifi_option(ENABLE_OPC "Instructs the build system to enable the OPC extension" ON)
add_minifi_option(MINIFI_RUST "Enables the build of rust based extension." ON)
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be better to keep it OFF since it requires rust compiler. (also just we probably need to handle this in bootstrap)


Comment on lines 116 to 120
set_minifi_cache_variable(CUSTOM_MALLOC OFF "Overwrite malloc implementation.")
set_property(CACHE CUSTOM_MALLOC PROPERTY STRINGS "jemalloc" "mimalloc" "rpmalloc" OFF)
Expand Down
5 changes: 3 additions & 2 deletions docker/rockylinux/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
#
ARG BASE_IMAGE="rockylinux:8"
ARG BASE_IMAGE="rockylinux:9"

FROM ${BASE_IMAGE} AS build
LABEL maintainer="Apache NiFi <dev@nifi.apache.org>"
Expand All @@ -42,11 +42,12 @@ COPY . ${MINIFI_BASE_DIR}
# Install the system dependencies needed for a build
# ccache is in EPEL
RUN dnf -y install epel-release && dnf -y install gcc-toolset-14 sudo git which make libarchive ccache ca-certificates perl patch bison flex libtool cmake rpmdevtools && \
if echo "$MINIFI_OPTIONS" | grep -q "ENABLE_ALL=ON\|MINIFI_RUST=ON"; then dnf -y install rust cargo clang; fi && \
if echo "$MINIFI_OPTIONS" | grep -q "ENABLE_ALL=ON\|ENABLE_PYTHON_SCRIPTING=ON\|ENABLE_OPC=ON"; then dnf -y --enablerepo=devel install python3-devel; fi && \
if echo "$MINIFI_OPTIONS" | grep -q "ENABLE_SFTP=ON" && [ "${DOCKER_SKIP_TESTS}" == "OFF" ]; then dnf -y install java-1.8.0-openjdk maven; fi

RUN cd $MINIFI_BASE_DIR && \
ln -s /usr/bin/ccache /usr/lib64/ccache/c++
ln -sfn /usr/bin/ccache /usr/lib64/ccache/c++

# Setup minificpp user
RUN groupadd -g ${GID} ${USER} && useradd -g ${GID} ${USER} && \
Expand Down
19 changes: 19 additions & 0 deletions minifi_rust/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[target.aarch64-unknown-linux-musl]
rustflags = ["-C", "target-feature=-crt-static"]

[target.x86_64-unknown-linux-musl]
rustflags = ["-C", "target-feature=-crt-static"]

[target.aarch64-apple-darwin]
rustflags = ["-C", "link-arg=-undefined", "-C", "link-arg=dynamic_lookup"]

[target.x86_64-apple-darwin]
rustflags = ["-C", "link-arg=-undefined", "-C", "link-arg=dynamic_lookup"]

[alias]
behave = ["run", "--release", "--bin", "minifi_rs_behave"]
behave-alpine = ["run", "--release", "--bin", "minifi_rs_behave", "--", "--alpine"]
behave-debian = ["run", "--release", "--bin", "minifi_rs_behave", "--", "--debian"]

[env]
MINIFI_SDK_PATH="../"
12 changes: 12 additions & 0 deletions minifi_rust/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.git
.vscode
.gitmodules
.idea
output
features
target/debug
target/release/build
target/release/deps
target/release/.fingerprint
target/release/examples
target/release/incremental
7 changes: 7 additions & 0 deletions minifi_rust/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.idea
output
venv
.venv
target
.DS_Store
Cargo.lock
42 changes: 42 additions & 0 deletions minifi_rust/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Licensed to the Apache Software Foundation (ASF) under one
#
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#

if (NOT (ENABLE_ALL OR MINIFI_RUST))
return()
endif()

include(FetchContent)

# Corrosion is a tool for integrating Rust into an existing CMake project
FetchContent_Declare(Corrosion
URL https://github.com/corrosion-rs/corrosion/archive/refs/tags/v0.6.1.tar.gz
URL_HASH SHA256=e9e95b1ee2bad52681f347993fb1a5af5cce458c5ce8a2636c9e476e4babf8e3
SYSTEM)

FetchContent_MakeAvailable(Corrosion)

corrosion_import_crate(MANIFEST_PATH ${CMAKE_CURRENT_SOURCE_DIR}/Cargo.toml)

include(CTest)

add_test(
NAME cargo_tests
COMMAND cargo test
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
9 changes: 9 additions & 0 deletions minifi_rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[workspace]
resolver = "3"
members = ["minifi_native_sys", "minifi_native", "minifi_native_macros", "minifi_rs_behave", "extensions/*"]

[profile.release]
panic = "abort"

[profile.dev]
panic = "abort"
Loading
Loading