Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Speed up pipeline #56

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
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
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ jobs:
build:
needs: build_dev_container
uses: ./.github/workflows/ci_build.yml
build_release_image:
needs: build
uses: ./.github/workflows/ci_build_release_image.yml
unit_test:
needs: build_dev_container
uses: ./.github/workflows/ci_unit_test.yml
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/ci_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ jobs:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Cargo build
uses: devcontainers/[email protected]
with:
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/ci_build_release_image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: CI Build Release Image
'on':
workflow_call: null
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout (GitHub)
uses: actions/checkout@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Cargo build
uses: devcontainers/[email protected]
with:
cacheFrom: ghcr.io/vorausrobotik/voraus-ros-bridge-dev
runCmd: cargo ament-build --install-base install/voraus-ros-bridge -- --release
push: never
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/vorausrobotik/voraus-ros-bridge
- name: Build and push Docker image
id: push
uses: docker/build-push-action@v6
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
9 changes: 9 additions & 0 deletions .github/workflows/ci_format_code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,14 @@ jobs:
steps:
- name: Checkout (GitHub)
uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Verify Code is formatted
run: cargo fmt -- --check
9 changes: 9 additions & 0 deletions .github/workflows/ci_integration_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ jobs:
steps:
- name: Checkout (GitHub)
uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/ci_lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ jobs:
steps:
- name: Checkout (GitHub)
uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/ci_unit_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ jobs:
steps:
- name: Checkout (GitHub)
uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
Expand Down
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM ros:humble-ros-core@sha256:854e48183c14881767553657ca73602fe7bb5d7f265f744c5ea66ef88bb59955
RUN mkdir /root/voraus-ros-bridge
COPY package.xml /root/voraus-ros-bridge/
COPY ./install/voraus-ros-bridge/ /root/voraus-ros-bridge/install/
COPY ./launch/* /root/voraus-ros-bridge/install/share/voraus-ros-bridge/
COPY ./voraus_interfaces/install/voraus_interfaces/lib/* /opt/ros/humble/lib/
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@

Enables `voraus.core` integration within the ROS framework.

## Quick Start

The easiest way to use the voraus ros bridge is to start it via the provided docker compose file.

`docker compose up`

Note that you have to run this command from within the directory where the `compose.yaml` is located.

## Development

This repository provides a dev container to streamline the development process.
Expand Down
7 changes: 7 additions & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
services:
voraus_ros_bridge:
image: voraus-ros-bridge:0.1.0
command: ros2 launch voraus-ros-bridge voraus-ros-bridge.launch.py
environment:
- AMENT_PREFIX_PATH=/root/voraus-ros-bridge/install:/opt/ros/humble
- ROS_NAMESPACE=robot1
16 changes: 16 additions & 0 deletions launch/voraus-ros-bridge.launch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import os
from launch import LaunchDescription
from launch_ros.actions import Node


def generate_launch_description():
return LaunchDescription(
[
Node(
package="voraus-ros-bridge",
namespace=os.environ.get("ROS_NAMESPACE", "robot1"),
executable="voraus-ros-bridge",
name="voraus_ros_bridge",
)
]
)
2 changes: 2 additions & 0 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
<depend>rosidl_runtime_rs</depend>
<depend>voraus_interfaces</depend>

<exec_depend>ros2launch</exec_depend>

<export>
<build_type>ament_cargo</build_type>
</export>
Expand Down