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
39 changes: 26 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,47 @@ on:
- main

jobs:
dbc-package-structure:
# Every directory containing a .dbc must be a ROS package (have package.xml + CMakeLists.txt calling dbc_package())
name: DBC package structure
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check every DBC directory is a ROS package
run: |
status=0
while IFS= read -r dir; do
if [ ! -f "$dir/package.xml" ] || [ ! -f "$dir/CMakeLists.txt" ]; then
echo "::error file=$dir::'$dir' contains .dbc file(s) but is not a ROS package (missing package.xml and/or CMakeLists.txt); colcon will silently skip it."
status=1
fi
done < <(git ls-files '*.dbc' | xargs -r -n1 dirname | sort -u)
if [ "$status" -eq 0 ]; then
echo "OK: every directory with a .dbc is a ROS package."
fi
exit "$status"

build_and_test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- ros: humble
ubuntu: jammy
- ros: jazzy
ubuntu: noble
- ros: kilted
ubuntu: noble
- ros: lyrical
ubuntu: resolute
- ros: rolling
ubuntu: resolute
ros: [humble, jazzy, lyrical, rolling]
name: ROS 2 ${{ matrix.ros }}
container:
image: ghcr.io/ros-tooling/setup-ros-docker/setup-ros-docker-ubuntu-${{ matrix.ubuntu }}:latest
image: polymathrobotics/ros:${{ matrix.ros }}-builder-ubuntu
env:
ROS_DISTRO: ${{ matrix.ros }}
PIP_BREAK_SYSTEM_PACKAGES: 1
steps:
- uses: actions/checkout@v4
- uses: ros-tooling/action-ros-ci@v0.4
with:
target-ros2-distro: ${{ matrix.ros }}
# dbc_gen_cpp's own test suite, pulled in with its checkout; not ours to build.
colcon-extra-args: --packages-skip test_dbc_gen_cpp
vcs-repo-file-url: repos.yaml
coverage-result: false
import-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/upload-artifact@v4
with:
name: colcon-logs-${{ matrix.ros }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
name: pre-commit

on: # yamllint disable-line
on:
pull_request:
push:
branches: [main]
Expand Down
63 changes: 63 additions & 0 deletions .github/workflows/validate-dbc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---
name: DBC File Check

on:
push:
branches: [main]
paths:
- '**.dbc'
- .github/workflows/validate-dbc.yml
pull_request:
paths:
- '**.dbc'
- .github/workflows/validate-dbc.yml

jobs:
discover:
runs-on: ubuntu-latest
outputs:
dirs: ${{ steps.dirs.outputs.dirs }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Detect changed DBC files
id: filter
uses: dorny/paths-filter@v4
with:
list-files: shell
filters: |
dbc:
- '**.dbc'

- name: Reduce changed files to their directories
id: dirs
env:
DBC_CHANGED: ${{ steps.filter.outputs.dbc }}
DBC_FILES: ${{ steps.filter.outputs.dbc_files }}
run: |
if [ "$DBC_CHANGED" = 'true' ]; then
dirs="$(for f in $DBC_FILES; do dirname "$f"; done | sort -u | jq -R . | jq -sc .)"
else
dirs='[]'
fi
echo "dirs=$dirs" >> "$GITHUB_OUTPUT"
echo "Directories to validate: $dirs"

validate-dbc:
needs: discover
if: needs.discover.outputs.dirs != '[]'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
dir: ${{ fromJson(needs.discover.outputs.dirs) }}
name: validate-dbc (${{ matrix.dir }})
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Validate DBC files
uses: polymathrobotics/validate_dbc@v0.1
with:
path: ${{ matrix.dir }}
6 changes: 5 additions & 1 deletion repos.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
---
repositories:
dbc_gen_cpp:
type: git
url: git@github.com:polymathrobotics/dbc_gen_cpp.git
version: main
socketcan_adapter:
type: git
url: https://github.com/polymathrobotics/socketcan_adapter.git
url: git@github.com:polymathrobotics/socketcan_adapter.git
version: main
119 changes: 0 additions & 119 deletions sygnal_dbc/CMakeLists.txt

This file was deleted.

Loading
Loading