Skip to content
Merged
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
47 changes: 47 additions & 0 deletions .github/workflows/release_lib.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
generate-dbc:
Expand Down Expand Up @@ -74,18 +77,33 @@ jobs:
name: htmlfile
path: ./docs/Release-${{github.run_number}}.html

- name: Upload proto artifact
uses: actions/upload-artifact@v4
with:
name: protofile
path: hytech.proto

generate-and-release:
needs: [generate-dbc, generate-proto]
runs-on: ubuntu-latest
container:
image: ghcr.io/rcmast3r/ccoderdbc:main
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Download dbc artifact
uses: actions/download-artifact@v4.1.8
with:
name: dbcfile
path: /dbc

- name: Download proto artifact
uses: actions/download-artifact@v4.1.8
with:
name: protofile
path: .

- name: generate code
run: |
mkdir -p /hytech_can_lib
Expand All @@ -95,6 +113,15 @@ jobs:
echo "{\n\"name\": \"can_lib\",\n\"version\": \"1.0.0\",\n\"build\": {\n\t\"flags\": [\n\t\t\"-Iinc\",\n\t\t\"-Ilib\",\n\t\t\"-Iconf\"\n\t]\n}\n}" >> /hytech_can_lib/library.json
tar -czvf /output/can_lib.tar.gz /hytech_can_lib

- name: generate drivebrain lib release
run: |
mkdir -p /hytech_drivebrain_lib/proto

mkdir -p /output
cp hytech.proto /hytech_drivebrain_lib/proto
cp CMakeLists.txt /hytech_drivebrain_lib
tar -czvf /output/drivebrain_can_lib.tar.gz /hytech_drivebrain_lib

- name: Create Release
id: create_release
uses: actions/create-release@v1.1.4
Expand Down Expand Up @@ -141,6 +168,16 @@ jobs:
asset_name: can_lib.tar.gz
asset_content_type: application/zip

- name: Upload drivebrain release asset
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: /output/drivebrain_can_lib.tar.gz
asset_name: drivebrain_can_lib.tar.gz
asset_content_type: application/zip

- name: Upload hytech.dbc
uses: actions/upload-release-asset@v1.0.2
env:
Expand All @@ -150,6 +187,16 @@ jobs:
asset_path: /dbc/hytech.dbc
asset_name: hytech.dbc
asset_content_type: text/plain

- name: Upload hytech.proto
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: hytech.proto
asset_name: hytech.proto
asset_content_type: text/plain

- name: Download html artifact
uses: actions/download-artifact@v4.1.8
Expand Down
35 changes: 35 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
set(PROTO_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/generated/)
set(LIBRARY hytech_can_msgs_cpp_lib)
set(OBJECT_LIBRARY hytech_can_msgs_cpp_lib_object)

find_package(Protobuf REQUIRED CONFIG)

file(MAKE_DIRECTORY ${PROTO_BINARY_DIR})

add_library(${OBJECT_LIBRARY} OBJECT
proto/hytech.proto
)

target_include_directories(${OBJECT_LIBRARY}
PUBLIC $<BUILD_INTERFACE:${PROTO_BINARY_DIR}>)

target_link_libraries(${OBJECT_LIBRARY}
PUBLIC protobuf::libprotobuf)

protobuf_generate(TARGET ${OBJECT_LIBRARY} IMPORT_DIRS proto
PROTOC_OUT_DIR "${PROTO_BINARY_DIR}")

add_library(${LIBRARY} $<TARGET_OBJECTS:${OBJECT_LIBRARY}>)

target_include_directories(
${LIBRARY} PUBLIC $<BUILD_INTERFACE:${PROTO_BINARY_DIR}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)

target_link_libraries(${LIBRARY} PUBLIC ${DEPS} protobuf::libprotobuf)

install(
DIRECTORY ${PROTO_BINARY_DIR}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
FILES_MATCHING
PATTERN "*.pb.h"
)
Loading