Skip to content
Open
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
83 changes: 83 additions & 0 deletions .ci/build-kit/docker/Dockerfile
Copy link
Member

Choose a reason for hiding this comment

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

Would be good to move most of it in the ghcr.io/everest/everest-ci/build-env-base image before merging,
Which means opening a PR in everest-ci, merge it, tag a new version/release, use this tag in the ci workflow

Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,86 @@

# FIXME(kai): Install libsystemd-dev as a dependency of sdbus-c++
RUN apt-get update && apt-get -y install libsystemd-dev
ADD "https://www.random.org/cgi-bin/randbyte?nbytes=10&format=h" skipcache
ENV EVEREST_CMAKE_PATH=/usr/lib/cmake/everest-cmake
ENV EVEREST_CMAKE_VERSION=tmp/eebus
RUN rm -rf ${EVEREST_CMAKE_PATH} \

Check warning on line 19 in .ci/build-kit/docker/Dockerfile

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

.ci/build-kit/docker/Dockerfile#L19

Use WORKDIR to switch to a directory
&& git clone https://github.com/EVerest/everest-cmake.git ${EVEREST_CMAKE_PATH} \
&& cd ${EVEREST_CMAKE_PATH} \
&& git checkout ${EVEREST_CMAKE_VERSION} \
&& rm -r .git

ARG GO_VERSION=1.24.2
ADD https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz /tmp/go.tar.gz
RUN if [ -d /usr/local/go ]; then \
echo "Go is already installed"; \
else \
tar -C /usr/local -xzf /tmp/go.tar.gz; \
fi
ENV PATH="/usr/local/go/bin:${PATH}"
RUN go version

ENV GRPC_VERSION=v1.71.0
ENV GRPC_EXTENDED_CPP_PLUGIN_VERSION=main
RUN tmpdir=$(mktemp -d) \

Check warning on line 37 in .ci/build-kit/docker/Dockerfile

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

.ci/build-kit/docker/Dockerfile#L37

Double quote to prevent globbing and word splitting.

Check warning on line 37 in .ci/build-kit/docker/Dockerfile

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

.ci/build-kit/docker/Dockerfile#L37

Use WORKDIR to switch to a directory
&& cd $tmpdir \
&& git clone --depth 1 --recurse-submodules --shallow-submodules --branch ${GRPC_VERSION} https://github.com/grpc/grpc.git \
&& git clone --branch ${GRPC_EXTENDED_CPP_PLUGIN_VERSION} https://github.com/EVerest/grpc-extended-cpp-plugin.git \
&& cmake -B build -S grpc-extended-cpp-plugin -G Ninja -D gRPC_INSTALL=ON \
&& cmake --build build \
&& cmake --install build \
&& rm -rf $tmpdir

RUN apt update \
&& apt install -y \
build-essential \
zlib1g-dev \
libncurses5-dev \
libgdbm-dev \
libnss3-dev \
libssl-dev \
libreadline-dev \
libffi-dev \
libsqlite3-dev \
wget
ENV PYTHON_VERSION=3.13.3
ENV PYTHON_SOURCE_URL=https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tgz
RUN tmpdir=$(mktemp -d) \
&& cd $tmpdir \
&& wget ${PYTHON_SOURCE_URL} \
&& tar -xzvf Python-${PYTHON_VERSION}.tgz \
&& cd Python-${PYTHON_VERSION} \
&& ./configure --enable-optimizations \
&& make -j $(nproc) \
&& make install \
&& short_version=$(echo ${PYTHON_VERSION} | cut -d. -f1-2) \
&& rm /usr/local/bin/python3 \
&& ln -s /usr/local/bin/python${short_version} /usr/local/bin/python3

RUN python3.13 -m pip install --break-system-packages \

Check warning on line 72 in .ci/build-kit/docker/Dockerfile

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

.ci/build-kit/docker/Dockerfile#L72

Pin versions in pip. Instead of `pip install <package>` use `pip install <package>==<version>` or `pip install --requirement <requirements file>`
grpcio \
grpcio-tools \
pydantic \
cryptography \
netifaces \
psutil \
environs \
py4j \
aiofile \
build \
sphinx \
gcovr \
sphinxcontrib-contentui \
sphinxcontrib-svg2pdfconverter \
git+https://github.com/EVerest/[email protected]#subdirectory=dependency_manager


# Can be used to use an other version of everest-cmake
ADD "https://www.random.org/cgi-bin/randbyte?nbytes=10&format=h" skipcache
ENV EVEREST_CMAKE_PATH=/usr/lib/cmake/everest-cmake
ENV EVEREST_CMAKE_VERSION=tmp/eebus
RUN rm -rf ${EVEREST_CMAKE_PATH} \
&& git clone https://github.com/EVerest/everest-cmake.git ${EVEREST_CMAKE_PATH} \
&& cd ${EVEREST_CMAKE_PATH} \
&& git checkout ${EVEREST_CMAKE_VERSION} \
&& rm -r .git
Comment on lines +90 to +98
Copy link
Member

Choose a reason for hiding this comment

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

this is duplicated

5 changes: 4 additions & 1 deletion .ci/build-kit/scripts/compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ cmake \
-DCMAKE_INSTALL_PREFIX="$EXT_MOUNT/dist" \
-DWHEEL_INSTALL_PREFIX="$EXT_MOUNT/wheels" \
-DBUILD_TESTING=ON \
-DEVEREST_ENABLE_COMPILE_WARNINGS=ON
-DEVEREST_ENABLE_COMPILE_WARNINGS=ON \
-DENABLE_GRPC_GENERATOR=ON \
-DGRPC_EDM=OFF \
-DGRPC_GENERATOR_EDM=OFF
retVal=$?
if [ $retVal -ne 0 ]; then
echo "Configuring failed with return code $retVal"
Expand Down
2 changes: 1 addition & 1 deletion .ci/build-kit/scripts/create_integration_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ if [ $retVal -ne 0 ]; then
exit $retVal
fi

pip install --break-system-packages \
python3 -m pip install --break-system-packages \
$EXT_MOUNT/wheels/everestpy-*.whl \
$EXT_MOUNT/wheels/everest_testing-*.whl \
pytest-html
Expand Down
4 changes: 2 additions & 2 deletions .ci/build-kit/scripts/create_ocpp_tests_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ if [ $retVal -ne 0 ]; then
exit $retVal
fi

pip install --break-system-packages \
python3 -m pip install --break-system-packages \
Copy link
Member

Choose a reason for hiding this comment

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

Could be in a dedicated PR "Improce CI scripts" or so, but not required from my side

"$EXT_MOUNT"/wheels/everestpy-*.whl \
"$EXT_MOUNT"/wheels/everest_testing-*.whl \
"$EXT_MOUNT"/wheels/iso15118-*.whl \
Expand All @@ -20,6 +20,6 @@ if [ $retVal -ne 0 ]; then
exit $retVal
fi

pip install --break-system-packages -r tests/ocpp_tests/requirements.txt
python3 -m pip install --break-system-packages -r tests/ocpp_tests/requirements.txt
Copy link
Member

Choose a reason for hiding this comment

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

Could be in a dedicated PR "Improce CI scripts" or so, but not required from my side


$(cd ./tests/ocpp_tests/test_sets/everest-aux/ && ./install_certs.sh "$EXT_MOUNT/dist" && ./install_configs.sh "$EXT_MOUNT/dist")
3 changes: 2 additions & 1 deletion .ci/e2e/scripts/run_integration_tests.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
#!/bin/sh

cd tests
pytest \
python3 -m pytest \
Copy link
Member

Choose a reason for hiding this comment

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

Could be in a dedicated PR "Improce CI scripts" or so, but not required from my side

-rA \
--junitxml="$EXT_MOUNT/result.xml" \
--html="$EXT_MOUNT/report.html" \
--self-contained-html \
core_tests/*.py \
framework_tests/*.py \
eebus_tests/*.py \
--everest-prefix "$EXT_MOUNT/dist"
retVal=$?

Expand Down
2 changes: 1 addition & 1 deletion .ci/e2e/scripts/run_ocpp_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ PARALLEL_TESTS=$(nproc)

echo "Running $PARALLEL_TESTS ocpp tests in parallel"

pytest \
python3 -m pytest \
Copy link
Member

Choose a reason for hiding this comment

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

Could be in a dedicated PR "Improce CI scripts" or so, but not required from my side

-rA \
-n "$PARALLEL_TESTS" \
--dist=loadgroup \
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/build_and_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ on:
jobs:
ci:
name: Build, Lint and Test
uses: everest/everest-ci/.github/workflows/continuous_integration.yml@v1.4.6
uses: everest/everest-ci/.github/workflows/continuous_integration.yml@feature/eebus
Copy link
Member

Choose a reason for hiding this comment

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

This should be updated to a proper tag before merging

permissions:
contents: read
secrets:
Expand All @@ -30,6 +30,7 @@ jobs:
do_not_run_coverage_badge_creation: true
run_install_wheels: true
run_integration_tests: true
build_kit_base_image_tag: feature-eebus
Copy link
Member

Choose a reason for hiding this comment

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

This should be updated to a proper tag before merging

ocpp-tests:
name: OCPP Tests
needs:
Expand Down
11 changes: 8 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ project(everest-core
LANGUAGES CXX C
)

find_package(everest-cmake 0.5
find_package(everest-cmake 0.6
COMPONENTS bundling
PATHS ../everest-cmake
NO_DEFAULT_PATH
)
find_package(everest-cmake 0.5
find_package(everest-cmake 0.6
COMPONENTS bundling
)

Expand All @@ -21,7 +21,7 @@ if (NOT everest-cmake_FOUND)
FetchContent_Declare(
everest-cmake
GIT_REPOSITORY https://github.com/EVerest/everest-cmake.git
GIT_TAG main
GIT_TAG v0.6.0
Copy link
Member

Choose a reason for hiding this comment

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

should be main, since this is a feature for convenience "auto downloading latest everest-cmake"

)
FetchContent_MakeAvailable(everest-cmake)
set(everest-cmake_DIR "${everest-cmake_SOURCE_DIR}")
Expand Down Expand Up @@ -65,6 +65,7 @@ option(CREATE_SYMLINKS "Create symlinks to javascript modules and auxillary file
option(CMAKE_RUN_CLANG_TIDY "Run clang-tidy" OFF)
option(EVEREST_BUILD_API_DOCS "Build EVerest API documentation" OFF)
option(ISO15118_2_GENERATE_AND_INSTALL_CERTIFICATES "Automatically generate and install certificates for development purposes" ON)
option(EEBUS_GENERATE_AND_INSTALL_CERTIFICATES "Automatically generate and install certificates for development purposes" ON)
option(EVEREST_ENABLE_RUN_SCRIPT_GENERATION "Enables the generation of run scripts (convenience scripts for starting available configurations)" ON)
option(${PROJECT_NAME}_BUILD_TESTING "Build unit tests, used if included as dependency" OFF)
option(BUILD_TESTING "Build unit tests, used if standalone project" OFF)
Expand Down Expand Up @@ -124,6 +125,10 @@ if(NOT DISABLE_EDM)
# FIXME (aw): this implicit definition for child projects is hacky
set(THIRD_PARTY_APP_DST "${CMAKE_INSTALL_LIBEXECDIR}/everest/3rd_party")

if(GRPC_EDM)
enable_language(ASM)
endif()

evc_setup_edm()

# FIXME (aw): we need to set this by hand due to edm
Expand Down
132 changes: 132 additions & 0 deletions cmake/external/eebus-grpc.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
include_guard(GLOBAL)

if (NOT CPM_PACKAGE_eebus-grpc_SOURCE_DIR)
message(FATAL_ERROR "CPM_PACKAGE_eebus-grpc_SOURCE_DIR not set")
endif()

set(EEBUS_GRPC_API_SOURCE_DIR ${CPM_PACKAGE_eebus-grpc_SOURCE_DIR})
set(EEBUS_GRPC_API_BINARY_DIR ${CMAKE_BINARY_DIR}/eebus-grpc)

file(GLOB_RECURSE EEBUS_GRPC_API_SOURCE_FILES
CONFIGURE_DEPENDS
${EEBUS_GRPC_API_SOURCE_DIR}/*
)

setup_go()
add_go_target(
NAME
eebus_grpc_api_cmd
OUTPUT
${EEBUS_GRPC_API_BINARY_DIR}/cmd
GO_PACKAGE_SOURCE_PATH
${EEBUS_GRPC_API_SOURCE_DIR}/cmd
OUTPUT_DIRECTORY
${EEBUS_GRPC_API_BINARY_DIR}
WORKING_DIRECTORY
${EEBUS_GRPC_API_SOURCE_DIR}
DEPENDS
${EEBUS_GRPC_API_SOURCE_FILES}
)

add_go_target(
NAME
eebus_grpc_api_create_cert
OUTPUT
${EEBUS_GRPC_API_BINARY_DIR}/create_cert
GO_PACKAGE_SOURCE_PATH
${EEBUS_GRPC_API_SOURCE_DIR}/cmd/create_cert
OUTPUT_DIRECTORY
${EEBUS_GRPC_API_BINARY_DIR}
WORKING_DIRECTORY
${EEBUS_GRPC_API_SOURCE_DIR}
DEPENDS
${EEBUS_GRPC_API_SOURCE_FILES}
)

add_custom_target(eebus_grpc_api_all
DEPENDS
eebus_grpc_api_cmd
eebus_grpc_api_create_cert
)

install(
FILES
${EEBUS_GRPC_API_BINARY_DIR}/cmd
DESTINATION
${CMAKE_INSTALL_PREFIX}/bin
RENAME
eebus_grpc_api
PERMISSIONS
OWNER_EXECUTE OWNER_WRITE OWNER_READ
GROUP_EXECUTE GROUP_READ
WORLD_EXECUTE WORLD_READ
)

# This function creates certificates for an EEBus component
#
# It will generate thre files:
# - <OUT_DIR>/<NAME>_cert
# - <OUT_DIR>/<NAME>_key
# - <OUT_DIR>/<NAME>_ski
# The generation can be triggered by calling the target <TARGET_NAME>
#
function(eebus_create_cert)
set(options)
set(one_value_args
NAME
OUT_DIR
TARGET_NAME
OUT_FILES_VAR
)
set(multi_value_args)
cmake_parse_arguments(arg "${options}" "${one_value_args}" "${multi_value_args}" ${ARGN})

if (arg_UNPARSED_ARGUMENTS)
message(FATAL_ERROR "Unparsed arguments: ${arg_UNPARSED_ARGUMENTS}")
endif()
if (arg_KEYWORDS_MISSING_VALUES)
message(FATAL_ERROR "Keywords missing values: ${arg_KEYWORDS_MISSING_VALUES}")
endif()
if (NOT arg_NAME)
message(FATAL_ERROR "NAME not set")
endif()
if (NOT arg_OUT_DIR)
message(FATAL_ERROR "OUT_DIR not set")
endif()
if (NOT IS_ABSOLUTE ${arg_OUT_DIR})
message(FATAL_ERROR "OUT_DIR ${arg_OUT_DIR} is not an absolute path")
endif()
if (NOT arg_TARGET_NAME)
message(FATAL_ERROR "TARGET_NAME not set")
endif()

get_target_property(CREATE_CERT_BINARY_FILE eebus_grpc_api_create_cert TARGET_FILE)
set(OUT_FILES
${arg_OUT_DIR}/${arg_NAME}_cert
${arg_OUT_DIR}/${arg_NAME}_key
${arg_OUT_DIR}/${arg_NAME}_ski
)
add_custom_command(
OUTPUT
${OUT_FILES}
COMMAND
mkdir -p ${arg_OUT_DIR}
COMMAND
${CREATE_CERT_BINARY_FILE}
ARGS
${arg_OUT_DIR}
${arg_NAME}
DEPENDS
eebus_grpc_api_create_cert
COMMENT
"Creating ${arg_NAME} certificates"
)
add_custom_target(${arg_TARGET_NAME}
DEPENDS
${OUT_FILES}
)

if (arg_OUT_FILES_VAR)
set(${arg_OUT_FILES_VAR} ${OUT_FILES} PARENT_SCOPE)
endif()
endfunction()
2 changes: 1 addition & 1 deletion config/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ generate_config_run_script(CONFIG sil-ocpp-pnc)
generate_config_run_script(CONFIG sil-ocpp201-pnc)
generate_config_run_script(CONFIG example)
generate_config_run_script(CONFIG sil-dc-consumer-api)

generate_config_run_script(CONFIG eebus)

add_subdirectory(bringup)

Expand Down
Loading
Loading