-
Notifications
You must be signed in to change notification settings - Fork 2
165 lines (145 loc) · 4.47 KB
/
build-test.yml
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
name: CI
env:
WORKSPACE_DIR: ${{ github.workspace }}
TEST_ARGS: "--cmake-args -DBUILD_TESTING=ON"
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
types: [ opened, ready_for_review, reopened, synchronize ]
jobs:
changes:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
source-code: ${{ steps.filter.outputs.source-code }}
markdown: ${{ steps.filter.outputs.markdown }}
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Check for changed file types
uses: dorny/paths-filter@v3
id: filter
with:
filters: |
source-code:
- '!**/*.md'
markdown:
- '**/*.md'
preflight-check:
needs: changes
if: ${{ needs.changes.outputs.source-code == 'true' }}
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Check format of all commit messages
run: ./scripts/ci/check-commit-msg.sh
- name: Check license header
run: ./scripts/ci/check-spdx-license-header.sh
static-code-analysis:
needs: preflight-check
if: ${{ needs.changes.outputs.source-code == 'true' }}
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Install clang toolchain
uses: ./.github/actions/install-clang
- name: Display clang-format and clang-tidy versions
run: |
clang-format --version
clang-tidy --version
- name: Run clang-format
run: git ls-files | grep -E "\.(c|cc|cpp|cxx|inl|h|hh|hpp|hxx)$" | xargs clang-format -i -style=file --Werror --dry-run
# - name: Run clang-tidy
# run: |
# git fetch origin main
# ./scripts/check-clang-tidy.sh warning-as-error diff-to-main
colcon-build-test-clang:
needs: [preflight-check, static-code-analysis]
runs-on: ubuntu-latest
container:
image: ros:rolling
steps:
- name: Install ros build dependencies
run: |
apt-get update
apt-get install -y \
python3-colcon-common-extensions \
python3-colcon-mixin \
python3-vcstool \
python3-rosdep \
libacl1-dev \
software-properties-common \
curl \
wget
- name: Install rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Create workspace
run: |
mkdir -p $WORKSPACE_DIR/src/rmw_iceoryx2
mkdir -p $WORKSPACE_DIR/src/test_interface_files
- name: Checkout test_interface_files
uses: actions/checkout@v4
with:
repository: ros2/test_interface_files
path: src/test_interface_files
ref: rolling
- name: Checkout current ref
uses: actions/checkout@v4
with:
path: src/rmw_iceoryx2
- name: Install clang toolchain
uses: ./src/rmw_iceoryx2/.github/actions/install-clang
- name: Import dependencies with VCS
run: |
cd $WORKSPACE_DIR
sed 's|git@github.com:|https://github.com/|g' src/rmw_iceoryx2/deps.repos > _deps.repos
vcs import src < _deps.repos
- name: Build with colcon
run: |
cd $WORKSPACE_DIR
. /opt/ros/rolling/setup.sh
colcon build \
--cmake-args \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DBUILD_TESTING=On \
--symlink-install \
--packages-select \
test_interface_files \
iceoryx_platform\
iceoryx_hoofs \
iceoryx2_cxx \
rmw_iceoryx2_cxx_test_msgs \
rmw_iceoryx2_cxx
- name: Run tests
run: |
cd $WORKSPACE_DIR
. /opt/ros/rolling/setup.sh
. install/setup.sh
colcon test \
--packages-select \
rmw_iceoryx2_cxx \
--event-handlers console_direct+ \
--return-code-on-test-failure
- name: Generate test reports
if: always()
run: |
cd $WORKSPACE_DIR
colcon test-result --verbose
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results
path: |
${{ env.WORKSPACE_DIR }}/build/*/test_results/*/*.xml
${{ env.WORKSPACE_DIR }}/log/**/test*.log