From 2ed3c5e75e3b453919dea20e362f49f1a753e6a3 Mon Sep 17 00:00:00 2001 From: chris-tier4 Date: Wed, 2 Oct 2024 10:32:04 +0900 Subject: [PATCH] test: test with projectBaseDir --- .github/workflows/BuildAndRun.yaml | 60 +++++++++++++++++++++++++++--- sonar-project.properties | 5 ++- 2 files changed, 58 insertions(+), 7 deletions(-) diff --git a/.github/workflows/BuildAndRun.yaml b/.github/workflows/BuildAndRun.yaml index 8a42df5a3b1..e32bae53506 100644 --- a/.github/workflows/BuildAndRun.yaml +++ b/.github/workflows/BuildAndRun.yaml @@ -54,19 +54,67 @@ jobs: run: | echo package_list=$(colcon list --names-only | tr '\n' ' ') >> $GITHUB_OUTPUT - - name: Show target packages - run: | - echo "Target packages: ${{ steps.list_packages.outputs.package_list }}" + # - name: Show target packages + # run: | + # echo "Target packages: ${{ steps.list_packages.outputs.package_list }}" + + # - name: Install dependencies + # run: | + # vcs import src < src/scenario_simulator_v2/dependency_${{ matrix.rosdistro }}.repos + + # - name: Resolve rosdep and install colcon mixin + # run: | + # apt-get update + # apt-get install -y python3-pip python3-colcon-lcov-result lcov + # rosdep update --include-eol-distros + # rosdep install -iy --from-paths src --rosdistro ${{ matrix.rosdistro }} + # colcon mixin add default https://raw.githubusercontent.com/colcon/colcon-mixin-repository/master/index.yaml + # colcon mixin update default + # shell: bash + + # - name: Build packages + # run: | + # source /opt/ros/${{ matrix.rosdistro }}/setup.bash + # colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release -DBUILD_CPP_MOCK_SCENARIOS=ON -DBUILD_TESTING=true -DCMAKE_CXX_FLAGS='-fprofile-arcs -ftest-coverage' -DCMAKE_C_FLAGS='-fprofile-arcs -ftest-coverage' --packages-up-to ${{ steps.list_packages.outputs.package_list }} + # shell: bash - - name: Debug - if: ${{ always() }} - uses: mxschmitt/action-tmate@v3 + # - name: Colcon test + # run: | + # source /opt/ros/${{ matrix.rosdistro }}/setup.bash + # source install/local_setup.bash + # colcon test --event-handlers console_cohesion+ --packages-select ${{ steps.list_packages.outputs.package_list }} + # colcon lcov-result --packages-select ${{ steps.list_packages.outputs.package_list }} + # shell: bash + + # - name: Show test result + # if: always() + # run: | + # source /opt/ros/${{ matrix.rosdistro }}/setup.bash + # source install/local_setup.bash + # colcon test-result --verbose + # shell: bash + + # - name: Scenario test + # run: | + # source install/setup.bash + # source install/local_setup.bash + # ./src/scenario_simulator_v2/.github/workflows/workflow.sh ./src/scenario_simulator_v2/test_runner/scenario_test_runner/config/workflow.txt global_frame_rate:=20 + # shell: bash + + # - name: Upload Lcov result + # uses: actions/upload-artifact@v4 + # with: + # name: lcov + # path: lcov + # retention-days: 1 - name: Run SonarCloud scan uses: SonarSource/sonarcloud-github-action@master env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + with: + projectBaseDir: ./src/scenario_simulator_v2 # - name: Basic test # run: | diff --git a/sonar-project.properties b/sonar-project.properties index 06dbc2b0f1a..4ba09f10b2a 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -5,9 +5,12 @@ sonar.organization=tier4 sonar.projectName=scenario_simulator_v2 sonar.projectVersion=1.0 -sonar.sources=**/src/**/* +sonar.sources=. +sonar.inclusions=**/src/**/*.cpp +sonar.exclusions=**/test/** # Encoding of the source code. Default is default system encoding sonar.sourceEncoding=UTF-8 +# Path to the gcov coverage reports sonar.cfamily.gcov.reportsPath=/lcov/total_coverage.info