From e980c1edd459f0e55311f44d1a6f3c6a3132b3a6 Mon Sep 17 00:00:00 2001 From: kianwasabi Date: Sun, 12 Nov 2023 20:15:56 +0000 Subject: [PATCH] CI Automation - Test 1 --- .github/workflows/codegenerator.yaml | 53 +++++++++++++++++++ car_control/Build.sh => Build.sh | 0 car_control/CMakeLists.txt => CMakeLists.txt | 31 ++++++----- car_control/Run_Client.sh => Run_Client.sh | 0 car_control/Run_Service.sh => Run_Service.sh | 0 .../core/v0/commonapi/CarControl.hpp | 0 .../core/v0/commonapi/CarControlProxy.hpp | 0 .../core/v0/commonapi/CarControlProxyBase.hpp | 0 .../core/v0/commonapi/CarControlStub.hpp | 0 .../v0/commonapi/CarControlStubDefault.hpp | 0 .../commonapi/CarControlSomeIPDeployment.cpp | 0 .../commonapi/CarControlSomeIPDeployment.hpp | 0 .../v0/commonapi/CarControlSomeIPProxy.cpp | 0 .../v0/commonapi/CarControlSomeIPProxy.hpp | 0 .../commonapi/CarControlSomeIPStubAdapter.cpp | 0 .../commonapi/CarControlSomeIPStubAdapter.hpp | 0 car_control/CommonapiGenerator.sh | 15 ------ {car_control/fidl => fidl}/carcontrol.fdepl | 2 +- {car_control/fidl => fidl}/carcontrol.fidl | 2 +- .../CarControlStubImpl.hpp | 0 {car_control/include => include}/GamePad.hpp | 0 {car_control/include => include}/PiRacer.hpp | 0 {car_control/piracer => piracer}/gamepads.py | 0 {car_control/piracer => piracer}/vehicles.py | 0 {car_control/src => src}/CarControlClient.cpp | 0 .../src => src}/CarControlService.cpp | 0 .../src => src}/CarControlStubImpl.cpp | 0 {car_control/src => src}/GamePad.cpp | 0 {car_control/src => src}/PiRacer.cpp | 0 29 files changed, 73 insertions(+), 30 deletions(-) create mode 100644 .github/workflows/codegenerator.yaml rename car_control/Build.sh => Build.sh (100%) rename car_control/CMakeLists.txt => CMakeLists.txt (55%) rename car_control/Run_Client.sh => Run_Client.sh (100%) rename car_control/Run_Service.sh => Run_Service.sh (100%) rename {car_control/src-gen-carcontrol => _src-gen-carcontrol}/core/v0/commonapi/CarControl.hpp (100%) rename {car_control/src-gen-carcontrol => _src-gen-carcontrol}/core/v0/commonapi/CarControlProxy.hpp (100%) rename {car_control/src-gen-carcontrol => _src-gen-carcontrol}/core/v0/commonapi/CarControlProxyBase.hpp (100%) rename {car_control/src-gen-carcontrol => _src-gen-carcontrol}/core/v0/commonapi/CarControlStub.hpp (100%) rename {car_control/src-gen-carcontrol => _src-gen-carcontrol}/core/v0/commonapi/CarControlStubDefault.hpp (100%) rename {car_control/src-gen-carcontrol => _src-gen-carcontrol}/someip/v0/commonapi/CarControlSomeIPDeployment.cpp (100%) rename {car_control/src-gen-carcontrol => _src-gen-carcontrol}/someip/v0/commonapi/CarControlSomeIPDeployment.hpp (100%) rename {car_control/src-gen-carcontrol => _src-gen-carcontrol}/someip/v0/commonapi/CarControlSomeIPProxy.cpp (100%) rename {car_control/src-gen-carcontrol => _src-gen-carcontrol}/someip/v0/commonapi/CarControlSomeIPProxy.hpp (100%) rename {car_control/src-gen-carcontrol => _src-gen-carcontrol}/someip/v0/commonapi/CarControlSomeIPStubAdapter.cpp (100%) rename {car_control/src-gen-carcontrol => _src-gen-carcontrol}/someip/v0/commonapi/CarControlSomeIPStubAdapter.hpp (100%) delete mode 100755 car_control/CommonapiGenerator.sh rename {car_control/fidl => fidl}/carcontrol.fdepl (99%) rename {car_control/fidl => fidl}/carcontrol.fidl (99%) rename {car_control/include => include}/CarControlStubImpl.hpp (100%) rename {car_control/include => include}/GamePad.hpp (100%) rename {car_control/include => include}/PiRacer.hpp (100%) rename {car_control/piracer => piracer}/gamepads.py (100%) rename {car_control/piracer => piracer}/vehicles.py (100%) rename {car_control/src => src}/CarControlClient.cpp (100%) rename {car_control/src => src}/CarControlService.cpp (100%) rename {car_control/src => src}/CarControlStubImpl.cpp (100%) rename {car_control/src => src}/GamePad.cpp (100%) rename {car_control/src => src}/PiRacer.cpp (100%) diff --git a/.github/workflows/codegenerator.yaml b/.github/workflows/codegenerator.yaml new file mode 100644 index 0000000..e9734b2 --- /dev/null +++ b/.github/workflows/codegenerator.yaml @@ -0,0 +1,53 @@ +# This workflow generates CommonAPI code from fidl and fdepl files using the CommonAPI Core and vSOME/IP Generators. +# The workflow is triggered on push events to the "main" branch and when changes are made to fidl and fdepl files. +# The generated code is saved in the src-gen folder and committed and pushed to the repository. +# The workflow contains a single job called "commonapi-code-generator" that runs on ubuntu-latest. +# The job has six steps that checkout the repository, delete old generated code, download the generators, generate CommonAPI code, and save the generated code. +name: CI-CD CommonAPI Code Generator + +on: + push: + branches: [ "main" ] + paths: + - 'fidl/**.fidl' + - 'fidl/**.fdepl' + workflow_dispatch: + +jobs: + commonapi-code-generator: + runs-on: ubuntu-latest + steps: + - name: 0) Checkout the repository, to have the most recent fidl files. + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: 1) Delete old generated code, if exists. And create new folders. + run: | + rm -rf ${{ github.workspace }}/src-gen + mkdir -p ${{ github.workspace }}/src-gen/core + mkdir -p ${{ github.workspace }}/src-gen/someip + + - name: 2) Download CommonAPI Core Generator. + run: | + wget https://github.com/COVESA/capicxx-core-tools/releases/download/3.2.0.1/commonapi_core_generator.zip + unzip commonapi_core_generator.zip -d ${{ github.workspace }}/core-generator + + - name: 4) Generate CommonAPI Code from Core Generator. + run: | + echo $(find ${{ github.workspace }} -type f -name '*.fidl') + core-generator/commonapi-core-generator-linux-x86_64 -sk $(find ${{ github.workspace }} -type f -name '*.fidl') -d ${{ github.workspace }}/src-gen/core + + - name: 5) Generate CommonAPI Code with the vSOME/IP Generator. + run: | + echo $(find ${{ github.workspace }} -type f -name '*.fdepl') + someip-generator/commonapi-someip-generator-linux-x86_64 $(find ${{ github.workspace }} -type f -name '*.fdepl') -d ${{ github.workspace }}/src-gen/someip + + - name: 6) Save generated code in src-gen (Commit and Push) + if: github.event_name == 'push' + run: | + git config user.name "$(git log -n 1 --pretty=format:%an)" + git config user.email "$(git log -n 1 --pretty=format:%ae)" + git add src-gen + git commit -m "Auto Generated fidl" || true + git push \ No newline at end of file diff --git a/car_control/Build.sh b/Build.sh similarity index 100% rename from car_control/Build.sh rename to Build.sh diff --git a/car_control/CMakeLists.txt b/CMakeLists.txt similarity index 55% rename from car_control/CMakeLists.txt rename to CMakeLists.txt index ff24ace..e91bb3e 100644 --- a/car_control/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,14 +13,16 @@ find_package(CommonAPI REQUIRED) find_package(CommonAPI-SomeIP REQUIRED) ### VARIABLES ### -set(PRJ_SRC_GEN_PATH ${CMAKE_CURRENT_SOURCE_DIR}/src-gen-carcontrol) +# set(PRJ_SRC_GEN_PATH ${CMAKE_CURRENT_SOURCE_DIR}/src-gen-carcontrol) +set(PRJ_SRC_VAR src) +set(PRJ_SRC_GEN_VAR src-gen) +set(PRJ_SRC_GEN_PATH ${CMAKE_CURRENT_SOURCE_DIR}/${PRJ_SRC_GEN_VAR}) set(CORE_GEN_SRC_DIR ${PRJ_SRC_GEN_PATH}/core) set(SOMEIP_GEN_SRC_DIR ${PRJ_SRC_GEN_PATH}/someip) set(CORE_RUNTIME_DIR ~/capicxx-core-runtime) set(SOMEIP_RUNTIME_DIR ~/capicxx-someip-runtime) set(VSOMEIP_DIR ~/vsomeip) -set(PRJ_SRC_PATH src) -set(PRJ_SRC_GEN_PATH src-gen) +set(COMMONAPI_INTERFACE_VER v0/commonapi) ### DIRECTORIES ### include_directories( @@ -38,17 +40,18 @@ link_directories( ${CORE_RUNTIME_DIR}/build ${VSOMEIP_DIR}/build ) -### FILES ### ### BUILD ### # Services add_executable(CarControlService - src/GamePad.cpp - src/PiRacer.cpp - src/CarControlService.cpp - src/CarControlStubImpl.cpp - src-gen-carcontrol/someip/v0/commonapi/CarControlSomeIPStubAdapter.cpp - src-gen-carcontrol/someip/v0/commonapi/CarControlSomeIPDeployment.cpp + ${PRJ_SRC_VAR}/GamePad.cpp + ${PRJ_SRC_VAR}/PiRacer.cpp + ${PRJ_SRC_VAR}/CarControlService.cpp + ${PRJ_SRC_VAR}/CarControlStubImpl.cpp + # src-gen-carcontrol/someip/v0/commonapi/CarControlSomeIPStubAdapter.cpp + # src-gen-carcontrol/someip/v0/commonapi/CarControlSomeIPDeployment.cpp + ${SOMEIP_GEN_SRC_DIR}/${COMMONAPI_INTERFACE_VER}/CarControlSomeIPStubAdapter.cpp + ${SOMEIP_GEN_SRC_DIR}/${COMMONAPI_INTERFACE_VER}/CarControlSomeIPDeployment.cpp ) target_link_libraries(CarControlService CommonAPI @@ -59,9 +62,11 @@ target_link_libraries(CarControlService ) # Client add_executable(CarControlClient - src/CarControlClient.cpp - src-gen-carcontrol/someip/v0/commonapi/CarControlSomeIPProxy.cpp - src-gen-carcontrol/someip/v0/commonapi/CarControlSomeIPDeployment.cpp + ${PRJ_SRC_VAR}/CarControlClient.cpp + # src-gen-carcontrol/someip/v0/commonapi/CarControlSomeIPProxy.cpp + # src-gen-carcontrol/someip/v0/commonapi/CarControlSomeIPDeployment.cpp + ${SOMEIP_GEN_SRC_DIR}/${COMMONAPI_INTERFACE_VER}/CarControlSomeIPProxy.cpp + ${SOMEIP_GEN_SRC_DIR}/${COMMONAPI_INTERFACE_VER}/CarControlSomeIPDeployment.cpp ) target_link_libraries(CarControlClient CommonAPI diff --git a/car_control/Run_Client.sh b/Run_Client.sh similarity index 100% rename from car_control/Run_Client.sh rename to Run_Client.sh diff --git a/car_control/Run_Service.sh b/Run_Service.sh similarity index 100% rename from car_control/Run_Service.sh rename to Run_Service.sh diff --git a/car_control/src-gen-carcontrol/core/v0/commonapi/CarControl.hpp b/_src-gen-carcontrol/core/v0/commonapi/CarControl.hpp similarity index 100% rename from car_control/src-gen-carcontrol/core/v0/commonapi/CarControl.hpp rename to _src-gen-carcontrol/core/v0/commonapi/CarControl.hpp diff --git a/car_control/src-gen-carcontrol/core/v0/commonapi/CarControlProxy.hpp b/_src-gen-carcontrol/core/v0/commonapi/CarControlProxy.hpp similarity index 100% rename from car_control/src-gen-carcontrol/core/v0/commonapi/CarControlProxy.hpp rename to _src-gen-carcontrol/core/v0/commonapi/CarControlProxy.hpp diff --git a/car_control/src-gen-carcontrol/core/v0/commonapi/CarControlProxyBase.hpp b/_src-gen-carcontrol/core/v0/commonapi/CarControlProxyBase.hpp similarity index 100% rename from car_control/src-gen-carcontrol/core/v0/commonapi/CarControlProxyBase.hpp rename to _src-gen-carcontrol/core/v0/commonapi/CarControlProxyBase.hpp diff --git a/car_control/src-gen-carcontrol/core/v0/commonapi/CarControlStub.hpp b/_src-gen-carcontrol/core/v0/commonapi/CarControlStub.hpp similarity index 100% rename from car_control/src-gen-carcontrol/core/v0/commonapi/CarControlStub.hpp rename to _src-gen-carcontrol/core/v0/commonapi/CarControlStub.hpp diff --git a/car_control/src-gen-carcontrol/core/v0/commonapi/CarControlStubDefault.hpp b/_src-gen-carcontrol/core/v0/commonapi/CarControlStubDefault.hpp similarity index 100% rename from car_control/src-gen-carcontrol/core/v0/commonapi/CarControlStubDefault.hpp rename to _src-gen-carcontrol/core/v0/commonapi/CarControlStubDefault.hpp diff --git a/car_control/src-gen-carcontrol/someip/v0/commonapi/CarControlSomeIPDeployment.cpp b/_src-gen-carcontrol/someip/v0/commonapi/CarControlSomeIPDeployment.cpp similarity index 100% rename from car_control/src-gen-carcontrol/someip/v0/commonapi/CarControlSomeIPDeployment.cpp rename to _src-gen-carcontrol/someip/v0/commonapi/CarControlSomeIPDeployment.cpp diff --git a/car_control/src-gen-carcontrol/someip/v0/commonapi/CarControlSomeIPDeployment.hpp b/_src-gen-carcontrol/someip/v0/commonapi/CarControlSomeIPDeployment.hpp similarity index 100% rename from car_control/src-gen-carcontrol/someip/v0/commonapi/CarControlSomeIPDeployment.hpp rename to _src-gen-carcontrol/someip/v0/commonapi/CarControlSomeIPDeployment.hpp diff --git a/car_control/src-gen-carcontrol/someip/v0/commonapi/CarControlSomeIPProxy.cpp b/_src-gen-carcontrol/someip/v0/commonapi/CarControlSomeIPProxy.cpp similarity index 100% rename from car_control/src-gen-carcontrol/someip/v0/commonapi/CarControlSomeIPProxy.cpp rename to _src-gen-carcontrol/someip/v0/commonapi/CarControlSomeIPProxy.cpp diff --git a/car_control/src-gen-carcontrol/someip/v0/commonapi/CarControlSomeIPProxy.hpp b/_src-gen-carcontrol/someip/v0/commonapi/CarControlSomeIPProxy.hpp similarity index 100% rename from car_control/src-gen-carcontrol/someip/v0/commonapi/CarControlSomeIPProxy.hpp rename to _src-gen-carcontrol/someip/v0/commonapi/CarControlSomeIPProxy.hpp diff --git a/car_control/src-gen-carcontrol/someip/v0/commonapi/CarControlSomeIPStubAdapter.cpp b/_src-gen-carcontrol/someip/v0/commonapi/CarControlSomeIPStubAdapter.cpp similarity index 100% rename from car_control/src-gen-carcontrol/someip/v0/commonapi/CarControlSomeIPStubAdapter.cpp rename to _src-gen-carcontrol/someip/v0/commonapi/CarControlSomeIPStubAdapter.cpp diff --git a/car_control/src-gen-carcontrol/someip/v0/commonapi/CarControlSomeIPStubAdapter.hpp b/_src-gen-carcontrol/someip/v0/commonapi/CarControlSomeIPStubAdapter.hpp similarity index 100% rename from car_control/src-gen-carcontrol/someip/v0/commonapi/CarControlSomeIPStubAdapter.hpp rename to _src-gen-carcontrol/someip/v0/commonapi/CarControlSomeIPStubAdapter.hpp diff --git a/car_control/CommonapiGenerator.sh b/car_control/CommonapiGenerator.sh deleted file mode 100755 index 50058d0..0000000 --- a/car_control/CommonapiGenerator.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash -################## vsomeip generator ################## -#delete "src-gen-carcontrol" folder if it exists -if [ -d "src-gen-carcontrol" ]; then - rm -rf src-gen-carcontrol -fi -#run generator -/home/seame02/generator/core-generator/commonapi-core-generator-linux-x86_64 -sk ./fidl/carcontrol.fidl -d ./src-gen-carcontrol/core -/home/seame02/generator/someip-generator/commonapi-someip-generator-linux-x86_64 ./fidl/carcontrol.fdepl -d ./src-gen-carcontrol/someip - -################## NOTE ################## -# This needs to be run before running Build.sh -# Unfornauteley, the generator does not run on the target system (Raspberry Pi). -# Therefore, the teams laptop is used. -# Paths on Genenrator needs to be modified regarding the used machine. \ No newline at end of file diff --git a/car_control/fidl/carcontrol.fdepl b/fidl/carcontrol.fdepl similarity index 99% rename from car_control/fidl/carcontrol.fdepl rename to fidl/carcontrol.fdepl index dd04f10..21f04a6 100644 --- a/car_control/fidl/carcontrol.fdepl +++ b/fidl/carcontrol.fdepl @@ -42,4 +42,4 @@ define org.genivi.commonapi.someip.deployment for provider as Service { SomeIpReliableUnicastPort = 40010 SomeIpUnreliableUnicastPort = 40011 } -} \ No newline at end of file +} diff --git a/car_control/fidl/carcontrol.fidl b/fidl/carcontrol.fidl similarity index 99% rename from car_control/fidl/carcontrol.fidl rename to fidl/carcontrol.fidl index 41cfc18..bf64a6f 100644 --- a/car_control/fidl/carcontrol.fidl +++ b/fidl/carcontrol.fidl @@ -14,4 +14,4 @@ interface CarControl { Boolean accepted } } -} \ No newline at end of file +} diff --git a/car_control/include/CarControlStubImpl.hpp b/include/CarControlStubImpl.hpp similarity index 100% rename from car_control/include/CarControlStubImpl.hpp rename to include/CarControlStubImpl.hpp diff --git a/car_control/include/GamePad.hpp b/include/GamePad.hpp similarity index 100% rename from car_control/include/GamePad.hpp rename to include/GamePad.hpp diff --git a/car_control/include/PiRacer.hpp b/include/PiRacer.hpp similarity index 100% rename from car_control/include/PiRacer.hpp rename to include/PiRacer.hpp diff --git a/car_control/piracer/gamepads.py b/piracer/gamepads.py similarity index 100% rename from car_control/piracer/gamepads.py rename to piracer/gamepads.py diff --git a/car_control/piracer/vehicles.py b/piracer/vehicles.py similarity index 100% rename from car_control/piracer/vehicles.py rename to piracer/vehicles.py diff --git a/car_control/src/CarControlClient.cpp b/src/CarControlClient.cpp similarity index 100% rename from car_control/src/CarControlClient.cpp rename to src/CarControlClient.cpp diff --git a/car_control/src/CarControlService.cpp b/src/CarControlService.cpp similarity index 100% rename from car_control/src/CarControlService.cpp rename to src/CarControlService.cpp diff --git a/car_control/src/CarControlStubImpl.cpp b/src/CarControlStubImpl.cpp similarity index 100% rename from car_control/src/CarControlStubImpl.cpp rename to src/CarControlStubImpl.cpp diff --git a/car_control/src/GamePad.cpp b/src/GamePad.cpp similarity index 100% rename from car_control/src/GamePad.cpp rename to src/GamePad.cpp diff --git a/car_control/src/PiRacer.cpp b/src/PiRacer.cpp similarity index 100% rename from car_control/src/PiRacer.cpp rename to src/PiRacer.cpp