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

Add CI using GitHub Actions #256

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
5909876
Create actions file for github
poggenhans Dec 20, 2019
eb8df7e
Update dockerimage.yml
poggenhans Dec 20, 2019
85cf04a
Update dockerimage.yml
poggenhans Dec 20, 2019
2ca4ca8
Update dockerimage.yml
poggenhans Dec 20, 2019
f421217
Update dockerimage.yml
poggenhans Dec 20, 2019
d4a536f
Modernize CI and Dockerfile
poggenhans Sep 20, 2022
ec5185d
Fix Dockerfile
poggenhans Sep 20, 2022
9e1ca88
Refactor dockerfile and add formatting check
poggenhans Sep 21, 2022
fd52f61
Add clang-tidy job
poggenhans Sep 21, 2022
18ebcce
Bugfixing
poggenhans Sep 21, 2022
e59bab7
change maintainer in package.xml
immel-f Sep 27, 2022
e729c3a
add stale issues/PRs action
immel-f Sep 27, 2022
dcf6b5f
remove stale issues action
immel-f Sep 27, 2022
d38854c
add lcov processing and stale action
immel-f Oct 7, 2022
7a2411e
fix typo
immel-f Oct 7, 2022
8eab2c6
Fix ci.yaml
immel-f Oct 7, 2022
4a4c146
Update ci.yaml
immel-f Oct 7, 2022
0778d6a
bugfixes lcov bash script
immel-f Oct 9, 2022
155392b
debug lcov_merge.bash
immel-f Oct 9, 2022
d8449a3
test lcov gen with noetic
immel-f Oct 9, 2022
c242fe6
fix docker run
immel-f Oct 10, 2022
67d92d6
fix docker exec
immel-f Oct 10, 2022
3440220
fix docker for lcov
immel-f Oct 10, 2022
7e9dd9f
fix lcov script
immel-f Oct 10, 2022
7f6d74c
fix lcov file output path
immel-f Oct 10, 2022
c85a3ab
fix lcov docker cmds
immel-f Oct 10, 2022
b40706a
fix lcov docker names
immel-f Oct 10, 2022
a305c9f
fix lcov docker name
immel-f Oct 10, 2022
309d9f7
change lcov reporter action version
immel-f Oct 10, 2022
ed0bb85
try different lcov reporter action
immel-f Oct 12, 2022
1fe3c12
update action versions and add forked lcov reporter
immel-f Oct 14, 2022
1c32cf4
fix lcov action version
immel-f Oct 14, 2022
0df687d
fix lcov action repo
immel-f Oct 14, 2022
53744c1
fix lcov action version
immel-f Oct 14, 2022
4fdae37
fix lcov action version
immel-f Oct 14, 2022
7cbf2f9
fix lcov action version
immel-f Oct 14, 2022
485bc0e
fix lcov action version
immel-f Oct 14, 2022
af3e86d
fix lcov action version
immel-f Oct 14, 2022
380ca14
fix lcov action version
immel-f Oct 14, 2022
f062228
Update ci.yaml
immel-f Oct 17, 2022
3625489
Update ci.yaml
immel-f Oct 17, 2022
9a86b7f
Update ci.yaml
immel-f Oct 17, 2022
9051fdc
update lcov reporter version
immel-f Oct 17, 2022
979ef2c
update lcov reporter version
immel-f Oct 17, 2022
2352d2d
update lcov reporter version
immel-f Oct 18, 2022
1fe518d
Update CODEOWNERS
immel-f Oct 18, 2022
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
35 changes: 34 additions & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,5 +1,38 @@
# clang tidy file installed by mrt_tools. Do not modify: This file will be overwritten.
Checks: '-*,mrt*,bugprone-*,-bugprone-exception-escape,clang-analyzer-apiModeling*,clang-analyzer-core*,-clang-analyzer-core.UndefinedBinaryOperatorResult,clang-analyzer-deadcode*,clang-analyzer-unix*,clang-analyzer-cplusplus*,-clang-analyzer-cplusplus.NewDelete,cppcoreguidelines-*,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-cppcoreguidelines-owning-memory,-cppcoreguidelines-pro-type-vararg,-cppcoreguidelines-avoid-magic-numbers,-cppcoreguidelines-avoid-c-arrays,google-explicit-constructor,google-global-names-in-headers,google-readability-casting,google-readability-namespace-comments,google-global-names-in-headers,google-build-namespaces,performance-*,readability-*,-readability-uppercase-literal-suffix,-readability-magic-numbers,modernize-*,-modernize-use-trailing-return-type,-modernize-use-nodiscard,-modernize-concat-nested-namespaces,-modernize-avoid-c-arrays,misc-*,-misc-non-private-member-variables-in-classes'
Checks: >
-*,
mrt*,
bugprone-*,
-bugprone-exception-escape,
clang-analyzer-apiModeling*,
clang-analyzer-core*,
-clang-analyzer-core.UndefinedBinaryOperatorResult,
clang-analyzer-deadcode*,
clang-analyzer-unix*,
clang-analyzer-cplusplus*,
-clang-analyzer-cplusplus.NewDelete,
cppcoreguidelines-*,
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
-cppcoreguidelines-owning-memory,
-cppcoreguidelines-pro-type-vararg,
-cppcoreguidelines-avoid-magic-numbers,
-cppcoreguidelines-avoid-c-arrays,
google-explicit-constructor,
google-global-names-in-headers,
google-readability-namespace-comments,
google-build-namespaces,
performance-*,
readability-*,
-readability-uppercase-literal-suffix,
-readability-magic-numbers,
-readability-identifier-length,
modernize-*,
-modernize-use-trailing-return-type,
-modernize-use-nodiscard,
-modernize-concat-nested-namespaces,
-modernize-avoid-c-arrays,
misc-*,
-misc-non-private-member-variables-in-classes
HeaderFilterRegex: '^(?!\/usr)(?!\/opt).*\/src\/.*'
AnalyzeTemporaryDtors: false
CheckOptions:
Expand Down
34 changes: 34 additions & 0 deletions .github/lcov_merge.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash
set -ex
SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
LANELET2_ROOT=$(dirname $SCRIPT_DIR)
WORKSPACE_ROOT=$(dirname $(dirname $LANELET2_ROOT))

src_dirs=""
for d in ${LANELET2_ROOT}/*/ ; do
[ "$(basename $d)" = ".github" ] && continue
[ "$(basename $d)" = "lanelet2" ] && continue
src_dirs="${src_dirs} ${d}*"
done

lcov_filtered_files=""
for d in ${LANELET2_ROOT}/*/ ; do
[ "$(basename $d)" = ".github" ] && continue
[ "$(basename $d)" = "lanelet2" ] && continue
pkg="$(basename $d)"
build_dir="${WORKSPACE_ROOT}/build/${pkg}"

file="${build_dir}/mrt_coverage/full_coverage.lcov"
if [ -f "$file" ]; then
filtered_path="${build_dir}/mrt_coverage/full_coverage_filtered.lcov"

set -f
lcov -o ${filtered_path} -e ${file}${src_dirs}
set +f

lcov_filtered_files="${lcov_filtered_files} -a ${filtered_path}"
fi;
done

mkdir -p "${WORKSPACE_ROOT}/lcov"
lcov -o "${WORKSPACE_ROOT}/lcov/full_coverage.lcov" ${lcov_filtered_files}
38 changes: 38 additions & 0 deletions .github/lint.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/bash
set -ex
SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
LANELET2_ROOT=$(dirname $SCRIPT_DIR)

export BUILD_DIR=/tmp/lanelet2_build_lint_$(id -u)

# setup mrt_cmake_modules, otherwise assume it's installed
set +x
source /opt/ros/*/setup.bash
set -x
if [[ -e $LANELET2_ROOT/../mrt_cmake_modules ]]; then
mkdir -p $BUILD_DIR/mrt_cmake_modules
pushd $BUILD_DIR/mrt_cmake_modules
cmake $LANELET2_ROOT/../mrt_cmake_modules -DCMAKE_INSTALL_PREFIX=$BUILD_DIR/mrt_cmake_modules
make install
popd
fi

# make sure cmake finds everything
export CMAKE_PREFIX_PATH=$BUILD_DIR/mrt_cmake_modules:${CMAKE_PREFIX_PATH}
export AMENT_PREFIX_PATH=${LANELET2_ROOT}

# generate a compile_commands.json by configuring all lanelet2 packages in a big project
CMAKE_ROOT=${LANELET2_ROOT}/CMakeLists.txt
echo "cmake_minimum_required(VERSION 3.12)" > ${CMAKE_ROOT}
echo "project(lanelet2)" >> ${CMAKE_ROOT}
export LANELET2_PACKAGES_TOPOLOGICAL="lanelet2_core lanelet2_io lanelet2_projection lanelet2_traffic_rules lanelet2_routing lanelet2_maps lanelet2_validation lanelet2_matching lanelet2_python lanelet2_examples"
for pkg in $LANELET2_PACKAGES_TOPOLOGICAL; do
echo "add_subdirectory($pkg)" >> ${CMAKE_ROOT};
echo "set(${pkg}_LIBRARIES $pkg)" >> ${CMAKE_ROOT};
done
pushd $BUILD_DIR
cmake $LANELET2_ROOT -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DCATKIN_ENABLE_TESTING=1
popd

# run clang-tidy
find . -name "*.cpp" -print0 | xargs -0 -I{} -P$(nproc --all) clang-tidy-11 -p $BUILD_DIR {}
178 changes: 178 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
name: Lanelet2 CI

on:
push:
branches:
- "**"
tags:
- "**"
# Run tests for any PRs.
pull_request:

jobs:
formatting:
runs-on: ubuntu-latest
steps:
- name: Setup docker buildx
id: buildx
uses: docker/setup-buildx-action@v2

- name: Setup docker cache
uses: actions/cache@v3
with:
path: /tmp/.docker-cache
key: ${{runner.os}}-docker-humble

- name: Build dependencies
uses: docker/build-push-action@v3
with:
builder: ${{ steps.buildx.outputs.name }}
tags: lanelet2_src
cache-from: type=local,src=/tmp/.docker-cache
cache-to: type=local,dest=/tmp/.docker-cache
load: true
build-args: |
DEV=1
DISTRIBUTION=22.04
ROS_DISTRO=humble
ROS=ros2
target: lanelet2_src

- name: Run clang formatting check
run: |
set -ex
docker run -i --rm lanelet2_src find . -name "*.cpp" -o -name "*.h" -execdir clang-format-11 -n -Werror --style=file {} +

lint:
needs: formatting
runs-on: ubuntu-latest
steps:
- name: Setup docker buildx
id: buildx
uses: docker/setup-buildx-action@v2

- name: Setup docker cache
uses: actions/cache@v3
with:
path: /tmp/.docker-cache
key: ${{runner.os}}-docker-humble

- name: Build dependencies
uses: docker/build-push-action@v3
with:
builder: ${{ steps.buildx.outputs.name }}
tags: lanelet2_src
cache-from: type=local,src=/tmp/.docker-cache
cache-to: type=local,dest=/tmp/.docker-cache
load: true
build-args: |
DEV=1
DISTRIBUTION=22.04
ROS_DISTRO=humble
ROS=ros2
target: lanelet2_src
- name: Run clang-tidy
run: docker run -i --rm lanelet2_src /home/developer/workspace/src/lanelet2/.github/lint.bash

test:
needs: formatting
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
rosdistro: [noetic, galactic, humble]
include:
- rosdistro: noetic
os: 20.04
ros: ros
- rosdistro: galactic
os: 20.04
ros: ros2
- rosdistro: humble
os: 22.04
ros: ros2
steps:
- name: Setup docker buildx
id: buildx
uses: docker/setup-buildx-action@v2

- name: Setup docker cache
uses: actions/cache@v3
with:
path: /tmp/.docker-cache
key: ${{runner.os}}-docker-${{ matrix.rosdistro }}

- name: Build dependencies
uses: docker/build-push-action@v3
with:
builder: ${{ steps.buildx.outputs.name }}
tags: lanelet2_base:${{ matrix.rosdistro }}
cache-from: type=local,src=/tmp/.docker-cache
cache-to: type=local,dest=/tmp/.docker-cache
build-args: |
DEV=1
DISTRIBUTION=${{ matrix.os }}
ROS_DISTRO=${{ matrix.rosdistro }}
ROS=${{ matrix.ros }}
target: lanelet2_deps

- name: Build Lanelet2
uses: docker/build-push-action@v3
if: ${{ matrix.rosdistro == 'noetic' }}
with:
builder: ${{ steps.buildx.outputs.name }}
tags: lanelet2:${{ matrix.rosdistro }}
cache-from: type=local,src=/tmp/.docker-cache
load: true
build-args: |
DEV=1
DISTRIBUTION=${{ matrix.os }}
ROS_DISTRO=${{ matrix.rosdistro }}
ROS=${{ matrix.ros }}
target: lanelet2

- name: Build Lanelet2 (skip lcov)
uses: docker/build-push-action@v3
if: ${{ matrix.rosdistro == 'humble' || matrix.rosdistro == 'galactic' }}
with:
builder: ${{ steps.buildx.outputs.name }}
tags: lanelet2:${{ matrix.rosdistro }}
cache-from: type=local,src=/tmp/.docker-cache
load: true
build-args: |
DEV=0
DISTRIBUTION=${{ matrix.os }}
ROS_DISTRO=${{ matrix.rosdistro }}
ROS=${{ matrix.ros }}
target: lanelet2

- name: Run Lanelet2 Tests
run: |
set -ex;
if [ "${{matrix.ros}}" = "ros" ]; then
export TEST_CMD="catkin build --no-status --catkin-make-args run_tests && source /opt/ros/${{matrix.rosdistro}}/setup.bash && catkin_test_results --verbose";
else
export TEST_CMD="colcon test --return-code-on-test-failure";
fi;
docker run -i --name lanelet2_test_${{ matrix.rosdistro }} lanelet2:${{ matrix.rosdistro }} /bin/bash -c "$TEST_CMD";

- name: Extract and Merge lcov Files
if: ${{ matrix.rosdistro == 'noetic' }}
run: |
docker commit lanelet2_test_${{ matrix.rosdistro }} lanelet2_${{ matrix.rosdistro }}_post_run;
docker run -i --name lanelet2_test_${{ matrix.rosdistro }}_lcov lanelet2_${{ matrix.rosdistro }}_post_run /home/developer/workspace/src/lanelet2/.github/lcov_merge.bash;
mkdir -p ./lcov;
docker cp lanelet2_test_${{ matrix.rosdistro }}_lcov:$(docker inspect --format='{{.Config.WorkingDir}}' lanelet2_test_${{ matrix.rosdistro }}_lcov)/lcov/full_coverage.lcov ./lcov/full_coverage.lcov;

- name: Cleanup Docker Container
run: |
docker rm -f lanelet2_test_${{ matrix.rosdistro }};
docker rm -f lanelet2_test_${{ matrix.rosdistro }}_lcov;

- name: Report code coverage
uses: immel-f/github-actions-report-lcov@v0.1.9
if: ${{ matrix.rosdistro == 'noetic' }}
with:
coverage-files: ./lcov/full_coverage.lcov
artifact-name: code-coverage-report
github-token: ${{ secrets.GITHUB_TOKEN }}
24 changes: 24 additions & 0 deletions .github/workflows/stale.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: 'Close stale issues and PRs'
on:
schedule:
- cron: '30 1 * * *'

jobs:
stale:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write

steps:
- uses: actions/stale@v6
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: 'This issue is stale because it has been open for 90 days with no activity. Is this issue still work in progress? If yes, mark it as "WIP" or comment, otherwise it will be closed in 30 days.'
stale-pr-message: 'This PR is stale because it has been open for 90 days with no activity. Is this PR still work in progress? If yes, mark it as "WIP" or comment, otherwise it will be closed in 30 days.'
close-issue-message: 'This issue was closed because it has been stalled for 30 days with no activity.'
close-pr-message: 'This PR was closed because it has been stalled for 30 days with no activity.'
days-before-stale: 90
days-before-close: 30
exempt-pr-labels: 'WIP'
exempt-issue-labels: 'WIP'
2 changes: 1 addition & 1 deletion CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
* fabian.poggenhans@kit.edu frank.bieder@kit.edu
* fabian.poggenhans@kit.edu fabian.immel@kit.edu
lanelet2_projection/* jan-hendrik.pauls@kit.edu
Loading