Skip to content

Commit

Permalink
Merge branch 'main' into feat/support_different_msg_type
Browse files Browse the repository at this point in the history
  • Loading branch information
3DRX committed Nov 29, 2024
2 parents 0d88041 + 7d11f06 commit f71b95d
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 35 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Go Tests with ROS2

on:
pull_request:
branches: [ main ]
push:
branches: [ main ]

jobs:
test:
runs-on: ubuntu-latest
container:
image: ros:humble

steps:
- uses: actions/checkout@v3

- name: Install dependencies
run: |
apt-get update
apt-get install -y libvpx-dev
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.23'

- name: Go Cache
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Source ROS
run: |
- name: Install Go dependencies
run: go mod download

- name: Run tests
shell: bash
run: |
source /opt/ros/humble/setup.bash
make test
12 changes: 8 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@ webrtc-ros-bridge-client: receiver/peer_connection_channel/libvp8decoder.so rclg
receiver/peer_connection_channel/libvp8decoder.so: receiver/peer_connection_channel/vp8_decoder.c receiver/peer_connection_channel/vp8_decoder.h
cd receiver/peer_connection_channel && gcc -shared -o libvp8decoder.so -fPIC vp8_decoder.c $(pkg-config --cflags --libs vpx) $(CFLAGS) $(LDFLAGS)

receiver/ros_channel/msgs cgo-flags.env: scripts/filter-root-path.sh
go run github.com/tiiuae/rclgo/cmd/rclgo-gen generate -d rclgo_gen --root-path=$(shell ./scripts/filter-root-path.sh)
receiver/ros_channel/msgs cgo-flags.env:
go run github.com/tiiuae/rclgo/cmd/rclgo-gen generate -d rclgo_gen

test: rclgo_gen cgo-flags.env
CGO_CFLAGS=$(CGO_CFLAGS) CGO_LDFLAGS=$(CGO_LDFLAGS) go test `go list ./... | grep -v "/rclgo_gen"`

.PHONY: clean
clean:
rm -rf wrb peer_connection_channel/libvp8decoder.so ros_channel/msgs cgo-flags.env
rm -rf wrb peer_connection_channel/libvp8decoder.so ros_channel/msgs cgo-flags.env rclgo_gen

.PHONY: test clean
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
# webrtc-ros-bridge

![Tests](https://github.com/3DRX/webrtc-ros-bridge/actions/workflows/test.yml/badge.svg)

## Prerequisites

- ROS2 humble, merge installed
(tested on debian 12 with ROS2 humble build from source
with command `colcon build --merge-install`)
- libvpx-dev (deb package)
- `go mod tidy` to get all go deps
- Note that it's expected to see errors of not finding package `github.com/3DRX/webrtc-ros-bridge/rclgo_gen`,
since it's part of the codegen using `github.com/tiiuae/rclgo`, you can just ignore it.

## Build

Expand Down
31 changes: 0 additions & 31 deletions scripts/filter-root-path.sh

This file was deleted.

0 comments on commit f71b95d

Please sign in to comment.