-
Notifications
You must be signed in to change notification settings - Fork 0
97 lines (88 loc) · 2.91 KB
/
Copy pathlint_build_test.yaml
File metadata and controls
97 lines (88 loc) · 2.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
name: Lint, Build & Test
on:
push:
branches: [jazzy]
pull_request:
branches: [jazzy]
defaults:
run:
shell: bash
jobs:
Linting:
name: Lint Code Base
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Setup
run: sudo apt-get update && sudo apt-get install -y black clang-format cppcheck libxml2-utils
- name: Set up Python
uses: actions/setup-python@v4
- name: Install and Run pre-commit
uses: pre-commit/action@v3.0.1
with:
extra_args: --all-files
build-and-test:
needs: Linting
strategy:
matrix:
setup:
- rosdistro: jazzy
os: ubuntu-24.04
runs-on: ${{ matrix.setup.os }}
container:
image: ros:${{ matrix.setup.rosdistro }}-ros-base
steps:
- name: Install Build Tools
run: |
sudo apt-get update
sudo apt-get install -y ros-dev-tools python3-vcstool
- name: Checkout Local Repo
uses: actions/checkout@v4
with:
path: src/${{ github.event.repository.name }}
- name: Recursive VCS Import
run: |
cd src
PREVIOUS_HASH=""
for i in {1..10}; do
REPOS_FILES=$(find . -name "*.repos")
CURRENT_HASH=$(echo "$REPOS_FILES" | sort | md5sum)
if [ "$CURRENT_HASH" == "$PREVIOUS_HASH" ]; then
echo "Dependency tree fully resolved at level $((i-1))."
break
fi
echo "Processing Level $i dependencies..."
for f in $REPOS_FILES; do
vcs import . < "$f" --skip-existing
done
PREVIOUS_HASH="$CURRENT_HASH"
done
- name: rosdep
run: |
rosdep update --rosdistro ${{ matrix.setup.rosdistro }} --include-eol-distros
rosdep install -y --from-paths src --ignore-src --rosdistro ${{ matrix.setup.rosdistro }}
- name: Identify Local Packages
run: |
source /opt/ros/${{ matrix.setup.rosdistro }}/setup.bash
# Filter for local repo and flatten newlines to spaces
PKGS=$(colcon list --names-only --base-paths src/${{ github.event.repository.name }} | tr '\n' ' ')
if [ -z "$PKGS" ]; then
echo "::error::No packages found in src/${{ github.event.repository.name }}"
exit 1
fi
echo "LOCAL_PKGS=$PKGS" >> $GITHUB_ENV
echo "Found packages: $PKGS"
- name: Build Local Packages
run: |
source /opt/ros/${{ matrix.setup.rosdistro }}/setup.bash
colcon build --packages-up-to ${{ env.LOCAL_PKGS }} --event-handlers console_direct+
- name: Test Local Packages
run: |
source /opt/ros/${{ matrix.setup.rosdistro }}/setup.bash
colcon test --packages-select ${{ env.LOCAL_PKGS }} --event-handlers console_direct+
- name: Test Results
if: always()
run: |
source /opt/ros/${{ matrix.setup.rosdistro }}/setup.bash
colcon test-result --verbose