From d37f30581ffdfd9b2158cc1656ae121402c0527a Mon Sep 17 00:00:00 2001 From: Leon De Andrade Date: Fri, 29 Sep 2023 16:13:03 +0200 Subject: [PATCH] Add Coverage (#2) Co-authored-by: seskibinski --- .github/workflows/documentation.yml | 3 +-- .github/workflows/main.yml | 30 +++++++++++++++-------------- README.md | 2 +- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index e1ff0d8..308240c 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -7,8 +7,7 @@ name: Rail Horizon Documentation on: push: branches: -# - main - - '**' + - main permissions: contents: write diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fa8af10..4982994 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -13,23 +13,19 @@ on: - '**' env: - GOPRIVATE: github.com/DSD-DBS/* DB_MAP_VERSION: 12 DB_MAP_ENDPOINT: DB_LAN DB_MAP_CATALOG: validate.s4r2.oss.4 - PERSISTENT_STORAGE_ROOT_DIR: ./hdmap + PERSISTENT_STORAGE_ROOT_DIR: ${{ github.workspace }}/map_data RMW_IMPLEMENTATION: rmw_fastrtps_cpp jobs: build: runs-on: ubuntu-22.04 - defaults: run: shell: bash - steps: - - name: Checkout Rail Horizon code including submodules recursively uses: actions/checkout@v3 with: @@ -51,20 +47,26 @@ jobs: - name: Build Rail Horizon run: | source /opt/ros/humble/setup.bash - export RMW_IMPLEMENTATION=rmw_fastrtps_cpp colcon build --base-paths src --cmake-args -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=ON --event-handlers console_cohesion+ --packages-up-to dsd_rail_horizon colcon build --base-paths src --cmake-args -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=ON --event-handlers console_cohesion+ --packages-up-to dsd_mission_profile - name: Run tests run: | source /opt/ros/humble/setup.bash && source ./install/local_setup.bash - export RMW_IMPLEMENTATION=rmw_fastrtps_cpp - colcon test --packages-select dsd_rail_horizon_core dsd_mission_profile --return-code-on-test-failure --ctest-arg -E "overTheAirUpdateIsSucessfull" + colcon test --packages-select dsd_rail_horizon dsd_rail_horizon_core dsd_mission_profile --ctest-arg -E "overTheAirUpdateIsSucessfull" - - name: Upload build files - if: success() || failure() - uses: actions/upload-artifact@v3 + - name: Print test results + run: | + source /opt/ros/humble/setup.bash && source ./install/local_setup.bash + colcon test-result --verbose --all + + - name: Run code coverage + run: | + gcovr --exclude-unreachable-branches --exclude-throw-branches -r . --filter src/ --exclude '.*tests/' --xml ${{github.workspace}}/build/coverage.xml + + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v3 with: - name: build-folder - path: | - build + token: ${{ secrets.CODECOV_TOKEN }} + file: ${{github.workspace}}/build/coverage.xml + fail_ci_if_error: true diff --git a/README.md b/README.md index 4af628a..a200c9d 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ ~ SPDX-License-Identifier: CC0-1.0 --> -[![Rail Horizon Build](https://github.com/DSD-DBS/rail-horizon-oss/actions/workflows/main.yml/badge.svg)](https://github.com/DSD-DBS/rail-horizon-oss/actions/workflows/main.yml) [![Rail Horizon Documentation](https://github.com/DSD-DBS/rail-horizon-oss/actions/workflows/documentation.yml/badge.svg)](https://github.com/DSD-DBS/rail-horizon-oss/actions/workflows/documentation.yml) +[![Rail Horizon Build](https://github.com/DSD-DBS/rail-horizon-oss/actions/workflows/main.yml/badge.svg)](https://github.com/DSD-DBS/rail-horizon-oss/actions/workflows/main.yml) [![Rail Horizon Documentation](https://github.com/DSD-DBS/rail-horizon-oss/actions/workflows/documentation.yml/badge.svg)](https://github.com/DSD-DBS/rail-horizon-oss/actions/workflows/documentation.yml) [![codecov](https://codecov.io/github/DSD-DBS/rail-horizon-oss/graph/badge.svg?token=8AZSXJ7HPF)](https://codecov.io/github/DSD-DBS/rail-horizon-oss) # Rail Horizon