Skip to content

Commit

Permalink
CI Automation - Test 1
Browse files Browse the repository at this point in the history
  • Loading branch information
kianwasabi committed Nov 12, 2023
1 parent 1b8c2aa commit e980c1e
Show file tree
Hide file tree
Showing 29 changed files with 73 additions and 30 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/codegenerator.yaml
Original file line number Diff line number Diff line change
@@ -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
File renamed without changes.
31 changes: 18 additions & 13 deletions car_control/CMakeLists.txt → CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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
Expand All @@ -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
Expand Down
File renamed without changes.
File renamed without changes.
15 changes: 0 additions & 15 deletions car_control/CommonapiGenerator.sh

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ define org.genivi.commonapi.someip.deployment for provider as Service {
SomeIpReliableUnicastPort = 40010
SomeIpUnreliableUnicastPort = 40011
}
}
}
2 changes: 1 addition & 1 deletion car_control/fidl/carcontrol.fidl → fidl/carcontrol.fidl
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ interface CarControl {
Boolean accepted
}
}
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit e980c1e

Please sign in to comment.