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

[#12] Add initial CI workflows #18

Merged
merged 8 commits into from
Dec 16, 2024
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
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @orecham
19 changes: 19 additions & 0 deletions .github/actions/install-clang/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: 'Install clang toolchain'
runs:
using: "composite"
steps:
- name: Install iceoryx dependencies and clang-tidy
shell: bash
run: |
sudo wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo add-apt-repository "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main"
sudo apt-get update
sudo apt-get install -y clang-format-18 clang-tidy-18 clang-tools-18 clang-18 lld
sudo rm -f /usr/bin/clang
sudo rm -f /usr/bin/clang++
sudo rm -f /usr/bin/clang-tidy
sudo rm -f /usr/bin/clang-format
sudo ln -s /usr/bin/clang-18 /usr/bin/clang
sudo ln -s /usr/bin/clang++-18 /usr/bin/clang++
sudo ln -s /usr/bin/clang-tidy-18 /usr/bin/clang-tidy
sudo ln -s /usr/bin/clang-format-18 /usr/bin/clang-format
129 changes: 127 additions & 2 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
name: CI
env:
WORKSPACE_DIR: ${{ github.workspace }}
TEST_ARGS: "--cmake-args -DBUILD_TESTING=ON"
on:
push:
branches: [ main ]
Expand All @@ -17,6 +20,7 @@ jobs:
steps:
- name: Checkout sources
uses: actions/checkout@v4

- name: Check for changed file types
uses: dorny/paths-filter@v3
id: filter
Expand All @@ -26,6 +30,7 @@ jobs:
- '!**/*.md'
markdown:
- '**/*.md'

preflight-check:
needs: changes
if: ${{ needs.changes.outputs.source-code == 'true' }}
Expand All @@ -34,7 +39,127 @@ jobs:
steps:
- name: Checkout sources
uses: actions/checkout@v4

- name: Check format of all commit messages
run: ./internal/scripts/ci/check-commit-msg.sh
run: ./scripts/ci/check-commit-msg.sh

- name: Check license header
run: ./internal/scripts/ci/check-spdx-license-header.sh
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|[email protected]:|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
4 changes: 0 additions & 4 deletions rmw_iceoryx2.repos → deps.repos
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,3 @@ repositories:
type: git
url: [email protected]:eclipse-iceoryx/iceoryx2.git
version: 54ebc96d03f4d7b14257413ccff6529cbb7288a3
rmw_iceoryx2:
type: git
url: [email protected]:ekxide/rmw_iceoryx2.git
version: v0.1.0
4 changes: 2 additions & 2 deletions doc/release-notes/unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
conflicts when merging.
-->

* Example text [#1](https://github.com/ekxide/rmw_iceoryx2/issues/1)
* Use VCS to manage dependencies [#13](https://github.com/ekxide/rmw_iceoryx2/issues/13)
* Add CI workflow for building and testing [#12](https://github.com/ekxide/rmw_iceoryx2/issues/12)

### New API features

Expand All @@ -47,7 +48,6 @@
conflicts when merging.
-->

* Use VCS to manage dependencies [#13](https://github.com/ekxide/rmw_iceoryx2/issues/13)

### API Breaking Changes

Expand Down
25 changes: 21 additions & 4 deletions rmw_iceoryx2_cxx/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# Copyright (c) 2024 by Ekxide IO GmbH All rights reserved.
#
# This program and the accompanying materials are made available under the
# terms of the Apache Software License 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0, or the MIT license
# which is available at https://opensource.org/licenses/MIT.
#
# SPDX-License-Identifier: Apache-2.0 OR MIT

cmake_minimum_required(VERSION 3.5)
project(rmw_iceoryx2_cxx)

Expand Down Expand Up @@ -32,9 +41,9 @@ set(AMENT_PACKAGES
rcpputils
rmw
rosidl_runtime_cpp
rosidl_typesupport_introspection_c
rosidl_typesupport_introspection_c
rosidl_typesupport_introspection_cpp
rosidl_typesupport_fastrtps_c
rosidl_typesupport_fastrtps_c
rosidl_typesupport_fastrtps_cpp
fastrtps
)
Expand Down Expand Up @@ -128,9 +137,17 @@ if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
find_package(ament_cmake_gtest REQUIRED)

# disabled because alternative copyright check utilized
set(ament_cmake_copyright_FOUND TRUE)
# disabled because clang-format and clang-tidy preferred
set(ament_cmake_cpplint_FOUND TRUE)
set(ament_cmake_uncrustify_FOUND TRUE)
# disabled because <package format="3"> not supported
set(ament_cmake_xmllint_FOUND TRUE)

ament_lint_auto_find_test_dependencies()

ament_add_gtest(test_rmw_iceoryx2_cxx
ament_add_gtest(test_rmw_iceoryx2_cxx
test/testing/base.cpp
test/test_iox2_context_impl.cpp
test/test_iox2_guard_condition_impl.cpp
Expand All @@ -153,7 +170,7 @@ if(BUILD_TESTING)
test/test_rmw_publish_subscribe.cpp
test/test_rmw_waitset.cpp
)
target_link_libraries(test_rmw_iceoryx2_cxx
target_link_libraries(test_rmw_iceoryx2_cxx
${PROJECT_NAME}
)
ament_target_dependencies(test_rmw_iceoryx2_cxx
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Copyright (c) 2024 by Ekxide IO GmbH All rights reserved.
//
// This program and the accompanying materials are made available under the
// terms of the Apache Software License 2.0 which is available at
// https://www.apache.org/licenses/LICENSE-2.0, or the MIT license
// which is available at https://opensource.org/licenses/MIT.
//
// SPDX-License-Identifier: Apache-2.0 OR MIT
5 changes: 4 additions & 1 deletion rmw_iceoryx2_cxx/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@
<name>rmw_iceoryx2_cxx</name>
<version>0.1.0</version>
<description>RMW implementation for the pure Rust next-gen zero-copy middleware iceoryx2</description>
<author email="[email protected]">Jeff Ithier</author>
<maintainer email="[email protected]">ekxide developers</maintainer>

<author email="[email protected]">Jeff Ithier</author>

<license>Apache 2.0</license>
<license>MIT</license>

<buildtool_depend>ament_cmake</buildtool_depend>

Expand Down
8 changes: 8 additions & 0 deletions rmw_iceoryx2_cxx/src/message/typesupport.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Copyright (c) 2024 by Ekxide IO GmbH All rights reserved.
//
// This program and the accompanying materials are made available under the
// terms of the Apache Software License 2.0 which is available at
// https://www.apache.org/licenses/LICENSE-2.0, or the MIT license
// which is available at https://opensource.org/licenses/MIT.
//
// SPDX-License-Identifier: Apache-2.0 OR MIT
15 changes: 5 additions & 10 deletions rmw_iceoryx2_cxx/src/rmw/identifier.cpp
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
// Copyright (c) 2024 by Ekxide IO GmbH All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// This program and the accompanying materials are made available under the
// terms of the Apache Software License 2.0 which is available at
// https://www.apache.org/licenses/LICENSE-2.0, or the MIT license
// which is available at https://opensource.org/licenses/MIT.
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// SPDX-License-Identifier: Apache-2.0 OR MIT

#include "rmw_iceoryx2_cxx/identifier.hpp"

Expand Down
9 changes: 9 additions & 0 deletions rmw_iceoryx2_cxx_demo_nodes/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# Copyright (c) 2024 by Ekxide IO GmbH All rights reserved.
#
# This program and the accompanying materials are made available under the
# terms of the Apache Software License 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0, or the MIT license
# which is available at https://opensource.org/licenses/MIT.
#
# SPDX-License-Identifier: Apache-2.0 OR MIT

cmake_minimum_required(VERSION 3.8)
project(rmw_iceoryx2_cxx_demo_nodes)

Expand Down
9 changes: 9 additions & 0 deletions rmw_iceoryx2_cxx_test_msgs/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# Copyright (c) 2024 by Ekxide IO GmbH All rights reserved.
#
# This program and the accompanying materials are made available under the
# terms of the Apache Software License 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0, or the MIT license
# which is available at https://opensource.org/licenses/MIT.
#
# SPDX-License-Identifier: Apache-2.0 OR MIT

cmake_minimum_required(VERSION 3.5)
project(rmw_iceoryx2_cxx_test_msgs)

Expand Down
8 changes: 8 additions & 0 deletions scripts/ci/check-clang-tidy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copyright (c) 2024 by Ekxide IO GmbH All rights reserved.
#
# This program and the accompanying materials are made available under the
# terms of the Apache Software License 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0, or the MIT license
# which is available at https://opensource.org/licenses/MIT.
#
# SPDX-License-Identifier: Apache-2.0 OR MIT
12 changes: 6 additions & 6 deletions scripts/ci/check-commit-msg.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Copyright (c) 2024 by Ekxide IO GmbH All rights reserved.
# Copyright (c) 2024 by Ekxide IO GmbH All rights reserved.
#
# This program and the accompanying materials are made available under the
# terms of the Apache Software License 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0, or the MIT license
# which is available at https://opensource.org/licenses/MIT.
# This program and the accompanying materials are made available under the
# terms of the Apache Software License 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0, or the MIT license
# which is available at https://opensource.org/licenses/MIT.
#
# SPDX-License-Identifier: Apache-2.0 OR MIT
# SPDX-License-Identifier: Apache-2.0 OR MIT

#!/bin/bash

Expand Down
12 changes: 6 additions & 6 deletions scripts/ci/check-spdx-license-header.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Copyright (c) 2024 by Ekxide IO GmbH All rights reserved.
# Copyright (c) 2024 by Ekxide IO GmbH All rights reserved.
#
# This program and the accompanying materials are made available under the
# terms of the Apache Software License 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0, or the MIT license
# which is available at https://opensource.org/licenses/MIT.
# This program and the accompanying materials are made available under the
# terms of the Apache Software License 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0, or the MIT license
# which is available at https://opensource.org/licenses/MIT.
#
# SPDX-License-Identifier: Apache-2.0 OR MIT
# SPDX-License-Identifier: Apache-2.0 OR MIT

#!/bin/bash

Expand Down
Loading