Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
SeungWoo-L committed Mar 12, 2024
0 parents commit 885eb20
Show file tree
Hide file tree
Showing 3 changed files with 165 additions and 0 deletions.
116 changes: 116 additions & 0 deletions .github/workflows/codegenerator.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
# 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@v3
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.14/commonapi_core_generator.zip
unzip commonapi_core_generator.zip -d ${{ github.workspace }}/core-generator
- name: 3) Download CommonAPI vSOME/IP Generator.
run: |
wget https://github.com/COVESA/capicxx-someip-tools/releases/download/3.2.14/commonapi_someip_generator.zip
unzip commonapi_someip_generator.zip -d ${{ github.workspace }}/someip-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
# 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@v3
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.14/commonapi_core_generator.zip
unzip commonapi_core_generator.zip -d ${{ github.workspace }}/core-generator
- name: 3) Download CommonAPI vSOME/IP Generator.
run: |
wget https://github.com/COVESA/capicxx-someip-tools/releases/download/3.2.14/commonapi_someip_generator.zip
unzip commonapi_someip_generator.zip -d ${{ github.workspace }}/someip-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
34 changes: 34 additions & 0 deletions fidl/CanReceiver.fdepl
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import "platform:/plugin/org.genivi.commonapi.someip/deployment/CommonAPI-4-SOMEIP_deployment_spec.fdepl"
import "CanReceiver.fidl"

define org.genivi.commonapi.someip.deployment for interface commonapi.CanReceiver {
SomeIpServiceID = 3000
attribute distances {
SomeIpNotifierEventGroups = { 3100 }
SomeIpNotifierID = 31000
SomeIpGetterID = 3101
SomeIpAttributeReliable = true
}
attribute speed {
SomeIpNotifierEventGroups = { 3200 }
SomeIpNotifierID = 32000
SomeIpGetterID = 3201
SomeIpAttributeReliable = true
}
attribute rpm {
SomeIpNotifierEventGroups = { 3300 }
SomeIpNotifierID = 33000
SomeIpGetterID = 3301
SomeIpAttributeReliable = true
}
}

define org.genivi.commonapi.someip.deployment for provider as Service {
instance commonapi.CanReceiver {
InstanceId = "commonapi.CanReceiver"
SomeIpInstanceID = 3001
SomeIpUnicastAddress = "192.168.0.2"
SomeIpReliableUnicastPort = 30010
SomeIpUnreliableUnicastPort = 30011
}
}
15 changes: 15 additions & 0 deletions fidl/CanReceiver.fidl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package commonapi

interface CanReceiver {
version { major 0 minor 1 }

attribute SonarArrayStruct distances readonly
attribute UInt32 speed readonly
attribute UInt32 rpm readonly

struct SonarArrayStruct {
UInt32 sensorfrontleft
UInt32 sensorfrontmiddle
UInt32 sensorfrontright
}
}

0 comments on commit 885eb20

Please sign in to comment.