Repository navigation
110 lines (98 loc) · 3.82 KB
/
Copy pathci.yaml
File metadata and controls
110 lines (98 loc) · 3.82 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
98
99
100
101
102
103
104
105
106
107
108
109
110
name: CI
on: [push, pull_request]
jobs:
quality_checks:
name: "Lint, Compile & Test"
runs-on: ubuntu-latest
container:
image: ros:rolling-perception
defaults:
run:
shell: bash
env:
ROS_DISTRO: rolling
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Rust toolchain
run: |
set -euxo pipefail
cd "$GITHUB_WORKSPACE"
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \
--default-toolchain stable --profile minimal
$HOME/.cargo/bin/rustup component add clippy rustfmt
- name: Install linting tools
run: |
set -euxo pipefail
apt-get update
apt-get install -y --no-install-recommends shellcheck yamllint
- name: Install libclang (OpenCV binding codegen dependency)
# Unversioned packages track each distro's default clang version
# (18 on Jazzy/Noble, 21 on Rolling/Resolute) so one line covers both.
run: |
set -euxo pipefail
apt-get update
apt-get install -y --no-install-recommends libclang-dev clang
- name: package.xml lint (ament_xmllint)
run: |
set -euxo pipefail
set +u
. /opt/ros/$ROS_DISTRO/setup.bash
set -u
cd "$GITHUB_WORKSPACE"
ament_xmllint
- name: launch file lint (ament_lint)
run: |
set -euxo pipefail
set +u
. /opt/ros/$ROS_DISTRO/setup.bash
set -u
cd "$GITHUB_WORKSPACE"
ament_flake8 launch && ament_pep257 launch
- name: bash script checks (shellcheck)
run: |
set -euxo pipefail
cd "$GITHUB_WORKSPACE"
while IFS= read -r -d '' script; do
shellcheck -x "$script"
done < <(find scripts -name '*.bash' -print0)
- name: YAML checks (yamllint)
run: |
set -euxo pipefail
cd "$GITHUB_WORKSPACE"
yamllint -d "{extends: default, rules: {line-length: disable}}" \
.github/workflows package.xml
- name: Cargo fmt check
run: |
set -euxo pipefail
cd "$GITHUB_WORKSPACE"
$HOME/.cargo/bin/cargo fmt --check
- name: Cargo clippy
run: |
set -euxo pipefail
cd "$GITHUB_WORKSPACE"
# OpenCV binding generator needs the C++ stdlib include dirs spelled out
# on newer clang (resolute/clang-21). Extract the C++ stdlib search chain
# from `g++ -v` into CPLUS_INCLUDE_PATH so clang prepends them before
# /usr/include — see Dockerfile for details.
export CPLUS_INCLUDE_PATH=$(g++ -x c++ -v -fsyntax-only - </dev/null 2>&1 \
| awk '/#include <...> search starts here:/{f=1;next} /End of search list/{f=0} f && /c\+\+/{gsub(/^[ \t]+/, ""); print}' \
| paste -sd: -)
echo "CPLUS_INCLUDE_PATH=${CPLUS_INCLUDE_PATH}"
$HOME/.cargo/bin/cargo clippy --all-targets -- -D warnings
- name: Cargo test (unit + integration tests)
run: |
set -euxo pipefail
set +u
source /opt/ros/$ROS_DISTRO/setup.bash
set -u
export PKG_CONFIG_PATH="/opt/ros/$ROS_DISTRO/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
export CARGO_HOME="$HOME/.cargo"
export RUSTUP_HOME="$HOME/.rustup"
# C++ stdlib include chain from g++ -v (see Dockerfile / clippy step).
export CPLUS_INCLUDE_PATH=$(g++ -x c++ -v -fsyntax-only - </dev/null 2>&1 \
| awk '/#include <...> search starts here:/{f=1;next} /End of search list/{f=0} f && /c\+\+/{gsub(/^[ \t]+/, ""); print}' \
| paste -sd: -)
unset DISPLAY
cd "$GITHUB_WORKSPACE"
$HOME/.cargo/bin/cargo test --all-targets